trading. StockSharphttps://stocksharp.com/handlers/atom.ashx?category=tag&id=trading&type=articles&page=2Copyright @ StockSharp Platform LLC 2010 - 20242024-03-29T11:13:06Zhttps://stocksharp.com/images/logo.pnghttps://stocksharp.com/topic/10404/Something about StockSharp's source codes.2019-02-05T18:53:13Z2020-04-22T05:53:38ZЮрий Басанговhttps://stocksharp.com/users/7/info@stocksharp.com<a href='https://stocksharp.com/file/108538/c7o8f2exqamj2vi_jpg/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108538/c7o8f2exqamj2vi_jpg/?size=500x500" alt="http://" title="http://" /></a><br />Hello all! <br />We very often receive your messages with questions about source codes. Yes, we provide our sources and it is possible to buy it.<br /><br />First of all, we offer the sources of every part of our platform: starting from charting component and single connectors and whole applications, like <a href="https://stocksharp.com/products/terminal/" title="https://stocksharp.com/products/terminal/">S#.Terminal</a>, <a href="https://stocksharp.com/products/designer/" title="https://stocksharp.com/products/designer/">S#.Designer</a>, <a href="https://stocksharp.com/products/hydra/" title="https://stocksharp.com/products/hydra/">S#.Data</a>. <br /><br />Let me repeat this again, you can buy <b><span style="color:green">every part of Stocksharp platform</span></b>, not only listed on our page <a href="https://stocksharp.com/products/pricing/" title="https://stocksharp.com/products/pricing/">"Pricing"</a>.<br />Also, white label licensing allow using the sources into your own projects without additional fees, which help to save <b><u>the time and budget</u></b> on development<br /><br />At the list below you can find every part of our platform with prices:<br /><br /><ul><br /><li>Connectors with full source codes <ul><br /><li>FIX/FAST connector - $6490<br /><li>ITCH (LSE/NASDAQ) connector - $4990<br /><li>QuantFEED connector - $3990<br /><li>License for all connectors - $12400.</ul><br /><li>Connectors to trading via MetaTrader4, MetaTrader5 with full source codes<ul><br /><li>МТ4 - $1190<br /><li>МТ5 - $1190<br /><li>МТ4 и МТ5 - $1990</ul>,<br /><li>Cryptoconnectors with full source codes:<ul><br /><li>Any cryptoconnector on your selection - $2500<br /><li>All cryptoconnectors - $12400</ul><br /><li>StockSharp applications with full source codes<ul><br /><li>S#.Shell - $590<br /><li>S#.Matlab - $1490<br /><li>S#.Designer - $9900<br /><li>S#.Terminal - $9900<br /><li>S#.Hydra - $9900</ul><br /><li>S#.API compomemts with full source codes<ul><br /><li>S#.API - charting component - $3750<br /><li>S#.API - visual designer component (used in S#.Designer) - $2990<br /><li>S#.API - tabels, panels - $2500<br /><li>S#.API - any proprietary connector on your selection (for example InteractiveBrokers, LMAX) - $1190<br /><li>S#.API - all proprietary connectors - $4900<br /><li>S#.API - $12400<br /></ul><br /><li>All StockSharp source codes: connectors, applications, components - $74000<br /></ul><br /><br />If you are interested in buying any part os Stocksharp source codes email us on: <a href="mailto:info@stocksharp.com">info@stocksharp.com</a> <br /><br /><br />https://stocksharp.com/topic/11684/Trading for beginners. Stock market.2020-04-21T21:51:00Z2020-04-21T21:51:00ZMarathttps://stocksharp.com/users/101940/info@stocksharp.comToday's article will not be quite ordinary.<br />We often write articles relying on the fact that most users have experience in trading on the exchange. However, among our readers, there are more and more people who do not have knowledge about the exchange, brokers, the market and trading in General.<br /><b>We would like to change this and tell you a little bit about the structure of trading, so that everyone, even a beginner, has an idea of what they might face.</b><br />This will not be a manual for dummies, it will be an article that helps the user who first came to trade navigate.<br /><br /><a href='https://stocksharp.com/file/112696/stock-exchange-738671_640_jpg/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/112696/stock-exchange-738671_640_jpg/?size=500x500" alt="stock-exchange-738671_640.jpg" title="stock-exchange-738671_640.jpg" /></a><br /><br /><u>First, let's tell you what the exchange is and how it works.</u><br /><br /><b>The exchange is a fundamental link in market trading.</b><br /><b>It, like any commercial enterprise, is a legal entity and its activities are regulated by regulations and legal acts established by the state.</b><br />An exchange is a mechanism through which various market participants interact, which are consumers of various financial instruments, such as: <b>currencies, raw materials, and securities</b>.<br /><br /><u>As mentioned earlier, the exchange's work is strictly regulated, so we can firmly say that its work is strictly ordered, namely: </u><br /><em>- <b>Trading is not chaotic</b>, but orderly, strictly at a set time, with strictly set instruments,<br />- <b>Trades are held strictly in a designated place or on a strictly approved virtual trading platform (electronic exchange)</b>,<br />- <b>The requirements and terms of trade for each exchange are unified</b>, which makes it possible to comply with the procedure for transactions, requirements for the quality of goods or services provided, depending on the type of exchange, <br />- <b>The trading mechanism is carried out through counter offers of purchase and sale by interested market participants.</em></b><br />The purpose of the exchange is to organize and regulate the markets of the financial instruments that it represents. The exchange regulates the supply and demand process in order to equalize prices and protect the interests of all trading participants from various negative price changes.<br /><br />Today, there are a huge number of exchanges, each of which trades various financial instruments. You can see the choice of a variety of trading platforms when working with trading programs. For example, <a href="https://stocksharp.com/products/terminal/" title="https://stocksharp.com/products/terminal/">S#.Terminal</a> allows you to select the trading platform that the user needs, including a large number of electronic exchanges.<br /><br /><a href='https://stocksharp.com/file/112697/download-new-program-version-_gif/' class='lightview' style='max-width: 600px;' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/112697/download-new-program-version-_gif/" alt="download-new-program-version-.gif" title="download-new-program-version-.gif" /></a><br /><br />This abundance is both positive, as it leads to increased trading opportunities, and negative in terms of the complexity of the choice for the novice, although the latter is rather subjective, since later, the trader understands the trading technique, gets the opportunity for more flexible trading.<br /><br /><br />The emergence of the first exchange in the XV century, we owe the Belgian city of Bruges. It was on its Central square that the first auctions of securities – bills were held.<br />Not far from the place of trade, the house of the <b>Van der Beurse</b> family was located. Later, these trades were taught the name <em>Borsa</em>, which over the years was transformed into the word <b>"stock market" or "exchange". </b>.<br /><u>What are the rules for trading on the stock exchange</u>:<br /><em>- Transparency and openness of operations, <br />- Free pricing<br />- The state does not interfere in the course of the auction, but the auction is regulated by law.<br />- Along with manual trading, it is possible to use automated trading systems. For example, such as <a href="https://stocksharp.com/products/shell/" title="https://stocksharp.com/products/shell/">S#.Shell</a>, MT and others,<br />- The exchange receives income from Commission on transactions.</em><br /><br />Trading opens up great opportunities for the participant to earn money.<br />Today, both an experienced trader and a novice can become a market participant.<br />The abundance of trading exchanges allows you to choose what and where to trade. The largest exchanges include:<em> Chicago, Tokyo</em> and <em>Sydney commodity exchanges, the new York cotton exchange, the London metal exchange, the German futures (Frankfurt)</em> and <em>Singapore currency exchanges, the European-American NYSE-Euronext, the St. Petersburg </em>and <em>Moscow stock exchanges.</em><br /><br /><a href='https://stocksharp.com/file/112695/business-257911_640_jpg/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/112695/business-257911_640_jpg/?size=500x500" alt="business-257911_640.jpg" title="business-257911_640.jpg" /></a><br /><br />Becoming a trader is not always as easy as the advertising brochures promise, the player's path is thorny and inevitably involves losses and winnings. Of course, with experience and knowledge, a trader acquires a stable income, but at the same time does not stop learning and improving.<br />A trader studies the market, various trading terminals, and SOFTWARE.<br /><b>Becoming a trader is real, but it is not always as easy as it seems.</b><br />Therefore, we have <a href="https://stocksharp.com/edu/" title="https://stocksharp.com/edu/">developed a training course for creating trading systems</a>, which is designed for both knowledgeable traders and beginners. We have included a full range of training in algorithmic trading and the creation of trading systems, programs and examples of trading strategies.<br /><b>The goal of the course is to make trading more accessible and understandable, to teach anyone to trade, and success now depends only on the trader and his desire.</b><br />In the following articles, we will tell you how to choose a reliable broker and what a trader may face while trading. We will be happy if you share your experience and ask questions. Thankshttps://stocksharp.com/topic/11569/S#.Designer is a simple way to start a successful trade.2020-03-31T19:05:01Z2020-03-31T19:05:01ZMarathttps://stocksharp.com/users/101940/info@stocksharp.comMore recently, we have reviewed a program such as <a href="https://stocksharp.com/products/shell/" title="https://stocksharp.com/products/shell/">Shell</a> and the<a href="https://stocksharp.com/products/api/" title="https://stocksharp.com/products/api/"> API library</a>.<br />Of course, <b>mastering the skills of programming trading strategies opens up huge horizons for the user not only as a trader, but also as a Creator of trading robots for sale.</b><br />However, not every user is interested in programming, and not every user is willing to spend time studying libraries.<br />Not every trader wants to learn how to write custom trading robots and often wants to create trading strategies for themselves.<br />Agree, it would be cool to have a program that can use ready-made components to create trading strategies.<br /><b>S#</b> understands this and has created a trading robot constructor that allows you to<b> create trading robots using dice-<a href="https://stocksharp.com/products/designer/" title="https://stocksharp.com/products/designer/">Designer</a></b>.<br /><br /><a href='https://stocksharp.com/file/112115/trade-system_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/112115/trade-system_png/?size=500x500" alt="trade-system.png" title="trade-system.png" /></a><br /><br />Now many people will start thinking: <b>"What is it good for?"</b>.<br /><b>Actually -.</b><br /><em><b>First</b>, it is more intuitive, meaning that it is easier for the user to navigate the program interface.<br /><b>Secondly</b>, the program is completely free, which allows the user to start working with it without investing a penny!<br /><b>Third</b>, the program integrates with all our products, such as <a href="https://stocksharp.com/products/hydra/" title="https://stocksharp.com/products/hydra/">Hydra</a>, and moreover, it is able to download market data itself.</em><br /><br /><a href='https://stocksharp.com/file/112114/market-data-download_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/112114/market-data-download_png/?size=500x500" alt="market-data-download.png" title="market-data-download.png" /></a><br /><br /><b>In General, the ability to download market data yourself is a huge advantage.</b><br />The user can use not several programs, but one to test the created trading strategies.<br />The interface is intuitive, and makes it easy to adapt to the user's environment.<br /><br /><a href='https://stocksharp.com/file/112113/trading-strategy-market-data_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/112113/trading-strategy-market-data_png/?size=500x500" alt="trading-strategy-market-data.png" title="trading-strategy-market-data.png" /></a><br /><br /><u>What is a Designer?</u><br /><b>Designer is a completely unique program.</b> It differentiates strategy elements into the simplest elements, as in the constructor, and allows you to assemble a trading strategy from these elements.<br />The large functionality of dice allows you to create the simplest and most complex trading strategies. All you need from the user is to select the strategy functionality.<br />Cubes are divided into sections that include groups of cubes for the user's convenience. This allows to improve the understanding and interface of the program. However, the program prevents errors from occurring at the strategy design stage. in other words, if a cube contains data of one type, it will not transmit data to a cube with data of another type, which helps avoid errors.<br /><br /><a href='https://stocksharp.com/file/112112/trading-systems_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/112112/trading-systems_png/?size=500x500" alt="trading-systems.png" title="trading-systems.png" /></a><br /><br />This means that the user does not waste time identifying the causes of the error at the program development stage.<br />In General, the development stage is a separate Chapter. At this stage, the user is provided with all the tools for working out their strategy, from the functionality of dice, to the ability to integrate their elements and analyze the progress of strategy development step by step.<br />Back test is a convenient function implemented in the program. Step-by-step review of strategy execution using the stop button allows you to detect an error at any stage. Of course - this saves time, which in turn reduces the user's expenses.<br /><br /><a href='https://stocksharp.com/file/112116/trading-robot_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/112116/trading-robot_png/?size=500x500" alt="trading-robot.png" title="trading-robot.png" /></a><br /><br />More experienced users can create their own elements in<b> C#</b>. All you will need to do is create your own element, where the user saves their code. These elements and strategies in General work much faster than strategies written in the visual designer, which gives the user an incentive to develop at the same time, without changing the convenient development environment.<br />The advantage of strategies in <b>C#</b> is not limited when creating them.you can describe any algorithm and add standard operation cubes to it if you want. The strategy creation process takes place directly in <b>S#.Designer </b>or <b>C#</b> development environment (the most popular development environment is <b>Microsoft Visual Studio</b>), using the library for professional development of trading robots in <b>C#</b> and <b>S#.API</b>.<br /><br /><a href='https://stocksharp.com/file/112111/prigramming-code-trading-strategy_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/112111/prigramming-code-trading-strategy_png/?size=500x500" alt="prigramming-code-trading-strategy.png" title="prigramming-code-trading-strategy.png" /></a><br /><br />Speaking of <em>Designer</em>, we can say that it is a progressive product. The ability to include your own codes in software solutions allows you to expand the range of Designer applications. The possibility of testing reduces the potential risk. The ability to download and use it for free-makes the product available to anyone.<br />It just remains to start workinghttps://stocksharp.com/topic/11542/Market data, timeframe, tick.2020-03-24T21:14:24Z2020-03-24T21:14:24ZMarathttps://stocksharp.com/users/101940/info@stocksharp.comToday we are looking at a <b>very important element of exchange trading</b>, without which the trade itself would not make sense, since without information about the positions of trading instruments, trading would turn into chaos.<br /><b>So quotes of <b>exchange element</b>s are data that allows market players to know in real time any changes that occur with trading instruments. Changes in price, volume, and other information contained in the exchange quotation.</b><br />The exchange quotation plays a major role in the analysis and testing of trading strategies. Getting market data of stock quotes is the key to correct testing of the trading robot. Sometimes getting market data is burdened with conventions: paid content of resources, limited data period. However, the <a href="https://stocksharp.com/products/hydra/" title="https://stocksharp.com/products/hydra/">Hydra</a> program allows you to download market data from a huge number of sources for free, as well as the <a href="https://stocksharp.com/products/designer/" title="https://stocksharp.com/products/designer/">Designer</a> program, which is clearly shown in our tutorial video.<br /><br /><iframe width="640" height="390" src="//www.youtube.com/embed/st0zTuKX_Fg" frameborder="0" allowfullscreen></iframe><br /><br />In addition to the information that market data carries, the important value is the selected data timeframe.<br />What is a timeframe?<br /><b>Timeframe — the time interval used for plotting stock price charts.</b><br />Its main task is to allow you to visualize graphically the trend of changes in the parameter of the exchange quotation. For example, you can see how the price changed over equal periods of time.<br /><br /><a href='https://stocksharp.com/file/111858/timeframe-trading-system_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/111858/timeframe-trading-system_png/?size=500x500" alt="timeframe-trading-system.png" title="timeframe-trading-system.png" /></a><br /><br />Let's consider the main element of the timeframe – <b>candles</b>. Candles are formed within the time period set by the trader, so we can see how the price changed during the week or during the day.<br />A candlestick chart can give information about the maximum and minimum for the period set by the timeframe, and show changes in the volume of quotes. they can tell us about the maximum and minimum prices for the corresponding period, and we can use them to see the opening and closing prices.<br /><br /><a href='https://stocksharp.com/file/111857/candels-trading-market-data_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/111857/candels-trading-market-data_png/?size=500x500" alt="candels-trading-market-data.png" title="candels-trading-market-data.png" /></a><br /><br />At the same time, to get a more detailed movement of parameters within the timeframe interval itself, you need to use tick data, from which the chart is also built. The tick chart is the most accurate, since it gives a detailed change in data, not the final one for the period.<br /><br /><u>Let's look at how timeframes are designated:</u><br /><em>M-means a minute (for example, M4 is a five-minute time frame).<br />H-indicates the hour (for example, H1 is an hour timeframe).<br />D-means day, sometimes the value "Daily" is used (for example, D10 is a ten-day timeframe<br />W-means week, and the term Weekly is also used (for example, W2 is a two-week timeframe)<br />MN-means monthly, it can also mean Monthly (for example, MN3 – a three-month timeframe).<br />Y-indicates a year (for example, Y5 is a five-year timeframe).</em><br />Older timeframes consist of younger ones, so for example, you can create a ten-minute timeframe from two five-minute ones.<br /><br /><u>Different timeframes can be used for different purposes:</u><br /><br /><em><b>Minute and hour time frames</b>:<br />Often used for trading method of scalping, derating, scalping.<br />Short timelines are used for faster trading, often limited to one trading day.<br /><br /><b>From hourly to daily timeframes</b><br />They are often used for medium-term trading. The most moderate trading speed, it is often chosen by novice traders.<br /><br /><b>From daily to annual timeframes.</b><br />For the most part, these timeframes are used by investors who place their capital for a longer period, with the prospect of generating income in the long term.</em><br /><br />So, we have considered the main types of time frames. Of course, successful trading consists of using different timeframes. The combination of them gives the most optimal solution for increasing the trader's income. This is why all our products from Designer to <a href="https://stocksharp.com/products/shell/" title="https://stocksharp.com/products/shell/">Shell </a>can work with different timeframes, and Hydra allows you to choose several timelines for downloading at once.https://stocksharp.com/topic/11471/Pyramiding in trading2020-03-10T22:39:46Z2020-03-10T22:39:46ZMarathttps://stocksharp.com/users/101940/info@stocksharp.comEarlier in the articles, we considered such mechanisms used in trading as <b>Stop-Loss</b> and <b>Take Profit</b>.<b> Of course, these two tools help reduce the risk and increase the profitability of the strategy</b>. But what if, because of them, we limit ourselves to getting more profit?<br />To understand how this can be done, you need to consider <b>Pyramiding</b>.<br />What is <b>pyramiding - оne of the types of strategy aimed at increasing capital by step-by-step opening of several transactions with a favorable trend</b>. Using this strategy allows the trader to get a stable income.<br />Let's consider the principle of pyramiding.<br />The essence of pyramiding is that after the profitable result of the last transaction, the trader opens a new position, while doubling the bid, compared to the previous one. As for the risk arising from the next bid, it is equal to the sum of the profit of the previous stage and the initial bid. At the same time, the amount of profit depends on the so-called "steps" of pyramiding, and it grows exponentially.<br /><br /><a href='https://stocksharp.com/file/111744/buy-order-pirammiding_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/111744/buy-order-pirammiding_png/?size=500x500" alt="Buy-order-pirammiding.png" title="Buy-order-pirammiding.png" /></a><br /><br /><b>Pyramiding is applicable in any market – stock, currency, and others.</b> The trader adds a new position to the previous effective one, if the trend direction is profitable for him.<br />If the trader's actions are calculated correctly, he will always be in profit. The use of various trading robots also contributes to a more convenient use of pyramiding. For example, <a href="https://stocksharp.com/robot/12/mister-haid/" title="https://stocksharp.com/robot/12/mister-haid/">"Mr. Hyde" </a>from StockSharp, which in automatic mode and flexible configuration can trade in pyramiding mode.<br />An important point is that the trader must be sure that the trend is stable, otherwise it can lead to losses. However, the use of automated programs, such as <a href="https://stocksharp.com/products/designer/" title="https://stocksharp.com/products/designer/">Designer</a>, which use <a href="https://doc.stocksharp.com/html/6974891d-4c8d-46e1-bdeb-fc7391bc0625.htm" title="https://doc.stocksharp.com/html/6974891d-4c8d-46e1-bdeb-fc7391bc0625.htm">condition cubes and position protection</a>, makes trading with pyramiding minimally risky. An example of this strategy is shown below.<br /><br /><a href='https://stocksharp.com/file/111745/stop-loss-strategy_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/111745/stop-loss-strategy_png/?size=500x500" alt="stop-loss-strategy.png" title="stop-loss-strategy.png" /></a><br /><br /><u>Let's consider the basic rules of pyramiding.</u><br /><em>-<b> Constantly monitor the ratio of return and risk within 1 to 2</b>, so that the previous yield can cover the current risk.<br />- <b>All parameters used during trading must be calculated in advance before entering the market.</b><br />- <b>Use pyramiding only on a stable trend</b>.</em><br /><br /><u>Let's look at an example of using pyramiding.</u><br />Let the trader have a capital of $10,000. At each main level, it can buy 10,000 units of the selected currency. In the Forex market, this is 1 mini lot. The amount of profit at each stage will differ, however, the size of the set Stop-Loss for each opened transaction will be equal to 50 points.<br />So, the trader buys 10,000 units of the base currency. Let's assume that the market situation is shown in the figure.<br /><br /><a href='https://stocksharp.com/file/111743/stop-loss-order-transfer_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/111743/stop-loss-order-transfer_png/?size=500x500" alt="stop-loss-order-transfer.png" title="stop-loss-order-transfer.png" /></a><br /><br />The price rises and breaks through the resistance level, now this level becomes the support level.<br />Let a bullish pin bar be formed at the support level (a graphical analysis figure based on the non-indicator method of trading, as well as the analysis of Price Action charts), in consequence of which the trader decides to buy 10,000 units of currency. When a trade is opened, the trader sets the Stop-Loss at 50 points or 1% of the risk of capital.<br /><br />This way the trend keeps its direction, and the trader trades further. The trend breaks the next level, and the price is set above the support level, and the trader buys another 10,000 units, and the previous Stop-Loss is transferred to the new level.<br />The same situation is when the price breaks the third level<br /><br />Thus, the trader accumulates a long position of 30,000 units of the main currency by the third stage. There is almost no risk, since at the third stage, when a deal is concluded for 10,000 units, the profit will be <b>4%</b> if the trend reverses.<br /><br />The potential profit, with a successful outcome, can be <b>12%</b>.<br /><u>Let's look at this example in numbers.</u><br /><br /><a href='https://stocksharp.com/file/111746/stop-loss-order-trade_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/111746/stop-loss-order-trade_png/?size=500x500" alt="stop-loss-order-trade.png" title="stop-loss-order-trade.png" /></a><br /><br />It is important to see how the possible profit increases from each stage to the next, while reducing the risk<br />The trader's first trade will bring him a profit of 6% of the initial capital.<br /><u>Consider all the situations in the market:</u><br />-<b> First transaction</b>: 10,000 units<br /><em>Negative: there was a -1% loss<br />Positive result: +6% in profit</em><br /><br />- <b>Second transaction</b>: 10,000 units<br /><em>Negative result: no loss (+2%in profit from the first stage and -1% in loss from the second)<br />Positive result: +10% in profit (+6% in profit from the first stage and +4% in profit from the second)</em><br /><br />- <b>Third transaction</b>: 10,000 units<br /><em>Negative result: +4% in profit (+3%in profit from the first stage, +2% in profit from the second stage and -1% in loss from the third)<br />Positive result: +12% in profit (+6% in profit from the first stage, +4% in profit from the second stage and +2% in profit from the third)</em><br /><br /><b>As you can see, the risk is about 1%, while with positive trading of all three stages, the profit will be 12%</b><br /><br /><u>Main advantages and disadvantages of building:</u><br /><b>Plus:</b><br />- <em>Pyramiding strategy allows you to increase your income with minimal risk;</em><br /><b>Minus:</b><br />- <em>The strategy is quite complex and requires experience. It is possible to use the strategy for medium or long periods of time, preferably using automated trading systems. The correct calculation of the exit point from pyramiding, analysis and testing of the trend behavior is of great importance, which necessarily leads to the use of trading robots. Pyramiding is not suitable for scalping strategies, and is also aimed at long-term trading.</em><br /><br /><b>Pyramiding is a profitable and relatively safe method of trading. Its reliability has a downside in the duration of the process, the accumulation of sufficient experience and knowledge in trading that would correctly calculate the levels of trade. Also, this type of trading is not suitable for all traders, so choosing it as the main one should be conscious.</b>https://stocksharp.com/topic/11449/What is Stop-Loss and Take Profit?2020-03-03T11:53:25Z2020-03-03T11:53:25ZMarathttps://stocksharp.com/users/101940/info@stocksharp.com<b>Stop-Loss-a type of order whose task is to set limits on possible trading losses.</b><br />This order is <b>used automatically using automated trading systems</b>, which we will discuss later. The essence is very simple: with the help of the <b>Stop-Loss mechanism, when the set price level of the purchased asset (instrument) is reached, the position is closed</b>. In fact, <b>Stop-Loss insures the trader from an unplanned price drop</b>.<br />This restriction mechanism is widely used for traders. It is used by experienced participants in the financial market, but novice traders often neglect this mechanism, although for them Stop-loss is almost the main method of saving their funds in a positive balance.<br /><br /><a href='https://stocksharp.com/file/111684/stop-loss-order-trade_jpg/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/111684/stop-loss-order-trade_jpg/?size=500x500" alt="stop-loss-order-trade.jpg" title="stop-loss-order-trade.jpg" /></a><br /><br /><b>Stop-Loss</b>, from a technical point of view, <b>is a regular pending order that has an activation mechanism when the set price level of the asset is reached.</b> The difference between the two types of pending orders is that when using a regular pending order, a new deal is opened, and when using a Stop loss, an existing one is closed.<br /><br />As mentioned earlier, an important advantage of Stop-Loss Is the automation of the process, which eliminates the need to track price changes and make a decision manually. Of course, this reduces trading losses and time, which is fundamental for high-frequency algorithmic trading (HFT).<br />For example, in the program for creating trading robots <a href="https://stocksharp.com/products/designer/" title="https://stocksharp.com/products/designer/">Designer</a>, it is possible to use the Stop-Loss mechanism by using the <a href="https://doc.stocksharp.com/html/49d3744f-77c5-40ee-a4c2-4d7b08125712.htm" title="https://doc.stocksharp.com/html/49d3744f-77c5-40ee-a4c2-4d7b08125712.htm">position protection cube</a>, which can be configured and used as a reliable tool for reducing losses.<br /><br /><a href='https://stocksharp.com/file/111685/stop-loss-protection-trading_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/111685/stop-loss-protection-trading_png/?size=500x500" alt="stop-loss-protection-trading.png" title="stop-loss-protection-trading.png" /></a><br /><br /><b>The use of the Stop-Loss pending order mechanism is widely used to reduce trading costs caused by losses</b>. As a result, this leads to an increase in profits, not only by increasing the volume of successful operations, but also by reducing the volume of unprofitable ones. The <b>use of this tool in trading strategies is now increasingly used, as it reduces losses, increasing the amount of profit at a constant (regulated) amount of transaction costs</b>. Example of a trading strategy executed in the <a href="https://stocksharp.com/products/designer/" title="https://stocksharp.com/products/designer/">Designer</a> program.<br /><br /><a href='https://stocksharp.com/file/111686/stop-loss-trade-strategy-robot_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/111686/stop-loss-trade-strategy-robot_png/?size=500x500" alt="Stop-Loss-trade-strategy-robot.png" title="Stop-Loss-trade-strategy-robot.png" /></a><br /><br /><u>So, the main advantages that are inherent in a pending Stop-Loss order:</u><br /><em>- Using a pending<b> Stop-Loss order in trading strategies allows you to limit losses</b> on a single trade by setting the loss level that is set by the trader himself, which makes the trading strategy more flexible and less risky.<br />- The use of <b>this pending order insures the trader from an unpredictable situation in the market</b>, in which the asset value may collapse, thereby protecting the user of the trading strategy from losing capital.<br />- Regulation of possible losses also has a <b>positive effect on the trader's emotional state</b>, preserving his nerves and psychological health.</em><br /><br />There are a lot of reasons in the market that can cause a loss, and the frequency of their occurrence is unpredictable. However, the use of Stop-Loss allows you to protect yourself, make trading more convenient, limit risk, maximize profit, reduce the time to work with a trading strategy, and reduce the risk to emotional health.<br />An important point for working with a pending Stop-Loss order is to calculate the correct order level.<br /><br /><u>When placing an order, you need to know the following:</u><br /><em>- First of all, a <b>Stop-Loss order is a conditional order</b> that is executed when the set price level is reached.<br />- <b>The application consists of two parts</b>: the application and the condition for its execution (conditions that are edited by the trader, and when a new condition is set, the old conditions are canceled).<br />- The <b>request is located on the broker's server,</b> through which the trade is carried out, and is sent only when the necessary condition is reached.</em><br /><br /><u>Let's look at the most well-known methods of working with Stop Loss:</u><br /><em><b>- Fixed Stop-Loss:</b><br />The trader sets the value in the tool settings equal to the number of points from the initial price of the asset to open the order.<br /><b>- Flexible Stop-Loss:</b><br />A more flexible method that takes the result of market analysis (minimum and maximum prices for an asset for a period, price change charts, and other analysis tools) as the basis for setting the opening price value. This is a more complex, but more reliable method than the previous one.<br /><b>- Break-even trading:</b><br />A rather complex method aimed at dynamically changing the set Stop-Loss level by moving the set value from the drawdown area to the guaranteed profit area at a time when the price has already changed significantly in the set direction.<br /><b>- Trailing stop:</b><br />A more advanced method of the previous method, which involves automatic means of transferring the Stop-Loss level.<br /><b>- Trend:</b><br />We will devote a separate article to this method and analyze it later.<br /></em><br /><b>Let's add a few more words and talk about Take Profit.</b><br />Just like Stop-Loss, <b>Take Profit is a pending order</b> aimed at fixing profits. When the asset price reaches the price set by the trader, the order is executed, and the trader makes a profit by closing the position.<br />The level of execution of Take Profit is set by the trader himself, and as in the case of Stop-Loss, it is often used with the use of automated trading systems, trading robots and trading systems.<br />This type of order - limit, is executed only when the asset price reaches a predetermined level.<br /><u>There are two types of "entry into a position" - the beginning of trading operations:</u><br /><em>- <b>Long position</b> (long, long, buy) - purchase request;<br />- <b>Short position</b> (short, short, sell) - request for sale.</em><br /><br /><b>If we start trading with a purchase</b>, we set the take Profit order execution level above the asset purchase price.<br /><b>If we start trading with a sale</b>, we set the take Profit order execution level below the asset's sale price.<br /><br /><a href='https://stocksharp.com/file/111687/take-profit-sell-buy-order_jpg/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/111687/take-profit-sell-buy-order_jpg/?size=500x500" alt="take-profit-sell-buy-order.jpg" title="take-profit-sell-buy-order.jpg" /></a><br /><br /><b>In conclusion, it is worth mentioning the ratio of the orders considered.</b><br />Using both orders reduces the risk of loss and increases profit. The use of both of these orders in each of the trading situations is purely individual, it is impossible to say unequivocally what is most applicable, what is least. The level of use of pending orders is determined by the trader, in relation to each situation and trading strategy separately. <b>However, the combination of techniques with the use of pending orders and trading robots makes it possible to facilitate the work of the trader, makes it possible to concentrate on analysis, reducing the time to track the situation on the stock market.</b>https://stocksharp.com/topic/11436/Forward contract. The essence and its types.2020-02-25T14:36:23Z2020-02-25T14:38:18ZMarathttps://stocksharp.com/users/101940/info@stocksharp.comPreviously, we considered such instruments as<b> futures </b>and <b>options</b>, <b>which are exchange-traded instruments</b>. However, there are also <b>non-exchange instruments</b>.<br /><br /><b>Forward or forward contract</b> <b>– a contract (agreement) under which the seller must transfer the underlying asset specified in the contract to the buyer within the period specified in the contract or perform an equivalent monetary compensation.</b><br /><br />The buyer undertakes to accept and pay for the asset, on the basis of which the seller and the buyer determine the financial obligations determined by the size of the indicators of the underlying asset, at the time of their execution, in accordance with the procedure specified in the forward contract.<br />In essence, a forward contract is a bilateral agreement on the acquisition of a basic asset, drawn up in accordance with the established form. The forward establishes obligations of one party to the other party to sell or buy an asset at a certain time and on accepted terms, the price of which is fixed and set by the terms of the contract.<br /><br /><a href='https://stocksharp.com/file/111650/forward-financial_jpg/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/111650/forward-financial_jpg/?size=500x500" alt="forward-financial.jpg" title="forward-financial.jpg" /></a><br /><br />We can say that a <b>forward is a binding contract</b> that has its own term of execution set by the parties (buyer - seller), an established asset and its volume, as well as a fixed price for this asset at the time of execution.<br /><br /><u>Let's look at what conditions should be set in the forward contract:</u><br /><em>- <b>The subject of the forward contract or the asset being sold in the forward contract</b>. Such an asset can be: a commodity, various financial instruments;<br />- <b>The volume of the asset,</b> the volume to be delivered, and the volume is specified in the corresponding units of the asset;<br />- <b>The date on which the asset should be placed</b>. The date is fixed and cannot be changed;<br />- <b>Execution price</b> of the forward contract. Amount to be paid;<br />- <b>Forward price</b>. Differs from the fixed price specified in the forward in that it is variable and is determined at the current time as the current price of forward contracts for the corresponding asset.</em><br /><br /><u>Let's consider what features a forward has:</u><br /><em>- <b>Forward contracts are concluded outside the exchange</b>, for example, in contrast to the option or futures;</em><br /><br /><a href='https://stocksharp.com/file/111651/forward-futures-contract_jpg/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/111651/forward-futures-contract_jpg/?size=500x500" alt="forward-futures-contract.jpg" title="forward-futures-contract.jpg" /></a><br /><br /><em>- <b>The forward period can be set by anyone determined only by the parties to the contract</b>;<br />- <b>Forward contracts do not have strictly defined forms</b>;<br />- <b>There is no need to submit reports on forward contracts;</b><br />- <b>The forward contract cannot be terminated or changed</b>;<br />- <b>Can be compiled in a convenient form for customers</b>;<br />-<b> A forward contract is not retroactive</b>;<br />- <b>There is no Commission for drawing up a forward contract.</b><br /></em><br /><u>Pros and cons of forwards.</u><br />Speaking about the positive aspects of forward contracts, it is worth highlighting the following points:<br /><em>- <b>Fixed price</b> on the execution date;<br />- <b>No commissions</b> for concluding contracts.</em><br />The negative point is that when the <b>forward price changes relative to the settlement day price for it</b>, the contract participants do not have the opportunity to terminate the contract.<br /><b>In fact, the participants there is no possibility of maneuver, not the flexibility of the terms of the contract, does not allow to change the terms of the forward contract.</b><br /><b>Low liquidity caused by the lack of a secondary market for forwards and as a result the ability to resell the contract.</b><br /><br /><u>What is the difference between forward contracts:</u><br /><em>- <b>The forward is mandatory</b>;<br />-<b> The contract is drawn up taking into account the requirements of the transaction participant;</b><br />- Before the final conclusion of the contract, the following parameters are <b>determined: forward volume, quality characteristics of the asset, delivery time and place of delivery</b>.</em><br /><br /><a href='https://stocksharp.com/file/111652/forwardcontract-example_jpg/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/111652/forwardcontract-example_jpg/?size=500x500" alt="Forward+Contract-Example.jpg" title="Forward+Contract-Example.jpg" /></a><br /><br /><u>Let's look at the main types of forwards:</u><br /><em>- <b>Delivery forward</b>. It ends with the delivery of the underlying asset and payment in accordance with the terms of the contract;<br />- <b>Non-delivery or settlement forward</b>. The forward does not end with the delivery of the underlying asset;<br />- <b>Foreign currency forward contracts</b>. In this type of forward, the parties exchange currency with a fixed rate under the contract.<br /></em><br /><u>Forwards are divided by the underlying asset:</u><br /><em>- <b>Commodity forward</b>, which implies tangible assets for purchase and sale (oil, gas, metal, agricultural products);<br />-<b> Financial forward</b>, which means financial instruments (currency, interest rates, shares, and other securities) as an asset.<br /></em><br /><u>There are forward contracts on the sides of a forward transaction:</u><br /><em>- Forward contracts between<b> banking organizations or the Bank and the client;</b><br />- Forward contracts concluded by the <b>manufacturer and seller of any product</b>.</em><br /><br /><u>Hedging mechanism for forward contracts.</u><br />We told you earlier that <a href="https://stocksharp.com/articles/11401/Hedge-The-essence-and-its-types/" title="https://stocksharp.com/articles/11401/Hedge-The-essence-and-its-types/">hedging</a> is an operation to reduce the possible risk that occurs when entering into contracts caused by fluctuations in market prices. We also talked about tools that help you perform hedging operations, talking about the trading robot <a href="https://stocksharp.com/robot/11/pesochnye-chasy/" title="https://stocksharp.com/robot/11/pesochnye-chasy/">"Hourglass"</a> and using the set of functions of the <a href="https://stocksharp.com/products/designer/" title="https://stocksharp.com/products/designer/">Designer</a> program.<br /><br /><a href='https://stocksharp.com/file/111653/hedge-trading-spot_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/111653/hedge-trading-spot_png/?size=500x500" alt="hedge-trading-spot.png" title="hedge-trading-spot.png" /></a><br /><br /><u>Most often, forwards hedge these types of risks:</u><br /><em>- <b>Currency exchange</b> rate caused by fluctuations in the exchange rate of various currencies;<br />- <b>Interest rate</b> due to changes in securities quotations;</em><br /><em>- <b>Product</b>, due to the movement of the prices associated with inflation, political and different factors that affect the economy.<br /></em><br />The use of a forward in operations is primarily an insurance against the changing market situation. Well-chosen forward conditions can give its participants the opportunity to protect themselves from adverse situations in the market. However, not very flexible forward conditions make it a little liquid, although it remains a fairly popular tool.https://stocksharp.com/topic/11401/Hedge. The essence and its types.2020-02-11T11:59:47Z2020-02-11T12:01:29ZMarathttps://stocksharp.com/users/101940/info@stocksharp.comUnfortunately, <b>insurance companies do not provide traders with insurance</b> in case of adverse price changes in the market. However, the so-called i<b>nsurance mechanism exists</b>, and is implemented through the futures exchange.<br /><b>This insurance mechanism is called Hedging.</b> <br /><b>Hedging</b> is an option for<b> insuring assets against adverse price changes in the market</b>, in which a trader buys an opportunity to buy and sell an asset (futures) in a subsequent period of time with fixed terms of the transaction. The name originates from the English hedge, which means insurance or protection. <br /><a href='https://stocksharp.com/file/110560/hedge_jpg/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/110560/hedge_jpg/?size=500x500" alt="hedge.jpg" title="hedge.jpg" /></a><br /><b>Hedging</b> uses the futures market, which reduces the risks of an adverse trend change in this market, in fact, a futures transaction is a replacement for an upcoming transaction in the cash market, while the futures position has the opposite direction of the position in the cash market, thus reducing the risk. <br /><b>For example:</b><br />The wheat producer is confident that its future crop will bring it profit in three months. <br />Provided that all farms get a good harvest, the price of wheat will decrease in the market. To reduce <b>the risk – hedging the risk</b>, the wheat producer <b>buys a forward contract</b> (not a standardized contract for the delivery of the underlying asset in the subsequent period, with the fixed price of the underlying asset), under which it will be able to sell <b>10 000 tons</b> of grain at a price of <b>$200</b> per ton. <br /><u>Now let's look at the possible scenarios:</u><br />- <b>Let the harvest turned out good</b>, respectively, the price on the market sank to <b>$150</b> per ton. In this case, the manufacturer executes its forward and earns:<br /><b>$200 x 10 000t = $2000000-that is, it remains a winner</b>;<br />- <b>Let the crop was born bad</b>, while the price rose to <b>$250</b> per ton. The manufacturer performs its forward, while it receives <b>$2000000</b>, and its losses are <b>$500 000</b>. In this scenario, the buyer wins, but the manufacturer has insured itself. To avoid losing more. <br /><a href='https://stocksharp.com/file/110561/hedg-trading-strategy_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/110561/hedg-trading-strategy_png/?size=500x500" alt="Hedg-trading-strategy.png" title="Hedg-trading-strategy.png" /></a><br />When<b> hedging</b>, a fixed-term <b>hedging contract is opened</b>. at the same time, this contract itself is a financial asset, so it can be bought and sold, that is, to carry out normal transactions on the market.<br />The asset that is insured can be any asset from your portfolio and any asset that is only expected to be purchased. The market where the possibility of operations with an asset is implemented is a spot market (transactions in such a market are made immediately, usually within two days at most).<br />We can say that hedging contracts form a fixed-term or future market. <br /><b>Let's look at another example that examines the possibility of compensating losses from the sale of an asset by selling futures and Vice versa:</b><br />Let the organization acquire a tanker with oil, having a desire for subsequent resale. In the current period of time, it is not able to sell oil at current market prices, however, the organization sells a futures contract for oil. In the subsequent period, the organization sells oil and buys futures. <br /><b>- Let's assume that the price of oil fell at the time of sale</b>, respectively, when it is sold, the organization will suffer a loss, but the liquidation of the futures contract will give a profit that will cover the loss from the sale of the real product. <br /><b>- Let's assume the situation has changed, and the price of oil has started to rise</b>, respectively, the organization will make a profit on the sale, but the purchase of futures will bring a loss, but it should be covered by the profit received. <br />Thus, the loss is compensated in one market at the expense of profit in another, we can say this is comparable to an arbitration operation. <br />Such operations are possible because of the close relationship between the price on the real market and the futures market. Of course, we can not say that the prices in both markets are the same, since there are differences. For this reason, it is impossible to talk about an ideal hedge, in which losses are reduced to zero, but at the same time, the importance and possibilities of hedging are fully justified when trading. <br /><b>Successful hedging depends on the degree of correlation of prices in the cash and futures markets</b>, the higher the correlation, the more successful the hedging. Of course, there is a risk that changes in prices on the cash market will not be compensated by changes in prices on the futures market, which will result in a loss or profit. But this is how <b>hedging protects the underlying risk from the greater risk caused by the insecurity of an open position in the cash market.</b><br /><br />A market participant who insures their risk is called a <em>hedger</em>, and the counterparty in the hedging contract may be:<br /><em>- hedger's partner;<br />- other hedger (buyer or seller of the underlying asset, which also insures the risk, but in the opposite direction);<br />- financial speculator.</em><br />The hedging strategy for participants is based on a unidirectional parallel change:<br /><em>- current price of the underlying asset-spot prices;<br />- a prospective "futures" price.</em><br />Operation of the hedge opens two trades at the same time:<br /><em>- transactions with the underlying asset on the spot market;<br />- transactions on the futures market of the same asset.</em><br /><br />Hedging can be of various types, let's look at what types are:<br /><br /><u>By the type of instruments used in hedging:</u><br />- <b>Exchange-traded instruments</b> (futures, options), while contracts are opened exclusively on exchanges, and transactions have a third party-a Settlement Fee that tracks the performance of obligations. All contracts are independent derivative financial assets and items of purchase/sale operations.<br />It is worth highlighting the following positive aspects of such hedging:<br /><em>- security,<br />- access to auctions,<br />- market liquidity.</em><br />The disadvantages are standardized assets, strict requirements, and various restrictions on transactions.<br /><b>- Over-the-counter instruments </b>(forwards, options), while contracts are concluded outside the exchange, are one-time, do not have circulation on the market, and are not independently traded assets. <br />Positive aspect:<br /><em>- Large flexibility in the choice of an asset and the terms of the contract. </em><br />The disadvantages of such hedging are low liquidity with an increased risk of default, and increased transaction costs. <br /><br /><u>The next type is hedging by type of counterparty. It is divided into the following types:</u><br />- <b>The buyer's hedge</b>, in this case, the buyer's risks are insured, which are associated with a prospective increase in prices and deterioration of the transaction conditions. With such hedging, the most common operations are the purchase of forwards, futures, call options, as well as the sale of put options.<br />- <b>The seller's hedge</b>, in this form, the seller's risks are insured, which arise when the asset's value potentially falls and the contract terms deteriorate. This hedging involves selling forwards, futures, and call options, as well as buying put options.<br /><br /><u>Hedge by the amount of risk that must be insured, is divided into the following types: </u><br /><em>- Full hedging, in which the entire volume of the transaction is insured.<br />- Partial hedging, in which only part of the transaction volume is insured. </em><br /><br /><u>By the time the underlying transaction is concluded, the hedging is divided into:</u><br /><em>- Classic hedging, used with the application of a fixed-term transaction, which is concluded after the transaction with the insured asset. <br />- Anticipatory hedging, in which a fixed-term transaction is concluded in advance before the acquisition or sale of the insured asset. </em><br /><br /><u>Hedging by asset type is divided into:</u><br />-<em> Net hedging, in which the insurance contract is concluded for the same type of asset.<br />- Cross-hedging, in which the hedging contract is entered into for a different type of asset than the underlying one. </em><br /><br /><u>Hedging under the terms of the contract is divided into:</u><br /><em>- One-sided hedging, in which the possible loss from price changes in the market is fully borne by one of the participants in the transaction – the buyer or seller. <br />- Two-way hedging, in which losses are distributed among all participants. </em><br /><br />It is worth noting that all the types of <b>hedging analyzed allow you to choose the most optimal strategy</b> for the implementation of the trading mechanism.<br />Of course, it is worth saying that this type of operation is quite difficult for a beginner, and sometimes for an experienced user, it causes a large number of problems.<br />Today, the use of this type of operations is facilitated by implementing <b>hedging mechanisms in various trading systems and robots</b>. <br />For example, <em>StockSharp </em>has implemented an <a href="https://stocksharp.com/robot/11/pesochnye-chasy/" title="https://stocksharp.com/robot/11/pesochnye-chasy/">"Hourglass"</a> trading robot that allows h<b>edging using various methods and trading operations</b>. <br />For <a href="https://stocksharp.com/products/designer/" title="https://stocksharp.com/products/designer/">Designer</a> users, the <a href="https://doc.stocksharp.com/html/b49f617f-7425-4c1d-bb45-c347f55d1d1e.htm" title="https://doc.stocksharp.com/html/b49f617f-7425-4c1d-bb45-c347f55d1d1e.htm">"Hedging" cube</a> is implemented, which settings allow you to protect against risks in ongoing trading operations. <br /><a href='https://stocksharp.com/file/110563/hedge-options-futures_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/110563/hedge-options-futures_png/?size=500x500" alt="hedge-options-futures.png" title="hedge-options-futures.png" /></a><br />In this way, building strategies is easier, and is reduced to configuring the cube and input parameters. <br /><a href='https://stocksharp.com/file/110562/hedge-trading-spot_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/110562/hedge-trading-spot_png/?size=500x500" alt="hedge-trading-spot.png" title="hedge-trading-spot.png" /></a><br />Remember that the types of hedging considered can be fully implemented using our SOFTWARE, including the implementation of these methods is considered in the <a href="https://stocksharp.com/edu/" title="https://stocksharp.com/edu/">course of programming training</a>.<br />The most important thing is to remember and not forget about the opportunities to save your profit, and hedging methods will come in handyhttps://stocksharp.com/topic/11383/Arbitrage trading. Principles, types.2020-02-04T18:52:36Z2020-02-04T18:53:24ZMarathttps://stocksharp.com/users/101940/info@stocksharp.com<div align="center"><b>What is Arbitration, general concepts.</b></div><br /><br />Recently, the concept of <b>Arbitration</b> has been found quite often in trade. What is <b>Arbitration</b>?<br /><b>Arbitration </b>is a <b>method of profit that minimizes the risk</b> of loss by using the price difference for the same asset in different markets.<br /><b>Today, this mode of trade is a commonly used trade tactic.</b><br />Let us consider what this mode of trade consists of.<br />The point is to sell the same <b>asset at a higher price</b> in one market and <b>purchase the same asset at a lower price</b> in another market.<br />Such trade is one of the most important components of the market, and most traders seek to conduct such trade, effectively reducing the <b>possibility of loss to a minimum</b>.<br />Although the nature of <em>arbitration consists</em> of price differences of one asset in different markets, this strategy can be applied to two assets with similar prices and portfolio volume.<br />Consider what the arbitration portfolio is and its properties:<br />- <em>Arbitration portfolio</em> - portfolio of assets, <b>which does not require additional resources of the investor.</b><br />- <em>The arbitration portfolio</em> is <b>not influenced by any factor, that is, has zero risk</b>.<br />In fact, for an investor, an arbitration portfolio is a tool that allows it to receive a large return, while remaining unaffected by various risks.<br /><b>A simple example of arbitration trade:</b><br />Suppose the value of asset A on one of the exchanges is $100, while the value of the same asset on the other exchange is $105.<br />A trader acquires an asset on one exchange, where its value is lower, and sells it on an exchange, where the value of it is higher. Thanks to this strategy, the trader gains profit, in the form of price differences of asset A on various exchanges.<br />This example is quite simplified, and is given only for the sake of clarity, in real trade the implementation of such transactions has its own difficulties.<br /><br /><b><div align="center">Choice of pair in arbitration.</div></b><br /><br />Let us once again define <b>Arbitration Trade</b> based on practical knowledge of it.<br /><b>Arbitration trading</b> is a method in which trading is carried out by means of differently directed transactions with an asset or assets <b>having similar prices and portfolios</b>, <b>based on the difference in their value</b>. In fact, the <b>trader buys a cheaper asset and sells a more expensive asset similar to the first asset.</b><br />Often, the arbitration pair selects a base and derivative asset (for example, <b>shares and stock futures</b>). Both assets should have similar price dynamics - <em>correlation</em>.<br />However, <b>correlation</b> has the property of being broken for various reasons.<br />Such reasons can be related to various serious market changes and to the consequence of market inefficiency. Emerging <em>correlation</em> violations contribute to profit in arbitration transactions. In fact, the trader profits when the correlation of the underlying and derived asset is restored, after its violation.<br />Simply put, an <b>arbitration transaction</b> occurs when buying a cheap asset and selling an expensive asset when there is a difference between their prices in view of various factors. However, for the rest of the time, the prices of both assets tend to be equivalent.<br /><a href='https://stocksharp.com/file/110499/stocks-exchange-arbitrage_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/110499/stocks-exchange-arbitrage_png/?size=500x500" alt="Stocks-exchange-arbitrage.png" title="Stocks-exchange-arbitrage.png" /></a><br /><br /><b><div align="center">Types of arbitration trade.</div></b><br /><br />Let 's look at what types of arbitration are distinguished in trading:<br />- <em>Time arbitration;</em><br />- <em>Spatial arbitration.</em><br /><em>Temporary arbitration</em> implies that transactions occur with a time difference. This type of arbitration is <b>characterized by a mechanism: buy cheap, and sell expensive</b>, or vice versa, sell expensive, and buy cheap. To put it simply, such a mechanism is actually - a common speculative transaction m<b>ade on the stock exchange market</b>.<br /><b>Temporary arbitration contains a risk</b>, as <b>during the period of time the trend may not change the direction</b> of movement, that is, if the trader initially bought the asset for cheap, it is not a fact that after time the asset will not cease to be cheap, thus bringing a loss on sale.<br />The next type of <b>arbitration is spatial</b>. With this type of arbitration, a couple of <b>transactions are bought and sold at the same time but at different sites.</b> In such transactions <b>risk is minimal</b>, and sometimes at all reduced to zero, as a couple of transactions take place simultaneously, at the same time the trader should take into account not only the difference in the price of the asset, but also possible commissions, which should be included in the expenses and covered by the amount of profit.<br />In addition to the types of transaction time, arbitration is divided into trading methods. Let 's look at the main ones and explain them.<br /><b>Spatial arbitration</b> is divided into the following types:<br />- <em>Equivalent arbitration</em>;<br />- <em>Regulatory arbitration</em>;<br />- <em>Calendar arbitration</em>;<br />- <em>Percentage arbitration</em>.<br /><br /><b>Equivalent arbitration</b> refers to such transactions in which the <b>underlying asset and derivative asset (derivative) are considered.</b> Since the price of a derivative always strives for the price of a basic asset, price schedules go alongside each other, sometimes intersecting and diverging.<br />If we simultaneously open equidistant positions on the selected asset and its derivative, when they have the maximum divergence, then closing the position when they converge will make a profit.<br /><b>Regulatory arbitration</b> is based on the<b> difference in price caused by different rules in different jurisdictions</b> (areas, countries, unions). <br /><b>For example</b>: due to certain legislation, an asset in one region is sold with a markdown, and its price is correlated with prices in other regions, differing by a stable markdown difference. In this way, by purchasing an asset in one region and selling it in another, you can earn a profit in the amount of a markdown.<br /><b>Calendar arbitration</b> is based on the <b>difference in price arising between futures on the same asset but having different delivery times. </b>This difference is called a calendar spread. The subsequent trading mechanism is similar to the equivalent arbitration method.<br />The last type is interest arbitration. This arbitration takes place on the foreign exchange market (Forex), and there are two types:<br />- <em>No forward coverage</em>;<br />- <em>With forward cover</em>.<br />The essence of arbitration is that the currency is bought and placed on a deposit with a set percentage. The currency is then sold at the current market rate. If the currency purchase occurs with the sale of a forward contract for the same amount, arbitration with forward coverage. With this type of risk is minimal, and for frequent absence.<br />If the purchase is made without forward support, arbitration without forward coverage. Such arbitration may be accompanied by a large risk based on a change in exchange value, which may result in a loss that is greater than the percentage of income on the deposit.<br /><b>Triangular arbitration</b> is also common in the Forex market. Let 's look at it with an example:<br />The trader buys <b>EUR/USD</b>, sells <b>EUR/GBP</b> at the same time, and buys <b>USD/GBP</b>. An equilibrium triangular contour is created. It turns out that the trader bought Euro for dollars, sold Euro for Pounds, Bought Dollars for Pounds. Thus, a closed chain is obtained, on the imbalance of which profit is made.The scheme of such arbitration is shown below:<br /><a href='https://stocksharp.com/file/110500/arbitrage-forex-trade_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/110500/arbitrage-forex-trade_png/?size=500x500" alt="Arbitrage-Forex-Trade.png" title="Arbitrage-Forex-Trade.png" /></a><br /><br /><div align="center"><b>Conclusions</b></div><br /><br /><b>Arbitration trade</b> has gained a lot of recognition among traders. A large number of approaches to solving the problems of <b>arbitration trade</b>, a large number of methods used to implement the tasks make this kind very flexible, and the absence of risk or its minimum value further popularizes it.<br />However, it is worth saying that the strategies of arbitration to direct, are related to the rate of reaction of the trader to changes in the asset. This leads to various requirements that promote successful trade:<br />- <b>Fractions of a second play a major role in arbitration strategies.</b> Therefore, such<b> trading systems require good software</b>. It can be represented by ready-made trading robots. For example, StockSharp offers the robot <a href="https://stocksharp.com/robot/18/edward-scissorhands/" title="https://stocksharp.com/robot/18/edward-scissorhands/">"Edward"</a>, which allows you to work using the trader's<b> arbitrage strategy</b> and is capable of quick and <b>flexible configuration.</b><br /><b>High-quality </b><b>software</b> is especially important when working for<b> Forex</b>, as the number of traders is high. Therefore, many prefer an individual approach and create trade robots on their own through various programs. Trading robots are mostly written in powerful <em>C# </em>or <em>C++</em> languages, using libraries such as <a href="https://stocksharp.com/products/api/" title="https://stocksharp.com/products/api/">S#.API</a> and <em>Interactive Brokers API</em>.<br />Recent years have also received designers of trade strategies <em>TSlab</em> and <a href="https://stocksharp.com/products/designer/" title="https://stocksharp.com/products/designer/">S#.Designer</a>, which allow to create trade robots without programming.Below is an example of a trading robot created using S#.Designer, the graph shows the moment of divergence of assets and their convergence with the subsequent transaction by the robot.<br /><a href='https://stocksharp.com/file/110497/arbitrage-trading-exchange-stock_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/110497/arbitrage-trading-exchange-stock_png/?size=500x500" alt="arbitrage-trading-exchange-stock.png" title="arbitrage-trading-exchange-stock.png" /></a><br />Application of the latest software leads to reduction of risks and improvement of the mechanism of work and as a result to increase of profit.<br />- <b>It is important to remember that the strategy, even if there is perfect software, is profitable, if the income will exceed the possible risk and all broker commissions.</b><br />- <b>It is worth remembering even using a trading robot, the risk can not always be reduced, so the trader must constantly manage his strategy, improve his tools and his knowledge. </b>Learning new principles that can be applied in trading can make a trader a pioneer in making profits.<br />It is necessary to know that arbitration strategies can and should be combined with other types of exchange trade, which will give additional opportunities in income generation.<br />https://stocksharp.com/topic/11355/FAQ on Aalgorithmic trading. The history of algorithmic trading.2020-01-27T15:09:19Z2020-01-27T15:10:10ZMarathttps://stocksharp.com/users/101940/info@stocksharp.comThe start and emergence of <b>algorithmic trading</b> can be considered the 98th year of the last century, when the us securities Commission (abbreviated <em>SEC</em>), decided on the possibility of using <b>electronic trading platforms</b>, and as a result, the use of <b>trading robots</b> for algorithmic trading.<br /><a href='https://stocksharp.com/file/110448/hft-trading-robot_jpg/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/110448/hft-trading-robot_jpg/?size=500x500" alt="HFT-trading-robot.jpg" title="HFT-trading-robot.jpg" /></a><br />All this gave rise to a leap in technology in the field of trade. <br />There are several periods that are particularly important:<br />- <b>the beginning of the 2000s</b>, this period of technology allowed you to <b>make automatic transactions</b> in a few seconds, despite the low speed it was a breakthrough, according to the <em>SEC</em> calculation, robots account for less than <b>8% of transactions</b>.<br />- <b>the end of the 2000s</b> was characterized by an increase in the <b>speed of transactions up </b>to milliseconds, during this period the number of transactions made by <b>trading robots exceeded 55-60%</b>.<br />-<b> late period since 2010</b>, the number of use of trading robots has decreased, and <b>amounted to about 45-50%</b>. Experts attribute the decline in usage to an increased number of errors and failures of <b>trading robots</b>.<br />Today, <b>algorithmic trading</b> (<em>HFT trading</em>) is one of the most important components of exchange trading. Not only private traders, but also large companies-invest. banks and funds use trading robots in their work.<br /><a href='https://stocksharp.com/file/110447/algorithmic-trading_jpg/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/110447/algorithmic-trading_jpg/?size=500x500" alt="algorithmic-trading.jpg" title="algorithmic-trading.jpg" /></a><br />The annual investment of companies in the development of tools for <b>algorithmic trading</b> is growing, and the result of such developments brings its own income. <br /><em>StockSharp</em> has been <b>providing traders</b> with all the necessary<b> tools for algorithmic trading </b>for many years, starting with <a href="https://stocksharp.com/products/pricing/#hft" title="https://stocksharp.com/products/pricing/#hft">connectors</a> for <b>exchange trading</b> and ending with <a href="https://stocksharp.com/products/designer/" title="https://stocksharp.com/products/designer/">software</a> that allows them to work on all <b>trading platforms around the world</b>. <br />You can find more information about the list on our <a href="https://stocksharp.com/" title="https://stocksharp.com/">website</a>.<br /><br />https://stocksharp.com/topic/11274/FAQ on Algorithmic trading. What is Algorithmic trading?2019-12-24T15:37:52Z2019-12-24T15:41:26ZMarathttps://stocksharp.com/users/101940/info@stocksharp.comThe concept of <b>algorithmic trading</b> there are two values:<br />- <b>Algotrading</b> -an <b>automatic system </b>that allows you to <b>open trades</b> within the created algorithm, without the participation of a trader;<br />- <b>Algorithmic trading</b> – a <b>method </b>of execution of a large order, in which the order is automatically divided into parts, and is submitted consistently according to the <b>established rules</b>.<br /><br /><a href='https://stocksharp.com/file/110311/algo-trading-stock_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/110311/algo-trading-stock_png/?size=500x500" alt="algo-trading-stock.png" title="algo-trading-stock.png" /></a><br /><br />In the first case, <b>algorithms</b> are needed to<b> make a profit</b>, using automatic market<b> analysis and opening positions</b>. Such algorithms have other names such as <b>"trading robot" or "Advisor"</b>.<br />In the second case, the<b> algorithm</b> is used in order to <b>simplify the work of the trader</b> in manual trading when making transactions <b>in large volumes</b>.<br /><a href="https://stocksharp.com" title="https://stocksharp.com">StockSharp</a> company pursuing its goal to facilitate the work of the trader and bring it to a <b>higher and more profitable</b> level, has developed several programs to help the trader in this.<br />Among these programs is <a href="https://stocksharp.com/products/designer/" title="https://stocksharp.com/products/designer/">S#.Designer</a>.<br /><br /><a href='https://stocksharp.com/file/110312/algo-trading-strategy_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/110312/algo-trading-strategy_png/?size=500x500" alt="algo-trading-strategy.png" title="algo-trading-strategy.png" /></a><br /><br />It allows you to <b>create trading robots</b> for algorithmic trading.<br />Our company has <b>created a program</b> that will <b>help the novice trader </b>to create his strategy with the help of dice. In fact, it is a constructor that requires a trader only to understand the market and the developed strategy, which is quite simple to implement and implement in trading processes. More information about the program can be found on our <a href="https://stocksharp.com" title="https://stocksharp.com">website</a>.https://stocksharp.com/topic/11255/Interactive Brokers FAQ. INTERACTIVE BROKERS-who are they?2019-12-11T15:35:11Z2019-12-11T15:36:01ZMarathttps://stocksharp.com/users/101940/info@stocksharp.com<em>Interactive Brokers</em> is the <b>largest broker </b>in the<b> United States</b>, based on the volume of average daily transactions with profit. <em>Interactive Brokers </em>is a <b>leading electronic Forex broker</b>. <br /><a href='https://stocksharp.com/file/110267/interactive-brokers_jpg/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/110267/interactive-brokers_jpg/?size=500x500" alt="Interactive-brokers.jpg" title="Interactive-brokers.jpg" /></a><br />Electronic brokers are focused on trading strategies or trading robots that work in the sector of trading with commodities [nerd], this allows us to say that this broker is among the <b>five Prime brokers</b>.<br /><em>Interactive Brokers</em> is fully<b> regulated </b>by the financial industry Regulatory authority, the securities and exchange Commission, the new York stock exchange, the financial conduct Authority, and other self-regulatory organizations.<br />To get the data, use the<em> API</em> connection via the <em>IB TWS</em> terminal.<br /><a href='https://stocksharp.com/file/110268/interactive-brokers-api_jpg/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/110268/interactive-brokers-api_jpg/?size=500x500" alt="Interactive-brokers-API.jpg" title="Interactive-brokers-API.jpg" /></a><br />To work with this program, <em>StockSharp</em> has created its own <a href="https://stocksharp.com/products/api/" title="https://stocksharp.com/products/api/">API library</a>, which allows you to create your own connection. <br />What can this give the trader? There are several <b>advantages</b>:<br /><em>-The fastest quotes<br />-The average receiving speed is 4 MS<br />- Work with real and demo accounts</em><br />Accordingly, the use of <em>Interactive Brokers</em> with the help of <a href="https://stocksharp.com/products/api/" title="https://stocksharp.com/products/api/">API libraries</a> opens up new opportunities for the trader, allowing him to <b>expand the expansion of his trading operations</b>.https://stocksharp.com/topic/11226/FAQ on Crypto trading. Сrypto trading what is it?2019-12-02T16:13:58Z2019-12-02T16:14:25ZMarathttps://stocksharp.com/users/101940/info@stocksharp.comGood afternoon. <br />Today we will consider a relatively young type of trade - <em>Сrypto trading</em>. What is the difference between <b>cryptocurrency token trading</b> and traditional trading? Traditional trading is, for example, trading in precious metals, currencies and stocks. The main difference between <b>crypto trading</b> and trading on the stock market is the <b>high volatility of the exchange</b> rate.[nerd]<br />Traders want to get a <em>return of thousands of percent</em> of the transaction, but in the stock market, such transactions are extremely rare, and the time of its occurrence is large enough, they <b>buy shares of little-known companies</b> in the hope of increasing capitalization, which is sometimes not feasible. Below is a graph of the change in the exchange rate of various exchange instruments for several years, which shows how much the exchange rate of cryptocurrency is changing, which allows you to earn more. <br /><br /><a href='https://stocksharp.com/file/110221/crypto-trading_jpg/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/110221/crypto-trading_jpg/?size=500x500" alt="Crypto-trading.jpg" title="Crypto-trading.jpg" /></a><br /><br />In Crypto trading, <b>fast trades with high returns</b> are quite common.<b> Crypto trading</b> has the greatest <b>similarity with Forex</b> trading. Here, too, the value of currencies is <b>volatile</b>, and stock speculators earn by <b>selling more expensive</b> cryptocurrency and <b>buying cheaper.</b> <br />Different strategies and opportunities can be used to work in the cryptocurrency market. The <a href="https://stocksharp.com/products/designer/" title="https://stocksharp.com/products/designer/">Designer</a> program, for example, offers a <b>trading solution</b> by building its profitable strategy. <br /><br /><a href='https://stocksharp.com/file/110222/crypto-trading-designer_jpg/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/110222/crypto-trading-designer_jpg/?size=500x500" alt="Crypto-trading-Designer.jpg" title="Crypto-trading-Designer.jpg" /></a><br /><br />Anyone, even a novice trader, can build his robot with the help of cubes responsible for the trading algorithm. Built-in capabilities for debugging strategies on different markets, with the ability to trade on several platforms at once, make it an indispensable tool. More information about all the products of our company can be found on our <a href="https://stocksharp.com/products" title="https://stocksharp.com/products">website</a>.https://stocksharp.com/topic/10679/Designer - create a strategy based on MACD. Start with simple.2019-05-06T18:15:06Z2019-11-18T07:05:29ZMarathttps://stocksharp.com/users/101940/info@stocksharp.comCreating a strategy in the <a href="https://stocksharp.com/products/designer/" title="https://stocksharp.com/products/designer/">Designer</a> program.<br /><br />Let’s discuss an example of creating a trading strategy in a program based on the MACD indicator values.<br />The indicator’s goal is as follows:<br /><br />1. If the MACD indicator histogram crosses the zero line from top to bottom, this is a sell signal.<br />2. The transition of the histogram from the negative to the positive zone is a buy signal.<br /><br />Therefore, it is necessary to create conditions under which a trade will be made, namely, if the indicator value on the next candle changes its sign, then the signal is sent to make a trade.<br />To create a strategy, we need:<br /><br />- Run the program. <br /><br /><a href='https://stocksharp.com/file/109074/1_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/109074/1_png/?size=500x500" alt="1.png" title="1.png" /></a><br /><br />- Select the Variable, Candles and Chart Panel blocks, connect them. <br /><br /><a href='https://stocksharp.com/file/109084/2_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/109084/2_png/?size=500x500" alt="2.png" title="2.png" /></a><br /><br />- Select an instrument with which we will test the strategy. <br /><br /><a href='https://stocksharp.com/file/109086/3_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/109086/3_png/?size=500x500" alt="3.png" title="3.png" /></a><br /><br />- Plot a candle chart. <br /><br /><a href='https://stocksharp.com/file/109081/4_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/109081/4_png/?size=500x500" alt="4.png" title="4.png" /></a><br /><br />- Select the Indicator and Chart Panel blocks. Connect the Indicator and Candles blocks. <br /><br /><a href='https://stocksharp.com/file/109077/5_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/109077/5_png/?size=500x500" alt="5.png" title="5.png" /></a><br /><br />- Plot a chart of the MACD indicator.<br /><br /><a href='https://stocksharp.com/file/109075/6_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/109075/6_png/?size=500x500" alt="6.png" title="6.png" /></a><br /><br />- Select the Variable block and assign it a numeric value of 0 for further comparison with the indicator value. <br /><br /><a href='https://stocksharp.com/file/109083/7_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/109083/7_png/?size=500x500" alt="7.png" title="7.png" /></a><br /><br />- Select the Comparison block and set the test condition in the properties: execution during the test, with the MACD indicator value greater than 0.<br /><br />- Add two Variable blocks and Comparison block. One of the variables is set to -1 in the block properties. It will indicate the transition of the MACD curve value from negative to positive area. The second Variable value is set to 0 in the properties, that will indicate the initial indicator value. <br /><br />- Set the condition in the Comparison block that will be fulfilled if the initial indicator value for the time frame is greater than the current one.<br /><br />- Connect the Variable blocks via a trigger socket with the Comparison blocks, as shown in the figure.<br />Select the Logical Condition and Variable cubes.<br /><br /><a href='https://stocksharp.com/file/109079/8_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/109079/8_png/?size=500x500" alt="8.png" title="8.png" /></a> <br /><br />- The execution condition of two comparisons will be checked in the Logical Condition cube. Set the AND condition in the properties of the Logical Condition cube and connect the cubes as shown in the figure.<br /><br /><a href='https://stocksharp.com/file/109076/9_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/109076/9_png/?size=500x500" alt="9.png" title="9.png" /></a><br /><br />- Set the value equal to -1 in the Variable cube and connect it with the Logical Condition cube via a trigger socket, and through the output connect to the input of the cube with a value of 0. This will allow overwriting the checkbox value when conditions are met, indicating within what range of values the MACD indicator curve is.<br /><br /><a href='https://stocksharp.com/file/109080/10_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/109080/10_png/?size=500x500" alt="10.png" title="10.png" /></a><br /><br />- Select the Open Position block, select the Buy direction in the settings and connect data and trigger with the socket, as shown in the figure.<br /><br /><a href='https://stocksharp.com/file/109082/11_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/109082/11_png/?size=500x500" alt="11.png" title="11.png" /></a><br /><br />- Select two Variable blocks in which to set the volume and portfolio for trading. Connect them with the corresponding sockets of the Open Position block.<br /><br /><a href='https://stocksharp.com/file/109087/12_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/109087/12_png/?size=500x500" alt="12.png" title="12.png" /></a><br /><br />- Similarly, create a routine for the Sales execution.<br /><br /><a href='https://stocksharp.com/file/109085/13_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/109085/13_png/?size=500x500" alt="13.png" title="13.png" /></a><br /><br />-The strategy is ready, let’s run it.<br /><br /><a href='https://stocksharp.com/file/109078/14_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/109078/14_png/?size=500x500" alt="14.png" title="14.png" /></a><br />https://stocksharp.com/topic/11166/FAQ on FIX Protocol. Limit orders FOK and IOC (FAK).2019-11-15T18:04:12Z2019-11-15T18:04:32ZMarathttps://stocksharp.com/users/101940/info@stocksharp.comEarlier, we said that the <b>FIX Protocol</b> not only increased the<b> speed of traders</b> in the market, but also provided an opportunity for market participants to use <b>limit orders</b>, which reduced the risks of trading. Let's take a closer look at two types of limit orders. <br />Let's start with the <em>FOK</em> order.<br />Literally, its name stands for - <em>'Fill Or Kill'</em>. The essence of this order is that it is<b> executed immediately</b> and in <b>full at the stated price</b>, or will not be executed at all, which eliminates the possibility of slippage. Thus, if your order<b> cannot be executed in full</b>, then the order is<b> simply rejected</b>, if the order <b>can be executed in full</b>, then the <b>order is executed in full at the specified price</b>. [nerd] This type of order is very <b>convenient</b> for <b>scalping</b> or <b>arbitrage strategies</b>, as they <b>eliminate the risk of slippage</b>. In fact, we can say that the <a href="https://stocksharp.com/robot/18/edward-scissorhands/" title="https://stocksharp.com/robot/18/edward-scissorhands/">"Edward – Scissorhands"</a><b> arbitrage strategy</b> from StockSharp <b>eliminates risks</b>. Below is an example of the rejection of the <em>FOK</em> order in the <em>CME</em> system, due to the fact that the <b>order size is 20</b>, and the<b> book contains only 19</b>, so the order <b>can not be executed completely</b>, and the system cancels it. <br /><br /><a href='https://stocksharp.com/file/110086/fok-orde-fix-protocol_jpg/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/110086/fok-orde-fix-protocol_jpg/?size=500x500" alt="FOK-orde-FIX-protocol.jpg" title="FOK-orde-FIX-protocol.jpg" /></a><br /><br />The next type of limit orders are <em>IOC</em> orders. <br />The name <em>'Immediate OR Cancel' </em>means that the <b>order is executed in whole or in part at the set price</b>, otherwise the order will be canceled. For example, if the <b>order size is 100 units</b>, only <b>50 units can be sold at the set price</b>. If we use an order of type <em>FOK</em>, the system will cancel it, as it can not be fully executed. When using the <em>IOC</em> <b>limit order</b>, the order will be <b>executed for 50 units</b>, and the <b>remaining ones will be canceled</b>. <em>IOC</em> also has another name <em>FAK</em>, which stands for <em>'Fill And Kill'</em>, executed and discarded the remainder.[nerd]<br />For example, an <em>IOC</em> order will be partially executed (in the <em>CME</em> system, its name is <em>FAK</em>). If we <b>buy 15</b>, and the book <b>contains only 10</b>, then we <b>buy 10</b>, and the <b>remaining 5</b> are rejected, so this order can be called partially executable:<br /><br /><a href='https://stocksharp.com/file/110085/iok-order-fix-protocol_jpg/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/110085/iok-order-fix-protocol_jpg/?size=500x500" alt="IOK-order-FIX-protocol.jpg" title="IOK-order-FIX-protocol.jpg" /></a><br /><br /><b>Limit orders</b> when working through the <b>FIX Protocol</b> allow the trader to <b>reduce risks</b>, and in some cases, especially when working with <b>arbitrage strategies</b> to <b>reduce them to zero</b>. Our company provides a range of programs to work in the market through <b>FIX connect</b>, such as: designer trading strategies <a href="https://stocksharp.com/products/designer/" title="https://stocksharp.com/products/designer/">Designer</a>, trading program <a href="https://stocksharp.com/products/terminal/" title="https://stocksharp.com/products/terminal/">Terminal</a>. We also provide a full range of connectors for connection to trades, including FIX. Flexible system of discounts and reliability of connection, makes us one of leaders in the market. The full range of connectors and software can be found on our <a href="https://stocksharp.com/products/pricing/" title="https://stocksharp.com/products/pricing/">website</a>.<br />https://stocksharp.com/topic/10642/How to download market data to the Designer?2019-04-25T12:35:50Z2019-04-26T00:39:18ZMarathttps://stocksharp.com/users/101940/info@stocksharp.com<iframe width="640" height="390" src="//www.youtube.com/embed/st0zTuKX_Fg" frameborder="0" allowfullscreen></iframe><br /><br />In order to download market data to the Designer program for testing a trading strategy, you need to do the following:<br /><br />1.Run the program.<br /><br /><a href='https://stocksharp.com/file/108980/1_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108980/1_png/?size=500x500" alt="1.png" title="1.png" /></a><br /><br />2. Select the <b>Market Data</b> section in the top menu and click on it.<br /><br /><a href='https://stocksharp.com/file/108968/2_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108968/2_png/?size=500x500" alt="2.png" title="2.png" /></a><br /><br />3. In the window that appears, select the Download Securities button in the Securities panel, in the menu that appears, tick the All option and select the storage. Then click the OK button .<br /><br /><a href='https://stocksharp.com/file/108970/2a_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108970/2a_png/?size=500x500" alt="2а.png" title="2а.png" /></a><br /><br />4. In the list of downloaded securities, select the one we need.<br /><br /><a href='https://stocksharp.com/file/108976/3_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108976/3_png/?size=500x500" alt="3.png" title="3.png" /></a> <a href='https://stocksharp.com/file/108974/4_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108974/4_png/?size=500x500" alt="4.png" title="4.png" /></a><br /><br />5. Choose a period for which we need market data, and candles that we need.<br /><br /><a href='https://stocksharp.com/file/108967/5_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108967/5_png/?size=500x500" alt="5.png" title="5.png" /></a> <a href='https://stocksharp.com/file/108979/6_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108979/6_png/?size=500x500" alt="6.png" title="6.png" /></a><br /><br />6. Select the path to storage where our market data will be stored, for this, we click the “+” button. <br /><br /><a href='https://stocksharp.com/file/108971/7_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108971/7_png/?size=500x500" alt="7.png" title="7.png" /></a><br /><br />7. In the menu that appears, select the full path to store the downloaded market data.<br /><br /><a href='https://stocksharp.com/file/108969/8_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108969/8_png/?size=500x500" alt="8.png" title="8.png" /></a><br /><br />8. Click the <b>Start</b> button<br />9. In the window that appears, select the market data source.<br /><br /><a href='https://stocksharp.com/file/108978/9_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108978/9_png/?size=500x500" alt="9.png" title="9.png" /></a><br /><br />10. In the window that appears, click the “+” button and select the source we need from the drop-down list.<br /><br /><a href='https://stocksharp.com/file/108977/10_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108977/10_png/?size=500x500" alt="10.png" title="10.png" /></a> <a href='https://stocksharp.com/file/108973/11_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108973/11_png/?size=500x500" alt="11.png" title="11.png" /></a> <a href='https://stocksharp.com/file/108972/12_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108972/12_png/?size=500x500" alt="12.png" title="12.png" /></a><br /><br />11. Click the OK button.<br /><br /><a href='https://stocksharp.com/file/108975/13_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108975/13_png/?size=500x500" alt="13.png" title="13.png" /></a><br /><br />Market data downloaded to your storage. Enjoy using.https://stocksharp.com/topic/10641/Designer Knowledge Base2019-04-25T12:28:29Z2019-04-25T18:46:03ZMarathttps://stocksharp.com/users/101940/info@stocksharp.comFrequently asked questions about <a href="https://stocksharp.com/products/designer/" title="https://stocksharp.com/products/designer/">Designer</a>:<br />1. <a href="https://stocksharp.com/articles/10642/How-to-download-market-data-to-the-program/" title="https://stocksharp.com/articles/10642/How-to-download-market-data-to-the-program/">How to download market data to the program?</a><br />2. How and where to specify an instrument for strategy backtesting?<br />3. How to create a condition in the strategy?<br />4. Compound indicators, methods of their decomposition.https://stocksharp.com/topic/10131/S#.UI - StockSharp Graphic Framework2018-11-15T16:25:45Z2018-11-26T22:13:12ZЮрий Басанговhttps://stocksharp.com/users/7/info@stocksharp.com<a href='https://stocksharp.com/file/108007/image3979_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108007/image3979_png/?size=500x500" alt="image3979.png" title="image3979.png" /></a><br /><br />In this paper, I will show how to use graphic components included in S#.API, in order to create a fully-featured application of the <a href="https://stocksharp.com/products/shell/" title="https://stocksharp.com/products/shell/">S#.Shell</a>:<br /><br />You will learn how to make a professional-level program with connection settings, output of securities, prices, and charts (and all this is saved and loaded upon restart). And the complexity of creating such an application is not a few months, but just a few hours (it is no joke! read to the end). This is the main advantage of the graphic framework, which I called by analogy S#.UI (this name is unofficial, I think it up myself).<br />I will not use complex constructs and design patterns that are understandable only to professional programmers. On the contrary, the paper's purpose is to show that the learning curve on creating your trading applications using S#.API is very short.<br />You will also be interested if you work in a company and make your own unique software (for example, you work in proprietary trading or a brokerage company). In this paper, you will be able to learn the practice of creating such systems (especially if you have just taken up your duties).<br /><br /><h2>What You Need</h2><br />1) Visual Studio 2017 (Community, free version), in which we will program.<br />2) Free connection to test exchange trading, I will use QUIK.<br /><br /><h2>Creating Project</h2><br />We create a new WPF application in Visual Studio.<br /><a href='https://stocksharp.com/file/108008/image5545_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108008/image5545_png/?size=500x500" alt="image5545.png" title="image5545.png" /></a><br />After that we need to add the S#.API libraries, and how to do this is described <a href="http://doc.stocksharp.com/html/b9f672db-e0c9-4208-9759-179e5de17fd8.htm" title="http://doc.stocksharp.com/html/b9f672db-e0c9-4208-9759-179e5de17fd8.htm">here</a>. I prefer installing with Nuget.<br />Since all S#.API graphic elements are based on DevExpress, and DevExpress libraries are included in S#.API, it would be foolish not to use them. All information about DevExpress graphic elements can be found in Google.<br />Let's go to the MainWindow.xaml window editor.<br /><a href='https://stocksharp.com/file/108009/image4259_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108009/image4259_png/?size=500x500" alt="image4259.png" title="image4259.png" /></a><br />We replace Window with DXWindow, we will need it to use different color schemes. <br /><a href='https://stocksharp.com/file/108010/image4329_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108010/image4329_png/?size=500x500" alt="image4329.png" title="image4329.png" /></a><br />Visual Studio will prompt us to add the necessary libraries.<br />We split the window into three parts, there will be a bar with buttons of connection setting and connection at the top. The window with logs will be below. All other panels are in the middle. The easiest way is to split the window in this way using LayoutControl from DevExpress.<br />We will add the elements we need to the resulting three parts.<br /><a href='https://stocksharp.com/file/108011/image2275_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108011/image2275_png/?size=500x500" alt="image2275.png" title="image2275.png" /></a><br /><br /><h2>Configuring Connection to Connector</h2><br />We add two buttons, one button to configure connection and the second button to connect. To do this, we use the SimpleButton button from DevExpress. The buttons will be located at the top of application. We will place pictures familiar with Terminal and Designer on each button.<br /><a href='https://stocksharp.com/file/108012/image9977_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108012/image9977_png/?size=500x500" alt="image9977.png" title="image9977.png" /></a><br />We will see such an image in the upper right corner of the screen form.<br /><a href='https://stocksharp.com/file/108013/image1157_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108013/image1157_png/?size=500x500" alt="image1157.png" title="image1157.png" /></a><br />We double-click each button to create button click event handlers.<br />In MainWindow code it is necessary to declare the connector, as well as the file location and name where the connector settings will be stored.<br /><a href='https://stocksharp.com/file/108014/image836_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108014/image836_png/?size=500x500" alt="image836.png" title="image836.png" /></a><br />We will open the connector configuration window in the connector settings button click event handler and save it to a file.<br /><a href='https://stocksharp.com/file/108015/image1289_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108015/image1289_png/?size=500x500" alt="image1289.png" title="image1289.png" /></a><br />We will check in the constructor whether there is a directory and a file with the connector settings and, if there is one, we will load it into the connector.<br /><a href='https://stocksharp.com/file/108016/image3497_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108016/image3497_png/?size=500x500" alt="image3497.png" title="image3497.png" /></a><br />Most S#.API objects have Save and Load methods, with which it is possible to save and load this object from an XML file.<br />We connect the connector in the connection button click event handler method.<br /><a href='https://stocksharp.com/file/108017/image6463_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108017/image6463_png/?size=500x500" alt="image6463.png" title="image6463.png" /></a><br />Now we can run the program and test it.<br /><br /><h2>Setting Dark Theme</h2><br />I prefer a dark theme. Therefore, we make the program theme dark at once. To do this in the App.xaml file <br /><a href='https://stocksharp.com/file/108018/image1012_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108018/image1012_png/?size=500x500" alt="image1012.png" title="image1012.png" /></a><br />We replace Application with charting:ExtendedBaseApplication. Visual Studio will prompt us to add the necessary libraries. And in the file App.xaml.cs delete ": Application". The code will be the following.<br /><a href='https://stocksharp.com/file/108019/image4777_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108019/image4777_png/?size=500x500" alt="image4777.png" title="image4777.png" /></a><br /><a href='https://stocksharp.com/file/108020/image9701_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108020/image9701_png/?size=500x500" alt="image9701.png" title="image9701.png" /></a><br />We write ApplicationThemeHelper.ApplicationThemeName = Theme.VS2017DarkName in the MainWindow constructor;<br />Full code at the moment:<br /><a href='https://stocksharp.com/file/108021/image8484_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108021/image8484_png/?size=500x500" alt="image8484.png" title="image8484.png" /></a><br />Run to check the dark theme.<br /><a href='https://stocksharp.com/file/108022/image1199_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108022/image1199_png/?size=500x500" alt="image1199.png" title="image1199.png" /></a><br /><br /><h2>Creating Security Panel</h2><br />We add the XAML folder where we will store all the created controls.<br />We add our first UserControll to the folder, let's call it SecurityGridControl.<br /><a href='https://stocksharp.com/file/108023/image5159_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108023/image5159_png/?size=500x500" alt="image5159.png" title="image5159.png" /></a><br />We add one SecurityPicker element to it. In which the available securities will be displayed. Similar to the main window, we will use LayoutControl from DevExpress.<br /><a href='https://stocksharp.com/file/108024/image2385_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108024/image2385_png/?size=500x500" alt="image2385.png" title="image2385.png" /></a><br />We go to the main window constructor and change the central part to the tab view. We place created control with SecurityPicker in one of the tabs.<br /><a href='https://stocksharp.com/file/108025/image5375_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108025/image5375_png/?size=500x500" alt="image5375.png" title="image5375.png" /></a><br />Now we have the security panel, we need to set it a data source, in our case it is a connector. It was possible to write SecurityPanel.SecPicker.SecurityProvider = Connector in MainWindow constructor.<br />But we will not place code in the MainWindow that is not related to it. Therefore, I will create the Instance static variable, and assign it the MainWindow value in the MainWindow constructor.<br /><a href='https://stocksharp.com/file/108026/image1508_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108026/image1508_png/?size=500x500" alt="image1508.png" title="image1508.png" /></a><br />Now we can call the MainWindow properties anywhere in our program using MainWindow.Instance.XXX code.<br />In the SecurityGridControl constructor, we specify Connector as a data source.<br /><a href='https://stocksharp.com/file/108027/image6003_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108027/image6003_png/?size=500x500" alt="image6003.png" title="image6003.png" /></a><br />We run the program to check.<br /><a href='https://stocksharp.com/file/108028/image8483_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108028/image8483_png/?size=500x500" alt="image8483.png" title="image8483.png" /></a><br /><br /><h2>Adding Logging</h2><br />The operation of the program, connector or robot must be monitored. For this purpose, S#.API has a special LogManager class. This class receives messages from sources and sends them to listeners. In our case, the sources will be Connector, strategies, etc., and listeners will be a file and log panel.<br />In the MainWindow code, we declare the LogManager object and the location where it will be stored.<br /><a href='https://stocksharp.com/file/108029/image3414_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108029/image3414_png/?size=500x500" alt="image3414.png" title="image3414.png" /></a><br />In the MainWindow constructor, we create LogManager, set in it Connector as the source, and a file as the listener.<br /><a href='https://stocksharp.com/file/108030/image5931_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108030/image5931_png/?size=500x500" alt="image5931.png" title="image5931.png" /></a><br />Similar to the security panel, we create a log panel, add another UserControl to the XAML folder. We call it MonitorControl. We add the Monitor element to it.<br /><a href='https://stocksharp.com/file/108031/image4717_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108031/image4717_png/?size=500x500" alt="image4717.png" title="image4717.png" /></a><br />In the MonitorControl constructor, we set Monitor as a listener in LogManager.<br /><a href='https://stocksharp.com/file/108032/image8141_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108032/image8141_png/?size=500x500" alt="image8141.png" title="image8141.png" /></a><br />We add the created MonitorControl to the bottom of MainWindow.<br /><a href='https://stocksharp.com/file/108033/image5572_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108033/image5572_png/?size=500x500" alt="image5572.png" title="image5572.png" /></a><br />We run the program to check.<br /><a href='https://stocksharp.com/file/108034/image6299_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108034/image6299_png/?size=500x500" alt="image6299.png" title="image6299.png" /></a><br /><br /><h2>Creating Portfolio Panel</h2><br />Similar to the security panel, we create a log panel, add another UserControl to the XAML folder. We call it PortfolioGridControl. We add the PortfolioGrid element to it.<br /><a href='https://stocksharp.com/file/108035/image68_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108035/image68_png/?size=500x500" alt="image68.png" title="image68.png" /></a><br />In PortfolioGridControl constructor, we need to subscribe to new portfolio appearance events and event of new position appearance at Connector.<br /><a href='https://stocksharp.com/file/108036/image1333_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108036/image1333_png/?size=500x500" alt="image1333.png" title="image1333.png" /></a><br />Thus, when a new portfolio appears, it will be displayed in the portfolio panel, and when a new position appears in the portfolio panel, the portfolio will update the position.<br />We add the created PortfolioGridControl panel to the central part of MainWindow.<br /><a href='https://stocksharp.com/file/108037/image127_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108037/image127_png/?size=500x500" alt="image127.png" title="image127.png" /></a><br />We run the program to check.<br /><a href='https://stocksharp.com/file/108038/image3862_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108038/image3862_png/?size=500x500" alt="image3862.png" title="image3862.png" /></a><br />We have a tab with portfolios.<br /><br /><h2>Creating Order Panel</h2><br />The order panel in S#.API has the ability to register orders, cancel orders and reregister them.<br />Similar to the security panel, we create an order panel, add another UserControl to the XAML folder. We call it OrderGridControl. We add the OrderGrid element to it.<br /><a href='https://stocksharp.com/file/108039/image4502_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108039/image4502_png/?size=500x500" alt="image4502.png" title="image4502.png" /></a><br />OrderGrid has the OrderRegistering event, the OrderReRegistering event, and the OrderCanceling event.<br />Let's create their handlers.<br /><a href='https://stocksharp.com/file/108040/image6128_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108040/image6128_png/?size=500x500" alt="image6128.png" title="image6128.png" /></a><br />In the order registration event handler, we create an OrderWindow window where we need to specify data sources for securities, portfolios, and market data. For all cases, this will be the Connector.<br />After that, we call OrderWindow using ShowModal method, if the OK button was clicked in this window, we register the order via the connector using the RegisterOrder method.<br /><a href='https://stocksharp.com/file/108041/image4848_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108041/image4848_png/?size=500x500" alt="image4848.png" title="image4848.png" /></a><br />We do the same in the order reregistration event handler. Only in this case the event receives the Order object - this is the order that needs to be reregistered. Therefore, in OrderWindow, we specify Order = order.ReRegisterClone(newVolume: order.Balance) to fill in the fields of the OrderWindow window.<br />After that, we call OrderWindow using ShowModal method, if the OK button was clicked in this window, we will reregister the order via connector using the ReRegisterClone method. We pass to it old order, which should be cancelled, and the new one, which should be registered.<br /><a href='https://stocksharp.com/file/108042/image1314_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108042/image1314_png/?size=500x500" alt="image1314.png" title="image1314.png" /></a><br />In the order canceling event handler, it is enough to call the CancelOrder method and pass to it the order that need to be canceled.<br /><a href='https://stocksharp.com/file/108043/image2355_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108043/image2355_png/?size=500x500" alt="image2355.png" title="image2355.png" /></a><br />In order for Orders to be displayed in the OrderGrid, it is necessary in the OrderGridControl constructor to subscribe to new order appearance events and to a registration error event and pass these events to the OrderGrid.<br /><a href='https://stocksharp.com/file/108044/image9790_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108044/image9790_png/?size=500x500" alt="image9790.png" title="image9790.png" /></a><br />We add the created OrderGridControl panel to the central part of MainWindow.<br /><a href='https://stocksharp.com/file/108045/image4806_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108045/image4806_png/?size=500x500" alt="image4806.png" title="image4806.png" /></a><br />We run the program to check.<br /><a href='https://stocksharp.com/file/108046/image7488_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108046/image7488_png/?size=500x500" alt="image7488.png" title="image7488.png" /></a><br /><br /><h2>Creating Panel of Own Trades</h2><br />Similar to the security panel, we create a panel of own trades, add another UserControl to the XAML folder. We call it MyTradeGridControl. We add the MyTradeGrid element to it.<br /><a href='https://stocksharp.com/file/108047/image3653_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108047/image3653_png/?size=500x500" alt="image3653.png" title="image3653.png" /></a><br />In the MyTradeGridControl constructor, we need to subscribe to the new own trade appearance events and pass it to MyTradeGrid. <br /><a href='https://stocksharp.com/file/108048/image7227_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108048/image7227_png/?size=500x500" alt="image7227.png" title="image7227.png" /></a><br />We add the created OrderGridControl panel to the central part of MainWindow.<br /><a href='https://stocksharp.com/file/108049/image3738_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108049/image3738_png/?size=500x500" alt="image3738.png" title="image3738.png" /></a><br />We run the program to check.<br /><a href='https://stocksharp.com/file/108050/image514_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108050/image514_png/?size=500x500" alt="image514.png" title="image514.png" /></a><br /><br /><h2>Creating Order Book Panel</h2><br />Similar to the previous panels, we create an order book panel, add another UserControl to the XAML folder. We call it MarketDepthControl. <br />In MainWindow we have already used LayoutControl, in this control we will also use LayoutControl. We split the panel into two parts horizontally.<br /><a href='https://stocksharp.com/file/108051/image1678_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108051/image1678_png/?size=500x500" alt="image1678.png" title="image1678.png" /></a><br />We add SecurityPicker to the left side, we use it when we created the security panel.<br /><a href='https://stocksharp.com/file/108052/image7627_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108052/image7627_png/?size=500x500" alt="image7627.png" title="image7627.png" /></a><br />Let's split the right part into vertical parts. There will be an order book on the top right.<br /><a href='https://stocksharp.com/file/108053/image1159_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108053/image1159_png/?size=500x500" alt="image1159.png" title="image1159.png" /></a><br />In MarketDepthControl, we need to set some MaxHeight value, otherwise the application will not start.<br />Below the order book we will place the elements of specifying a portfolio, price, and order volume.<br /><a href='https://stocksharp.com/file/108054/image8282_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108054/image8282_png/?size=500x500" alt="image8282.png" title="image8282.png" /></a><br />Here it is worth noting the Label property of LayoutItem, it allows to set the text over the element. And also the SpinEdit element from DevExpress, in which it is convenient to set numerical values. These elements look like this.<br /><a href='https://stocksharp.com/file/108055/image4967_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108055/image4967_png/?size=500x500" alt="image4967.png" title="image4967.png" /></a><br />Even below, we will place the buttons to buy, sell.<br /><a href='https://stocksharp.com/file/108056/image62_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108056/image62_png/?size=500x500" alt="image62.png" title="image62.png" /></a><br />Full code.<br /><a href='https://stocksharp.com/file/108057/image9810_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108057/image9810_png/?size=500x500" alt="image9810.png" title="image9810.png" /></a><br />In the MarketDepthControl constructor, we set the security source for SecurityPicker and the portfolio source for PortfolioComboBox, in our case it will be Connector.<br /><a href='https://stocksharp.com/file/108058/image651_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108058/image651_png/?size=500x500" alt="image651.png" title="image651.png" /></a><br />We create a security selection event handler in SecurityPicker. We check in it whether the selected security is not equal to zero. If it is not equal to zero, we save the received security to a local variable, we will need it when updating the order book. After that, we clear and register the received security in Connector to receive an order book using the RegisterMarketDepth method. Using the GetMarketDepth method, we get the current order book on security to update the MarketDepthControl.<br /><a href='https://stocksharp.com/file/108059/image3667_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108059/image3667_png/?size=500x500" alt="image3667.png" title="image3667.png" /></a><br />To keep the order book updated in the MarketDepthControl constructor, we will subscribe to the MarketDepthChanged order book change event at the connector. In the handler of this event, we will check which security the received order book belongs to, and if it belongs to the security selected in SecurityPicker, we update MarketDepthControl with it.<br /><a href='https://stocksharp.com/file/108060/image4084_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108060/image4084_png/?size=500x500" alt="image4084.png" title="image4084.png" /></a><br />We add the created MarketDepthControl panel to the central part of MainWindow.<br /><a href='https://stocksharp.com/file/108061/image7347_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108061/image7347_png/?size=500x500" alt="image7347.png" title="image7347.png" /></a><br />At this stage, we can run the program and check the order book update operation.<br />We create a buy and sell buttons click event handler. In each handler we create an Order, in which we specify the security selected in SecurityPicker, the portfolio selected in PortfolioComboBox, the volume and price from the corresponding SpinEdit. We register the order in Connector using the RegisterOrder method.<br /><a href='https://stocksharp.com/file/108062/image7717_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108062/image7717_png/?size=500x500" alt="image7717.png" title="image7717.png" /></a><br />Both handlers differ only by the order direction. <br />Let's make that the SpinEditPrice value is changed to the selected quote price when selecting a quote in the order book. To do this, we will create a handler for the SelectionChanged event at MarketDepthControl. In which we will update SpinEditPrice value by the price of the selected quote if the selected quote is not equal to zero<br /><a href='https://stocksharp.com/file/108063/image90_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108063/image90_png/?size=500x500" alt="image90.png" title="image90.png" /></a><br />We run the program to check.<br /><a href='https://stocksharp.com/file/108064/image8902_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108064/image8902_png/?size=500x500" alt="image8902.png" title="image8902.png" /></a><br /><br /><h2>Saving Market Data</h2><br />To save portfolios, securities, platforms, we need the CsvEntityRegistry class. We need to pass the entities storage location to it and call the Init method to load them.<br /><a href='https://stocksharp.com/file/108065/image7322_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108065/image7322_png/?size=500x500" alt="image7322.png" title="image7322.png" /></a><br />To save candles, trades, etc., we will need StorageRegistry.<br /><a href='https://stocksharp.com/file/108066/image809_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108066/image809_png/?size=500x500" alt="image809.png" title="image809.png" /></a><br />We will also need the SnapshotRegistry snapshot storages registry.<br /><a href='https://stocksharp.com/file/108067/image4003_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108067/image4003_png/?size=500x500" alt="image4003.png" title="image4003.png" /></a><br />All this we pass to Connector when it is created.<br /><a href='https://stocksharp.com/file/108068/image6704_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108068/image6704_png/?size=500x500" alt="image6704.png" title="image6704.png" /></a><br />Here I also specified that Connector will reconnect when the connection is broken, and also specified how many history days should be downloaded.<br />The Connector.LookupAll(); string queries the available data.<br /><a href='https://stocksharp.com/file/108069/image6016_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108069/image6016_png/?size=500x500" alt="image6016.png" title="image6016.png" /></a><br />After starting the application, we will see that new folders have appeared in the Date folder.<br /><a href='https://stocksharp.com/file/108070/image7577_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108070/image7577_png/?size=500x500" alt="image7577.png" title="image7577.png" /></a><br />And when reconnecting the security and portfolio panels will already be filled.<br /><br /><h2>Creating Strategy Panel</h2><br />I will create the strategy panel just like all previous panels.<br />We add another UserControl to the XAML folder. We call it StrategyControl. We split the screen form into two parts using the LayoutControl.<br />There will be a tab with a candle chart on the left side.<br /><a href='https://stocksharp.com/file/108071/image344_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108071/image344_png/?size=500x500" alt="image344.png" title="image344.png" /></a><br />As well as a tab with strategy statistics, <br /><a href='https://stocksharp.com/file/108072/image4907_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108072/image4907_png/?size=500x500" alt="image4907.png" title="image4907.png" /></a><br />Here I use StatisticParameterGrid to display strategy statistics and EquityCurveChart to display profit and loss chart.<br />In StatisticParameterGrid, we need to set some MaxHeight value, otherwise the application will not start.<br />The strategy properties in PropertyGridEx will be configured on the right side.<br /><a href='https://stocksharp.com/file/108073/image721_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108073/image721_png/?size=500x500" alt="image721.png" title="image721.png" /></a><br />As well as strategy start and stop buttons.<br /><a href='https://stocksharp.com/file/108074/image1047_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108074/image1047_png/?size=500x500" alt="image1047.png" title="image1047.png" /></a><br />Full code.<br /><a href='https://stocksharp.com/file/108075/image2510_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108075/image2510_png/?size=500x500" alt="image2510.png" title="image2510.png" /></a><br />In the StrategyControl constructor, we set Connector as a data source for PropertyGridEx, we carried out similar actions in almost every control.<br /><a href='https://stocksharp.com/file/108076/image8773_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108076/image8773_png/?size=500x500" alt="image8773.png" title="image8773.png" /></a><br />We need to somehow pass the strategy to our control. To do this, in StrategyControl I will create a BindStraregy method that will receive a strategy, save a link to it in the local variable, and also set a strategy in PropertyGridEx and StatisticParameterGrid.<br />Using the SetChart method, we pass the Chart candle chart to the strategy, after that, the Chart can be obtained in the strategy using the GetChart method. We also set the Connector for the strategy.<br /><a href='https://stocksharp.com/file/108077/image8230_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108077/image8230_png/?size=500x500" alt="image8230.png" title="image8230.png" /></a><br />When working with the profit and loss chart, it is necessary to take into account that the strategy may start and stop several times, so every time the strategy starts, the chart should be cleared. To do this, let's create the ResetEquityCurveChart method, in which we will first clear EquityCurveChart. After that we need to create graphic elements for EquityCurveChart, for them we can set a name, color and line type.<br /><a href='https://stocksharp.com/file/108078/image6360_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108078/image6360_png/?size=500x500" alt="image6360.png" title="image6360.png" /></a><br />Then, we subscribe to the PnL change event of the strategy and in this event handler we draw a new value on the EquityCurveChart profit loss chart.<br /><a href='https://stocksharp.com/file/108079/image3106_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108079/image3106_png/?size=500x500" alt="image3106.png" title="image3106.png" /></a><br />Full method code.<br /><a href='https://stocksharp.com/file/108080/image2024_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108080/image2024_png/?size=500x500" alt="image2024.png" title="image2024.png" /></a><br />We will call this method in the Start button click event handler. And also we will reset the strategy state and run it.<br /><a href='https://stocksharp.com/file/108081/image3375_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108081/image3375_png/?size=500x500" alt="image3375.png" title="image3375.png" /></a><br />We will stop the strategy in the Stop button click event handler.<br /><a href='https://stocksharp.com/file/108082/image3399_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108082/image3399_png/?size=500x500" alt="image3399.png" title="image3399.png" /></a><br />We add the created StrategyControl panel to the central part of MainWindow.<br /><a href='https://stocksharp.com/file/108083/image8678_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108083/image8678_png/?size=500x500" alt="image8678.png" title="image8678.png" /></a><br /><br /><h2>Creating Strategy</h2><br />For example, let's consider creating a simple strategy with candles. Which will buy if the candle is growing (green), and sell if the candle is falling (red).<br />Let's create another folder in the project and store all our strategies in it. We create a new class in this folder and call it SimpleStrategy. All S# strategies must be inherited from the base class Strategy.<br /><a href='https://stocksharp.com/file/108084/image1577_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108084/image1577_png/?size=500x500" alt="image1577.png" title="image1577.png" /></a><br />Since our strategy uses candles, we will create a public property CandleSeries, and set its default value in our strategy constructor.<br /><a href='https://stocksharp.com/file/108085/image442_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108085/image442_png/?size=500x500" alt="image442.png" title="image442.png" /></a><br />Here I specified that candles in CandleSeries will be TimeFrameCandle with time span of 15 seconds (TimeSpan.FromSeconds(15)). We can specify the candle creating mode for CandleSeries - BuildCandlesMode. I specified that candles will be built (MarketDataBuildModes.Build), by default they will be built from ticks, but we can specify other data types as well.<br />Since we made the CandleSeries a public property, the CandleSeries can be additionally configured from the PropertyGridEx described in the previous paragraph.<br />All strategies have methods that can be overridden, we will need to override the OnStarted method. Which is called before the launch of the strategy and allows to preset its starting state.<br /><a href='https://stocksharp.com/file/108086/image6026_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108086/image6026_png/?size=500x500" alt="image6026.png" title="image6026.png" /></a><br />Here we set the security for CandleSeries, which is specified in the PropertyGridEx. After that, we create a rule for processing the completed candle. See the documentation for details on working with rules. In the rule we specify the method that will process each completed candle, in our case it is the ProcessCandle method, it will be described later. After everything is set, we subscribe to the appearance of candles on the CandleSeries in connector using the SubscribeCandles method.<br />In our case, the ProcessCandle method contains the main strategy logic.<br /><a href='https://stocksharp.com/file/108087/image3324_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108087/image3324_png/?size=500x500" alt="image3324.png" title="image3324.png" /></a><br />First of all, we need to determine whether the candle is real-time or historical, if the candle is historical, we ignore it. Not all strategies require this, for example, for strategies based on order books, this is not required, since order books are always real-time. There is no general way to determine whether a candle is real-time or historical, and in each strategy this problem will have to be solved independently depending on the strategy requirements. In this case, I will simply compare the candle closing time with the connector time, and if it does not exceed a certain lag, then I consider the candle real-time.<br /><a href='https://stocksharp.com/file/108088/image2732_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108088/image2732_png/?size=500x500" alt="image2732.png" title="image2732.png" /></a><br />Next, we consider what candle it is and what the strategy current position. If the candle is growing, then at a position equal to 0, we will open a position with a market order for the volume set by us in PropertyGridEx. If the candle is growing and the position is less than 0, we reverse the position.<br /><a href='https://stocksharp.com/file/108089/image4474_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108089/image4474_png/?size=500x500" alt="image4474.png" title="image4474.png" /></a><br />We do opposite actions for a falling candle.<br /><a href='https://stocksharp.com/file/108090/image5127_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108090/image5127_png/?size=500x500" alt="image5127.png" title="image5127.png" /></a><br />At the moment, our strategy is ready to work. It should be passed to SimpleStrategyControl, which we created in the previous paragraph using the BindStraregy method. We do this in the MainWindow constructor immediately after the MainWindow components are initialized.<br /><a href='https://stocksharp.com/file/108091/image374_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108091/image374_png/?size=500x500" alt="image374.png" title="image374.png" /></a><br />We run the program to check.<br /><a href='https://stocksharp.com/file/108092/image9399_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108092/image9399_png/?size=500x500" alt="image9399.png" title="image9399.png" /></a><br /><a href='https://stocksharp.com/file/108093/image5010_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108093/image5010_png/?size=500x500" alt="image5010.png" title="image5010.png" /></a><br />The strategy works, trades are made, but there are no candles and trades on the chart yet.<br /><br /><h2>Adding Candles and Trades to Chart from Strategy</h2><br />In the paragraph about the strategy panel, we passed the Chart candle chart to the strategy using the SetChart method. In the OnStarted strategy method, we check whether the strategy has a chart set, and if it is set, then we initialize the chart, as well as subscribe to the events of new own trade appearance and candle change.<br /><a href='https://stocksharp.com/file/108094/image5547_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108094/image5547_png/?size=500x500" alt="image5547.png" title="image5547.png" /></a><br />InitChart chart initialization method.<br /><a href='https://stocksharp.com/file/108095/image977_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108095/image977_png/?size=500x500" alt="image977.png" title="image977.png" /></a><br />Here we save the link to Chart in a local variable. We clear the chart. We also create chart elements for candles and trades and pass them to the chart.<br />The chart.GuiSync(()=>{ ... }); construct is necessary in order to initialize the chart in the main thread.<br />CandleSeriesProcessing is a method for drawing candles on a chart.<br /><a href='https://stocksharp.com/file/108096/image9921_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108096/image9921_png/?size=500x500" alt="image9921.png" title="image9921.png" /></a><br />Here we get a candle from the CandleSeriesProcessing event of the connector, create ChartDrawData to display it on the chart. We specify the time data.Group(candle.OpenTime), specify that the candle should be added to the candle element of the chart .Add(_chartCandleElement, candle);. And we specify that the chart should draw new data.<br />We perform similar actions for trades.<br /><a href='https://stocksharp.com/file/108097/image4611_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108097/image4611_png/?size=500x500" alt="image4611.png" title="image4611.png" /></a><br />We run the program to check.<br /><a href='https://stocksharp.com/file/108098/image944_png/' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'><img src="https://stocksharp.com/file/108098/image944_png/?size=500x500" alt="image944.png" title="image944.png" /></a><br /><br /><h2>Short conclusion</h2><br />It is not necessary to spend a lot of time to create a complex and professional-looking application. In a few hours we created the fully-featured application with the ability to configure, display and trade directly.<br />Do not be afraid to try and create your own programs. I hope this paper will help you get used to this business.<br /><br />