﻿<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type='text/css' href='https://stocksharp.com/css/style.css'?>
<?xml-stylesheet type='text/css' href='https://stocksharp.com/css/bbeditor.css'?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title type="html">trading robots. StockSharp</title>
  <id>https://stocksharp.com/handlers/atom.ashx?category=tag&amp;id=trading robots&amp;type=articles</id>
  <rights type="text">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  <updated>2026-04-20T23:19:47Z</updated>
  <logo>https://stocksharp.com/images/logo.png</logo>
  <link href="https://stocksharp.com/handlers/atom.ashx?category=tag&amp;id=trading robots&amp;type=articles" rel="self" type="application/rss+xml" />
  <entry>
    <id>https://stocksharp.com/topic/10641/</id>
    <title type="text">Designer Knowledge Base</title>
    <published>2019-04-25T12:28:29Z</published>
    <updated>2024-09-23T18:11:16Z</updated>
    <author>
      <name>Marat</name>
      <uri>https://stocksharp.com/users/101940/</uri>
      <email>info@stocksharp.com</email>
    </author>
    <category term="Trading robot coding" />
    <category term="Trading robots" />
    <category term="Trading systems" />
    <category term="trading" />
    <category term="FAQ" />
    <category term="exchange" />
    <category term="trading on the exchange" />
    <content type="html">Frequently asked questions about &lt;a href="https://stocksharp.com/products/designer/" title="https://stocksharp.com/products/designer/"&gt;Designer&lt;/a&gt;:&lt;br /&gt;1. &lt;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/"&gt;How to download market data to the program?&lt;/a&gt;&lt;br /&gt;2. How and where to specify an instrument for strategy backtesting?&lt;br /&gt;3. How to create a condition in the strategy?&lt;br /&gt;4. Compound indicators, methods of their decomposition.</content>
  </entry>
  <entry>
    <id>https://stocksharp.com/topic/11629/</id>
    <title type="text">Trend and countertrend! Don&amp;apos;t choose to use it together.</title>
    <published>2020-04-14T20:34:27Z</published>
    <updated>2020-04-14T20:34:27Z</updated>
    <author>
      <name>Marat</name>
      <uri>https://stocksharp.com/users/101940/</uri>
      <email>info@stocksharp.com</email>
    </author>
    <category term="Trading robots" />
    <category term="trade" />
    <category term="trade systems" />
    <category term="trend" />
    <category term="trading trading srtrategy" />
    <content type="html">Previously, we have already discussed various trading methods that can be used when trading, in order to increase its profitability.&lt;br /&gt;For most traders, &lt;b&gt;following the trend is a sign of the correct approach to trading at the moment&lt;/b&gt;. Like saying: &lt;b&gt;&amp;quot;Following the trend is already 50% successful trading&amp;quot;.&lt;/b&gt; There is hardly a player in the market who will deny this statement, especially if the trend is turned in the right direction for the trader, he gets a guaranteed profit.&lt;br /&gt;The trader&amp;#39;s desire to extract the &lt;b&gt;maximum profit is aimed at finding a point of entry into the market when the price is either minimal for buying the desired asset, or maximum for selling the existing one.&lt;/b&gt;&lt;br /&gt;To determine such points, a trader often needs not only a flair, which is generally one of the most important qualities, but also the ability to use complexes from a combination of trend and counter-trend strategies.&lt;br /&gt;In the market, there is always a kind of confrontation between trend traders and counter-trend traders, using pullbacks and local changes in market trends.&lt;br /&gt;The k&lt;b&gt;ey to success and, as a result, getting the maximum income, is to merge these two strategies in a combination of experience and trader&amp;#39;s flair.&lt;/b&gt;&lt;br /&gt;However, it is worth noting that even a less experienced market player can trade using a combination of these strategies, just using automated trading systems and trading robots. For example, such as &lt;a href="https://stocksharp.com/robot/12/mister-haid/" title="https://stocksharp.com/robot/12/mister-haid/"&gt;&amp;quot;Mr. Hyde&amp;quot;&lt;/a&gt; from &lt;b&gt;StockSharp&lt;/b&gt;, which allows even a less experienced trader to use the movement against the trend, in order to increase revenue.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What is the combined method of trading?&lt;/b&gt;&lt;br /&gt;&lt;u&gt;The basic rules are the basis for this method:&lt;/u&gt;&lt;br /&gt;&lt;em&gt;1. Finding a way to determine a long-term trend or trend on the chart.&lt;br /&gt;2. Determining the opposite counter-method that allows you to determine the pullback signal, as well as a short – term trend change in the opposite direction-determining the counter-trend.&lt;/em&gt;&lt;br /&gt;There are various methods for determining points of entry and identifying subjectively correct methods of determination. Often, these methods seem quite complex to novice traders, but when you look at them in detail, they are quite accessible.&lt;br /&gt;&lt;b&gt;Let&amp;#39;s look at one of the ways.&lt;/b&gt;&lt;br /&gt;First, we need to identify long-term trends in the market. To do this, we will build a price chart and a moving average chart with a period equal to 200. You can build such a graph using the &lt;a href="https://stocksharp.com/products/designer/" title="https://stocksharp.com/products/designer/"&gt;S#.Designer&lt;/a&gt; program, using the tools provided in it.&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/112411/contr-trend.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/112411/contr-trend.png?size=800x800" alt="contr-trend.png" title="contr-trend.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;This method is very common among analysts, and allows you to determine long-term trends in the market.&lt;/b&gt;&lt;br /&gt;His idea is that if the price is located above the indicator line, the market is growing, and if it is lower, the price is decreasing.&lt;br /&gt;This indicator line is a General indicator of the market trend. Now, to determine the entry points to the market, we add two more averages, using periods of 10 and 30 days.&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/112412/contr-trend-download.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/112412/contr-trend-download.png?size=800x800" alt="contr-trend-download.png" title="contr-trend-download.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What is the point?&lt;/b&gt;&lt;br /&gt;In cases when the ten - day moving average will be above the thirty-day one and above the main two-hundred-day one, we can talk about a stable &lt;b&gt;UP-trend&lt;/b&gt;.&lt;br /&gt;&lt;b&gt;UP-TREND&lt;/b&gt; is one of three types of trend, which is a sequence of rising lows or highs of prices. it is a series of consistently rising lows and highs of prices. I&lt;b&gt;n other words, UP-TREND shows price growth over a period of time. It is also called a bullish trend in the FOREX market.&lt;/b&gt;&lt;br /&gt;If the situation with the moving average is the opposite, and the ten-day moving average is below the remaining two, then we can talk about a downtrend, or as it is commonly called a &lt;b&gt;bearish trend.&lt;/b&gt;&lt;br /&gt;A change in the direction of the trend can occur over a long period, and there may be an error in the form of a delay. In order to avoid this, you can use a counter-trend indicator.&lt;br /&gt;Each user chooses such an indicator for himself, focusing on the convenience and technical capabilities. For example, to get market data, although the latter problem is solved using the same S#.Designer or &lt;a href="https://stocksharp.com/products/hydra/" title="https://stocksharp.com/products/hydra/"&gt;Hydra&lt;/a&gt;, which downloads market data online.&lt;br /&gt;For example, we will use an oscillator that will cross the zero line. For example, consider the graph below.&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/112414/contr-trend-trading.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/112414/contr-trend-trading.png?size=800x800" alt="contr-trend-trading.png" title="contr-trend-trading.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;So, let&amp;#39;s determine the points where the long-term trend is changing and where you can make an entry to the market. By placing the charts together, or combining them, we can determine the points at which we could enter the market. These points are shown in the graph below.&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/112413/contr-trend-trade-strategy.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/112413/contr-trend-trade-strategy.png?size=800x800" alt="contr-trend-trade-strategy.png" title="contr-trend-trade-strategy.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;u&gt;As you can see, this method is quite simple to work with. However it has its drawbacks:&lt;/u&gt;&lt;br /&gt;&lt;em&gt;- You need to understand that the method shows repeated signals, and it may turn out that the point that the trader has identified for entry may be a trend reversal.&lt;br /&gt;- It is important to understand that any method can not be considered a fully automatic method and requires the intervention of the trader, and trading robots simplify the work of the trader, but also depend on its settings.&lt;/em&gt;&lt;br /&gt;&lt;b&gt;The General conclusion is simple: trading using a combined trend and counter-trend method allows the trader to increase their income by using the direction of market movement.&lt;br /&gt;A trader should rely not only on trading systems and trading robots, but also on their intuition and knowledge, which together make it possible to increase profits.&lt;/b&gt;</content>
  </entry>
  <entry>
    <id>https://stocksharp.com/topic/11594/</id>
    <title type="text">S#. Data-download market data in two steps.</title>
    <published>2020-04-08T20:22:45Z</published>
    <updated>2020-04-08T20:22:45Z</updated>
    <author>
      <name>Marat</name>
      <uri>https://stocksharp.com/users/101940/</uri>
      <email>info@stocksharp.com</email>
    </author>
    <category term="Trading robots" />
    <category term="market data" />
    <category term="market data downloader" />
    <category term="exchange information" />
    <category term="exchange  trade" />
    <content type="html">Good afternoon.&lt;br /&gt;We continue to talk about &lt;b&gt;StockSharp&amp;#39;s&lt;/b&gt; products, and in past articles we have analyzed the &lt;a href="https://stocksharp.com/products/designer/" title="https://stocksharp.com/products/designer/"&gt;S#.Designer&lt;/a&gt; trading robot constructor, as well as the &lt;a href="https://stocksharp.com/products/shell/" title="https://stocksharp.com/products/shell/"&gt;S#.Shell &lt;/a&gt;graphical framework, which helps you create trading robots, including in C# using the &lt;a href="https://stocksharp.com/products/api/" title="https://stocksharp.com/products/api/"&gt;S#.API&lt;/a&gt; library.&lt;br /&gt;&lt;b&gt;The work of these programs is aimed at creating trading systems using programming languages or cubes, in which the lines of code are replaced with cubes for simplicity, performing trading operations or responsible for conditions and parameters&lt;/b&gt;.&lt;br /&gt;Creating trading robots would not be complete without &lt;b&gt;testing the newly created trading strategy&lt;/b&gt;. T&lt;b&gt;o test and debug trading robots, before launching on real trading, you need to conduct testing on market data to make sure that they work correctly&lt;/b&gt;, consider possible &lt;b&gt;&amp;quot;thin spots&amp;quot; or errors &lt;/b&gt;that occur during trading.&lt;br /&gt;Today, market data plays an important role not only for technical analysis of trading systems, but also for analysis of market behavior in General. Agree that having data on market behavior for the period of interest, under the appropriate conditions, you can accurately predict the behavior of the market, thus you can predict the development of events.&lt;br /&gt;&lt;b&gt;Today, market data is the most valuable information for a trader, and its search is necessary for him, both for future trading and for analyzing the actions performed.&lt;/b&gt;&lt;br /&gt;&lt;b&gt;The problem with getting market data is the small number of sources that provide information on favorable terms.&lt;/b&gt;&lt;br /&gt;There are always restrictions for teaching, either the data is paid, or it is limited to the period for which it is provided. Moreover, the trader receives data from only one source, and changing sources to get other data is quite an inconvenient procedure.&lt;br /&gt;Based on the needs of the trader in&lt;b&gt; S#&lt;/b&gt;, we developed the &lt;a href="https://stocksharp.com/products/hydra/" title="https://stocksharp.com/products/hydra/"&gt;S#.Data&lt;/a&gt; or just &lt;a href="https://stocksharp.com/products/hydra/" title="https://stocksharp.com/products/hydra/"&gt;Hydra&lt;/a&gt;. &lt;br /&gt;What is she setting up?&lt;br /&gt;&lt;b&gt;The &lt;b&gt;S#.Data&lt;/b&gt; is a program for automatically loading market data.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/112234/source-market-data.gif' class='lightview' style='max-width: 800px;' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/112234/source-market-data.gif" alt="source-market-data.gif" title="source-market-data.gif" style='max-width: 800px;'/&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;u&gt;The user is provided with a huge Arsenal of functions:&lt;/u&gt;&lt;br /&gt;&lt;em&gt;- &lt;b&gt;Select the source of market data&lt;/b&gt; (more than a hundred sources to download).&lt;br /&gt;-&lt;b&gt; Selection of the necessary financial instrument&lt;/b&gt; that is of interest to the trader.&lt;br /&gt;- &lt;b&gt;Select data type&lt;/b&gt;: candles, tick deals and glasses&lt;br /&gt;- &lt;b&gt;An impressive selection of timeframes&lt;/b&gt; for downloading market data.&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/112232/source-market-data-download.gif' class='lightview' style='max-width: 800px;' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/112232/source-market-data-download.gif" alt="source-market-data-download.gif" title="source-market-data-download.gif" style='max-width: 800px;'/&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;A huge advantage of &lt;b&gt;Hydra&lt;/b&gt; is the ability to choose the data storage format&lt;/b&gt;. Thus, after downloading market data, the user saves it in a convenient format and can use it when testing their strategy on any platform. Data can be saved in two formats: in the special &lt;b&gt;S#.Data (BIN) - binary format&lt;/b&gt;, which provides the maximum compression rate, or in &lt;b&gt;CSV&lt;/b&gt; text format, which is convenient when analyzing data in other programs.&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/112233/market-data-download.gif' class='lightview' style='max-width: 800px;' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/112233/market-data-download.gif" alt="market-data-download.gif" title="market-data-download.gif" style='max-width: 800px;'/&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;All the user needs is to configure the source of market data, select the tool and the required period. In this case, you can configure the program to continuously save market data.&lt;br /&gt;The ability to use server mode allows you to save market data on the server and configure access from anywhere in the world, which allows you to create huge amounts of data for more detailed analysis or use in long-term auctions.&lt;br /&gt;At the same time, &lt;b&gt;S#.Data can use both historical and real-time data sources&lt;/b&gt; (for example, connecting SmartCOM to get glasses). This is possible by using an extensible (plug-in) source model.&lt;br /&gt;Also, &lt;b&gt;Hydra&lt;/b&gt; is a plugin that allows you to develop your own sources.&lt;br /&gt;The ability of the &lt;b&gt;Analytics&lt;/b&gt; function allows you to analyze data according to various criteria without leaving the program. Plotting the data of stock quotes and indexes, make the downloaded data more visible and more convenient to use.&lt;br /&gt;A very important advantage that makes this program unique, in addition to a set of features that any other program can envy, is that the Hydra program is completely free.&lt;br /&gt;&lt;b&gt;All these features are not the limit of functionality, only bright distinctive features that make Hydra an indispensable tool for any trader who is especially set up for profit.&lt;/b&gt;</content>
  </entry>
  <entry>
    <id>https://stocksharp.com/topic/11569/</id>
    <title type="text">S#.Designer is a simple way to start a successful trade.</title>
    <published>2020-03-31T19:05:01Z</published>
    <updated>2020-03-31T19:05:01Z</updated>
    <author>
      <name>Marat</name>
      <uri>https://stocksharp.com/users/101940/</uri>
      <email>info@stocksharp.com</email>
    </author>
    <category term="Trading robot coding" />
    <category term="Trading robots" />
    <category term="Trading systems" />
    <category term="trading" />
    <category term="trading strategy" />
    <category term="trading robot constraction" />
    <content type="html">More recently, we have reviewed a program such as &lt;a href="https://stocksharp.com/products/shell/" title="https://stocksharp.com/products/shell/"&gt;Shell&lt;/a&gt; and the&lt;a href="https://stocksharp.com/products/api/" title="https://stocksharp.com/products/api/"&gt; API library&lt;/a&gt;.&lt;br /&gt;Of course, &lt;b&gt;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.&lt;/b&gt;&lt;br /&gt;However, not every user is interested in programming, and not every user is willing to spend time studying libraries.&lt;br /&gt;Not every trader wants to learn how to write custom trading robots and often wants to create trading strategies for themselves.&lt;br /&gt;Agree, it would be cool to have a program that can use ready-made components to create trading strategies.&lt;br /&gt;&lt;b&gt;S#&lt;/b&gt; understands this and has created a trading robot constructor that allows you to&lt;b&gt; create trading robots using dice-&lt;a href="https://stocksharp.com/products/designer/" title="https://stocksharp.com/products/designer/"&gt;Designer&lt;/a&gt;&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/112115/trade-system.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/112115/trade-system.png?size=800x800" alt="trade-system.png" title="trade-system.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Now many people will start thinking: &lt;b&gt;&amp;quot;What is it good for?&amp;quot;&lt;/b&gt;.&lt;br /&gt;&lt;b&gt;Actually -.&lt;/b&gt;&lt;br /&gt;&lt;em&gt;&lt;b&gt;First&lt;/b&gt;, it is more intuitive, meaning that it is easier for the user to navigate the program interface.&lt;br /&gt;&lt;b&gt;Secondly&lt;/b&gt;, the program is completely free, which allows the user to start working with it without investing a penny!&lt;br /&gt;&lt;b&gt;Third&lt;/b&gt;, the program integrates with all our products, such as &lt;a href="https://stocksharp.com/products/hydra/" title="https://stocksharp.com/products/hydra/"&gt;Hydra&lt;/a&gt;, and moreover, it is able to download market data itself.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/112114/market-data-download.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/112114/market-data-download.png?size=800x800" alt="market-data-download.png" title="market-data-download.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;In General, the ability to download market data yourself is a huge advantage.&lt;/b&gt;&lt;br /&gt;The user can use not several programs, but one to test the created trading strategies.&lt;br /&gt;The interface is intuitive, and makes it easy to adapt to the user&amp;#39;s environment.&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/112113/trading-strategy-market-data.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/112113/trading-strategy-market-data.png?size=800x800" alt="trading-strategy-market-data.png" title="trading-strategy-market-data.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;u&gt;What is a Designer?&lt;/u&gt;&lt;br /&gt;&lt;b&gt;Designer is a completely unique program.&lt;/b&gt; It differentiates strategy elements into the simplest elements, as in the constructor, and allows you to assemble a trading strategy from these elements.&lt;br /&gt;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.&lt;br /&gt;Cubes are divided into sections that include groups of cubes for the user&amp;#39;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.&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/112112/trading-systems.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/112112/trading-systems.png?size=800x800" alt="trading-systems.png" title="trading-systems.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This means that the user does not waste time identifying the causes of the error at the program development stage.&lt;br /&gt;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.&lt;br /&gt;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&amp;#39;s expenses.&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/112116/trading-robot.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/112116/trading-robot.png?size=800x800" alt="trading-robot.png" title="trading-robot.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;More experienced users can create their own elements in&lt;b&gt; C#&lt;/b&gt;. 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.&lt;br /&gt;The advantage of strategies in &lt;b&gt;C#&lt;/b&gt; 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 &lt;b&gt;S#.Designer &lt;/b&gt;or &lt;b&gt;C#&lt;/b&gt; development environment (the most popular development environment is &lt;b&gt;Microsoft Visual Studio&lt;/b&gt;), using the library for professional development of trading robots in &lt;b&gt;C#&lt;/b&gt; and &lt;b&gt;S#.API&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/112111/prigramming-code-trading-strategy.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/112111/prigramming-code-trading-strategy.png?size=800x800" alt="prigramming-code-trading-strategy.png" title="prigramming-code-trading-strategy.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Speaking of &lt;em&gt;Designer&lt;/em&gt;, 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.&lt;br /&gt;It just remains to start working</content>
  </entry>
  <entry>
    <id>https://stocksharp.com/topic/11449/</id>
    <title type="text">What is Stop-Loss and Take Profit?</title>
    <published>2020-03-03T11:53:25Z</published>
    <updated>2020-03-03T11:53:25Z</updated>
    <author>
      <name>Marat</name>
      <uri>https://stocksharp.com/users/101940/</uri>
      <email>info@stocksharp.com</email>
    </author>
    <category term="Algorithmic trading" />
    <category term="Trading robots" />
    <category term="Trading systems" />
    <category term="trading" />
    <category term="StopLossStrategy" />
    <category term="trading strategy" />
    <category term="stop-loss" />
    <category term="take profit" />
    <category term="limit order" />
    <category term="HFT trade" />
    <content type="html">&lt;b&gt;Stop-Loss-a type of order whose task is to set limits on possible trading losses.&lt;/b&gt;&lt;br /&gt;This order is &lt;b&gt;used automatically using automated trading systems&lt;/b&gt;, which we will discuss later. The essence is very simple: with the help of the &lt;b&gt;Stop-Loss mechanism, when the set price level of the purchased asset (instrument) is reached, the position is closed&lt;/b&gt;. In fact, &lt;b&gt;Stop-Loss insures the trader from an unplanned price drop&lt;/b&gt;.&lt;br /&gt;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.&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/111684/stop-loss-order-trade.jpg' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/111684/stop-loss-order-trade.jpg?size=800x800" alt="stop-loss-order-trade.jpg" title="stop-loss-order-trade.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Stop-Loss&lt;/b&gt;, from a technical point of view, &lt;b&gt;is a regular pending order that has an activation mechanism when the set price level of the asset is reached.&lt;/b&gt; 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.&lt;br /&gt;&lt;br /&gt;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).&lt;br /&gt;For example, in the program for creating trading robots &lt;a href="https://stocksharp.com/products/designer/" title="https://stocksharp.com/products/designer/"&gt;Designer&lt;/a&gt;, it is possible to use the Stop-Loss mechanism by using the &lt;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"&gt;position protection cube&lt;/a&gt;, which can be configured and used as a reliable tool for reducing losses.&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/111685/stop-loss-protection-trading.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/111685/stop-loss-protection-trading.png?size=800x800" alt="stop-loss-protection-trading.png" title="stop-loss-protection-trading.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The use of the Stop-Loss pending order mechanism is widely used to reduce trading costs caused by losses&lt;/b&gt;. 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 &lt;b&gt;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&lt;/b&gt;. Example of a trading strategy executed in the &lt;a href="https://stocksharp.com/products/designer/" title="https://stocksharp.com/products/designer/"&gt;Designer&lt;/a&gt; program.&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/111686/Stop-Loss-trade-strategy-robot.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/111686/Stop-Loss-trade-strategy-robot.png?size=800x800" alt="Stop-Loss-trade-strategy-robot.png" title="Stop-Loss-trade-strategy-robot.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;u&gt;So, the main advantages that are inherent in a pending Stop-Loss order:&lt;/u&gt;&lt;br /&gt;&lt;em&gt;- Using a pending&lt;b&gt; Stop-Loss order in trading strategies allows you to limit losses&lt;/b&gt; 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.&lt;br /&gt;- The use of &lt;b&gt;this pending order insures the trader from an unpredictable situation in the market&lt;/b&gt;, in which the asset value may collapse, thereby protecting the user of the trading strategy from losing capital.&lt;br /&gt;- Regulation of possible losses also has a &lt;b&gt;positive effect on the trader&amp;#39;s emotional state&lt;/b&gt;, preserving his nerves and psychological health.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;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.&lt;br /&gt;An important point for working with a pending Stop-Loss order is to calculate the correct order level.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;When placing an order, you need to know the following:&lt;/u&gt;&lt;br /&gt;&lt;em&gt;- First of all, a &lt;b&gt;Stop-Loss order is a conditional order&lt;/b&gt; that is executed when the set price level is reached.&lt;br /&gt;- &lt;b&gt;The application consists of two parts&lt;/b&gt;: 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).&lt;br /&gt;- The &lt;b&gt;request is located on the broker&amp;#39;s server,&lt;/b&gt; through which the trade is carried out, and is sent only when the necessary condition is reached.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Let&amp;#39;s look at the most well-known methods of working with Stop Loss:&lt;/u&gt;&lt;br /&gt;&lt;em&gt;&lt;b&gt;- Fixed Stop-Loss:&lt;/b&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;b&gt;- Flexible Stop-Loss:&lt;/b&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;b&gt;- Break-even trading:&lt;/b&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;b&gt;- Trailing stop:&lt;/b&gt;&lt;br /&gt;A more advanced method of the previous method, which involves automatic means of transferring the Stop-Loss level.&lt;br /&gt;&lt;b&gt;- Trend:&lt;/b&gt;&lt;br /&gt;We will devote a separate article to this method and analyze it later.&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;&lt;b&gt;Let&amp;#39;s add a few more words and talk about Take Profit.&lt;/b&gt;&lt;br /&gt;Just like Stop-Loss, &lt;b&gt;Take Profit is a pending order&lt;/b&gt; 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.&lt;br /&gt;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.&lt;br /&gt;This type of order - limit, is executed only when the asset price reaches a predetermined level.&lt;br /&gt;&lt;u&gt;There are two types of &amp;quot;entry into a position&amp;quot; - the beginning of trading operations:&lt;/u&gt;&lt;br /&gt;&lt;em&gt;- &lt;b&gt;Long position&lt;/b&gt; (long, long, buy) - purchase request;&lt;br /&gt;- &lt;b&gt;Short position&lt;/b&gt; (short, short, sell) - request for sale.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;If we start trading with a purchase&lt;/b&gt;, we set the take Profit order execution level above the asset purchase price.&lt;br /&gt;&lt;b&gt;If we start trading with a sale&lt;/b&gt;, we set the take Profit order execution level below the asset&amp;#39;s sale price.&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/111687/take-profit-sell-buy-order.jpg' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/111687/take-profit-sell-buy-order.jpg?size=800x800" alt="take-profit-sell-buy-order.jpg" title="take-profit-sell-buy-order.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;In conclusion, it is worth mentioning the ratio of the orders considered.&lt;/b&gt;&lt;br /&gt;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. &lt;b&gt;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.&lt;/b&gt;</content>
  </entry>
  <entry>
    <id>https://stocksharp.com/topic/10679/</id>
    <title type="text">Designer - create a strategy based on MACD. Start with simple.</title>
    <published>2019-05-06T18:15:06Z</published>
    <updated>2019-11-18T07:05:29Z</updated>
    <author>
      <name>Marat</name>
      <uri>https://stocksharp.com/users/101940/</uri>
      <email>info@stocksharp.com</email>
    </author>
    <category term="Trading robot coding" />
    <category term="Trading robots" />
    <category term="Trading systems" />
    <category term="historical data" />
    <category term="market data" />
    <category term="trading" />
    <category term="exchange" />
    <category term="MACD" />
    <content type="html">Creating a strategy in the &lt;a href="https://stocksharp.com/products/designer/" title="https://stocksharp.com/products/designer/"&gt;Designer&lt;/a&gt; program.&lt;br /&gt;&lt;br /&gt;Let’s discuss an example of creating a trading strategy in a program based on the MACD indicator values.&lt;br /&gt;The indicator’s goal is as follows:&lt;br /&gt;&lt;br /&gt;1. If the MACD indicator histogram crosses the zero line from top to bottom, this is a sell signal.&lt;br /&gt;2. The transition of the histogram from the negative to the positive zone is a buy signal.&lt;br /&gt;&lt;br /&gt;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.&lt;br /&gt;To create a strategy, we need:&lt;br /&gt;&lt;br /&gt;- Run the program. &lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/109074/1.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/109074/1.png?size=800x800" alt="1.png" title="1.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;- Select the Variable, Candles and Chart Panel blocks, connect them. &lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/109084/2.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/109084/2.png?size=800x800" alt="2.png" title="2.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;- Select an instrument with which we will test the strategy. &lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/109086/3.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/109086/3.png?size=800x800" alt="3.png" title="3.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;- Plot a candle chart. &lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/109081/4.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/109081/4.png?size=800x800" alt="4.png" title="4.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;- Select the Indicator and Chart Panel blocks. Connect the Indicator and Candles blocks. &lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/109077/5.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/109077/5.png?size=800x800" alt="5.png" title="5.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;- Plot a chart of the MACD indicator.&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/109075/6.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/109075/6.png?size=800x800" alt="6.png" title="6.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;- Select the Variable block and assign it a numeric value of 0 for further comparison with the indicator value. &lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/109083/7.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/109083/7.png?size=800x800" alt="7.png" title="7.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;- Select the Comparison block and set the test condition in the properties: execution during the test, with the MACD indicator value greater than 0.&lt;br /&gt;&lt;br /&gt;- 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. &lt;br /&gt;&lt;br /&gt;- 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.&lt;br /&gt;&lt;br /&gt;- Connect the Variable blocks via a trigger socket with the Comparison blocks, as shown in the figure.&lt;br /&gt;Select the Logical Condition and Variable cubes.&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/109079/8.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/109079/8.png?size=800x800" alt="8.png" title="8.png" /&gt;&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;- 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.&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/109076/9.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/109076/9.png?size=800x800" alt="9.png" title="9.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;- 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.&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/109080/10.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/109080/10.png?size=800x800" alt="10.png" title="10.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;- 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.&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/109082/11.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/109082/11.png?size=800x800" alt="11.png" title="11.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;- 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.&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/109087/12.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/109087/12.png?size=800x800" alt="12.png" title="12.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;- Similarly, create a routine for the Sales execution.&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/109085/13.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/109085/13.png?size=800x800" alt="13.png" title="13.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;-The strategy is ready, let’s run it.&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/109078/14.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/109078/14.png?size=800x800" alt="14.png" title="14.png" /&gt;&lt;/a&gt;&lt;br /&gt;</content>
  </entry>
  <entry>
    <id>https://stocksharp.com/topic/10642/</id>
    <title type="text">How to download market data to the Designer?</title>
    <published>2019-04-25T12:35:50Z</published>
    <updated>2019-04-26T00:39:18Z</updated>
    <author>
      <name>Marat</name>
      <uri>https://stocksharp.com/users/101940/</uri>
      <email>info@stocksharp.com</email>
    </author>
    <category term="Trading robot coding" />
    <category term="Trading robots" />
    <category term="Trading systems" />
    <category term="market data" />
    <category term="trading" />
    <category term="FAQ" />
    <category term="exchange" />
    <category term="trading on the exchange" />
    <category term="downloader" />
    <content type="html">&lt;iframe width="640" height="390" src="//www.youtube.com/embed/st0zTuKX_Fg" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;In order to download market data to the Designer program for testing a trading strategy, you need to do the following:&lt;br /&gt;&lt;br /&gt;1.Run the program.&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108980/1.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108980/1.png?size=800x800" alt="1.png" title="1.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;2. Select the &lt;b&gt;Market Data&lt;/b&gt; section in the top menu and click on it.&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108968/2.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108968/2.png?size=800x800" alt="2.png" title="2.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;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 .&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108970/2%D0%B0.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108970/2%D0%B0.png?size=800x800" alt="2а.png" title="2а.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;4. In the list of downloaded securities, select the one we need.&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108976/3.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108976/3.png?size=800x800" alt="3.png" title="3.png" /&gt;&lt;/a&gt;                  &lt;a href='https://stocksharp.com/file/108974/4.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108974/4.png?size=800x800" alt="4.png" title="4.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;5. Choose a period for which we need market data, and candles that we need.&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108967/5.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108967/5.png?size=800x800" alt="5.png" title="5.png" /&gt;&lt;/a&gt;                  &lt;a href='https://stocksharp.com/file/108979/6.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108979/6.png?size=800x800" alt="6.png" title="6.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;6. Select the path to storage where our market data will be stored, for this, we click the “+” button. &lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108971/7.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108971/7.png?size=800x800" alt="7.png" title="7.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;7. In the menu that appears, select the full path to store the downloaded market data.&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108969/8.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108969/8.png?size=800x800" alt="8.png" title="8.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;8. Click the &lt;b&gt;Start&lt;/b&gt; button&lt;br /&gt;9. In the window that appears, select the market data source.&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108978/9.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108978/9.png?size=800x800" alt="9.png" title="9.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;10. In the window that appears, click the “+” button and select the source we need from the drop-down list.&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108977/10.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108977/10.png?size=800x800" alt="10.png" title="10.png" /&gt;&lt;/a&gt;                    &lt;a href='https://stocksharp.com/file/108973/11.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108973/11.png?size=800x800" alt="11.png" title="11.png" /&gt;&lt;/a&gt;                    &lt;a href='https://stocksharp.com/file/108972/12.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108972/12.png?size=800x800" alt="12.png" title="12.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;11. Click the OK button.&lt;br /&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108975/13.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108975/13.png?size=800x800" alt="13.png" title="13.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Market data downloaded to your storage. Enjoy using.</content>
  </entry>
  <entry>
    <id>https://stocksharp.com/topic/10131/</id>
    <title type="text">S#.UI - StockSharp Graphic Framework</title>
    <published>2018-11-15T16:25:45Z</published>
    <updated>2018-11-26T22:13:12Z</updated>
    <author>
      <name>William B</name>
      <uri>https://stocksharp.com/users/7/</uri>
      <email>info@stocksharp.com</email>
    </author>
    <category term="StockSharp" />
    <category term="Trading robots" />
    <category term="Shell" />
    <category term="trading" />
    <category term="robot" />
    <category term="S#API" />
    <category term="S#UI" />
    <content type="html">&lt;a href='https://stocksharp.com/file/108007/image3979.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108007/image3979.png?size=800x800" alt="image3979.png" title="image3979.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;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 &lt;a href="https://stocksharp.com/products/shell/" title="https://stocksharp.com/products/shell/"&gt;S#.Shell&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;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).&lt;br /&gt;I will not use complex constructs and design patterns that are understandable only to professional programmers. On the contrary, the paper&amp;#39;s purpose is to show that the learning curve on creating your trading applications using S#.API is very short.&lt;br /&gt;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).&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;What You Need&lt;/h2&gt;&lt;br /&gt;1)	Visual Studio 2017 (Community, free version), in which we will program.&lt;br /&gt;2)	Free connection to test exchange trading, I will use QUIK.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Creating Project&lt;/h2&gt;&lt;br /&gt;We create a new WPF application in Visual Studio.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108008/image5545.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108008/image5545.png?size=800x800" alt="image5545.png" title="image5545.png" /&gt;&lt;/a&gt;&lt;br /&gt;After that we need to add the S#.API libraries, and how to do this is described &lt;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"&gt;here&lt;/a&gt;. I prefer installing with Nuget.&lt;br /&gt;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.&lt;br /&gt;Let&amp;#39;s go to the MainWindow.xaml window editor.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108009/image4259.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108009/image4259.png?size=800x800" alt="image4259.png" title="image4259.png" /&gt;&lt;/a&gt;&lt;br /&gt;We replace Window with DXWindow, we will need it to use different color schemes. &lt;br /&gt;&lt;a href='https://stocksharp.com/file/108010/image4329.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108010/image4329.png?size=800x800" alt="image4329.png" title="image4329.png" /&gt;&lt;/a&gt;&lt;br /&gt;Visual Studio will prompt us to add the necessary libraries.&lt;br /&gt;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.&lt;br /&gt;We will add the elements we need to the resulting three parts.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108011/image2275.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108011/image2275.png?size=800x800" alt="image2275.png" title="image2275.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Configuring Connection to Connector&lt;/h2&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108012/image9977.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108012/image9977.png?size=800x800" alt="image9977.png" title="image9977.png" /&gt;&lt;/a&gt;&lt;br /&gt;We will see such an image in the upper right corner of the screen form.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108013/image1157.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108013/image1157.png?size=800x800" alt="image1157.png" title="image1157.png" /&gt;&lt;/a&gt;&lt;br /&gt;We double-click each button to create button click event handlers.&lt;br /&gt;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.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108014/image836.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108014/image836.png?size=800x800" alt="image836.png" title="image836.png" /&gt;&lt;/a&gt;&lt;br /&gt;We will open the connector configuration window in the connector settings button click event handler and save it to a file.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108015/image1289.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108015/image1289.png?size=800x800" alt="image1289.png" title="image1289.png" /&gt;&lt;/a&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108016/image3497.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108016/image3497.png?size=800x800" alt="image3497.png" title="image3497.png" /&gt;&lt;/a&gt;&lt;br /&gt;Most S#.API objects have Save and Load methods, with which it is possible to save and load this object from an XML file.&lt;br /&gt;We connect the connector in the connection button click event handler method.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108017/image6463.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108017/image6463.png?size=800x800" alt="image6463.png" title="image6463.png" /&gt;&lt;/a&gt;&lt;br /&gt;Now we can run the program and test it.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Setting Dark Theme&lt;/h2&gt;&lt;br /&gt;I prefer a dark theme. Therefore, we make the program theme dark at once. To do this in the App.xaml file &lt;br /&gt;&lt;a href='https://stocksharp.com/file/108018/image1012.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108018/image1012.png?size=800x800" alt="image1012.png" title="image1012.png" /&gt;&lt;/a&gt;&lt;br /&gt;We replace Application with charting:ExtendedBaseApplication. Visual Studio will prompt us to add the necessary libraries. And in the file App.xaml.cs delete &amp;quot;: Application&amp;quot;. The code will be the following.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108019/image4777.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108019/image4777.png?size=800x800" alt="image4777.png" title="image4777.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108020/image9701.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108020/image9701.png?size=800x800" alt="image9701.png" title="image9701.png" /&gt;&lt;/a&gt;&lt;br /&gt;We write ApplicationThemeHelper.ApplicationThemeName = Theme.VS2017DarkName in the MainWindow constructor;&lt;br /&gt;Full code at the moment:&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108021/image8484.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108021/image8484.png?size=800x800" alt="image8484.png" title="image8484.png" /&gt;&lt;/a&gt;&lt;br /&gt;Run to check the dark theme.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108022/image1199.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108022/image1199.png?size=800x800" alt="image1199.png" title="image1199.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Creating Security Panel&lt;/h2&gt;&lt;br /&gt;We add the XAML folder where we will store all the created controls.&lt;br /&gt;We add our first UserControll to the folder, let&amp;#39;s call it SecurityGridControl.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108023/image5159.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108023/image5159.png?size=800x800" alt="image5159.png" title="image5159.png" /&gt;&lt;/a&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108024/image2385.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108024/image2385.png?size=800x800" alt="image2385.png" title="image2385.png" /&gt;&lt;/a&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108025/image5375.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108025/image5375.png?size=800x800" alt="image5375.png" title="image5375.png" /&gt;&lt;/a&gt;&lt;br /&gt;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.&lt;br /&gt;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.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108026/image1508.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108026/image1508.png?size=800x800" alt="image1508.png" title="image1508.png" /&gt;&lt;/a&gt;&lt;br /&gt;Now we can call the MainWindow properties anywhere in our program using MainWindow.Instance.XXX code.&lt;br /&gt;In the SecurityGridControl constructor, we specify Connector as a data source.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108027/image6003.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108027/image6003.png?size=800x800" alt="image6003.png" title="image6003.png" /&gt;&lt;/a&gt;&lt;br /&gt;We run the program to check.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108028/image8483.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108028/image8483.png?size=800x800" alt="image8483.png" title="image8483.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Adding Logging&lt;/h2&gt;&lt;br /&gt;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.&lt;br /&gt;In the MainWindow code, we declare the LogManager object and the location where it will be stored.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108029/image3414.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108029/image3414.png?size=800x800" alt="image3414.png" title="image3414.png" /&gt;&lt;/a&gt;&lt;br /&gt;In the MainWindow constructor, we create LogManager, set in it Connector as the source, and a file as the listener.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108030/image5931.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108030/image5931.png?size=800x800" alt="image5931.png" title="image5931.png" /&gt;&lt;/a&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108031/image4717.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108031/image4717.png?size=800x800" alt="image4717.png" title="image4717.png" /&gt;&lt;/a&gt;&lt;br /&gt;In the MonitorControl constructor, we set Monitor as a listener in LogManager.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108032/image8141.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108032/image8141.png?size=800x800" alt="image8141.png" title="image8141.png" /&gt;&lt;/a&gt;&lt;br /&gt;We add the created MonitorControl to the bottom of MainWindow.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108033/image5572.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108033/image5572.png?size=800x800" alt="image5572.png" title="image5572.png" /&gt;&lt;/a&gt;&lt;br /&gt;We run the program to check.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108034/image6299.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108034/image6299.png?size=800x800" alt="image6299.png" title="image6299.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Creating Portfolio Panel&lt;/h2&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108035/image68.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108035/image68.png?size=800x800" alt="image68.png" title="image68.png" /&gt;&lt;/a&gt;&lt;br /&gt;In PortfolioGridControl constructor, we need to subscribe to new portfolio appearance events and event of new position appearance at Connector.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108036/image1333.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108036/image1333.png?size=800x800" alt="image1333.png" title="image1333.png" /&gt;&lt;/a&gt;&lt;br /&gt;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.&lt;br /&gt;We add the created PortfolioGridControl panel to the central part of MainWindow.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108037/image127.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108037/image127.png?size=800x800" alt="image127.png" title="image127.png" /&gt;&lt;/a&gt;&lt;br /&gt;We run the program to check.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108038/image3862.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108038/image3862.png?size=800x800" alt="image3862.png" title="image3862.png" /&gt;&lt;/a&gt;&lt;br /&gt;We have a tab with portfolios.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Creating Order Panel&lt;/h2&gt;&lt;br /&gt;The order panel in S#.API has the ability to register orders, cancel orders and reregister them.&lt;br /&gt;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.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108039/image4502.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108039/image4502.png?size=800x800" alt="image4502.png" title="image4502.png" /&gt;&lt;/a&gt;&lt;br /&gt;OrderGrid has the OrderRegistering event, the OrderReRegistering event, and the OrderCanceling event.&lt;br /&gt;Let&amp;#39;s create their handlers.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108040/image6128.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108040/image6128.png?size=800x800" alt="image6128.png" title="image6128.png" /&gt;&lt;/a&gt;&lt;br /&gt;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.&lt;br /&gt;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.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108041/image4848.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108041/image4848.png?size=800x800" alt="image4848.png" title="image4848.png" /&gt;&lt;/a&gt;&lt;br /&gt;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.&lt;br /&gt;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.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108042/image1314.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108042/image1314.png?size=800x800" alt="image1314.png" title="image1314.png" /&gt;&lt;/a&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108043/image2355.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108043/image2355.png?size=800x800" alt="image2355.png" title="image2355.png" /&gt;&lt;/a&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108044/image9790.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108044/image9790.png?size=800x800" alt="image9790.png" title="image9790.png" /&gt;&lt;/a&gt;&lt;br /&gt;We add the created OrderGridControl panel to the central part of MainWindow.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108045/image4806.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108045/image4806.png?size=800x800" alt="image4806.png" title="image4806.png" /&gt;&lt;/a&gt;&lt;br /&gt;We run the program to check.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108046/image7488.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108046/image7488.png?size=800x800" alt="image7488.png" title="image7488.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Creating Panel of Own Trades&lt;/h2&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108047/image3653.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108047/image3653.png?size=800x800" alt="image3653.png" title="image3653.png" /&gt;&lt;/a&gt;&lt;br /&gt;In the MyTradeGridControl constructor, we need to subscribe to the new own trade appearance events and pass it to MyTradeGrid. &lt;br /&gt;&lt;a href='https://stocksharp.com/file/108048/image7227.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108048/image7227.png?size=800x800" alt="image7227.png" title="image7227.png" /&gt;&lt;/a&gt;&lt;br /&gt;We add the created OrderGridControl panel to the central part of MainWindow.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108049/image3738.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108049/image3738.png?size=800x800" alt="image3738.png" title="image3738.png" /&gt;&lt;/a&gt;&lt;br /&gt;We run the program to check.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108050/image514.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108050/image514.png?size=800x800" alt="image514.png" title="image514.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Creating Order Book Panel&lt;/h2&gt;&lt;br /&gt;Similar to the previous panels, we create an order book panel, add another UserControl to the XAML folder. We call it MarketDepthControl. &lt;br /&gt;In MainWindow we have already used LayoutControl, in this control we will also use LayoutControl. We split the panel into two parts horizontally.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108051/image1678.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108051/image1678.png?size=800x800" alt="image1678.png" title="image1678.png" /&gt;&lt;/a&gt;&lt;br /&gt;We add SecurityPicker to the left side, we use it when we created the security panel.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108052/image7627.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108052/image7627.png?size=800x800" alt="image7627.png" title="image7627.png" /&gt;&lt;/a&gt;&lt;br /&gt;Let&amp;#39;s split the right part into vertical parts. There will be an order book on the top right.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108053/image1159.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108053/image1159.png?size=800x800" alt="image1159.png" title="image1159.png" /&gt;&lt;/a&gt;&lt;br /&gt;In MarketDepthControl, we need to set some MaxHeight value, otherwise the application will not start.&lt;br /&gt;Below the order book we will place the elements of specifying a portfolio, price, and order volume.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108054/image8282.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108054/image8282.png?size=800x800" alt="image8282.png" title="image8282.png" /&gt;&lt;/a&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108055/image4967.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108055/image4967.png?size=800x800" alt="image4967.png" title="image4967.png" /&gt;&lt;/a&gt;&lt;br /&gt;Even below, we will place the buttons to buy, sell.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108056/image62.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108056/image62.png?size=800x800" alt="image62.png" title="image62.png" /&gt;&lt;/a&gt;&lt;br /&gt;Full code.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108057/image9810.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108057/image9810.png?size=800x800" alt="image9810.png" title="image9810.png" /&gt;&lt;/a&gt;&lt;br /&gt;In the MarketDepthControl constructor, we set the security source for SecurityPicker and the portfolio source for PortfolioComboBox, in our case it will be Connector.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108058/image651.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108058/image651.png?size=800x800" alt="image651.png" title="image651.png" /&gt;&lt;/a&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108059/image3667.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108059/image3667.png?size=800x800" alt="image3667.png" title="image3667.png" /&gt;&lt;/a&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108060/image4084.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108060/image4084.png?size=800x800" alt="image4084.png" title="image4084.png" /&gt;&lt;/a&gt;&lt;br /&gt;We add the created MarketDepthControl panel to the central part of MainWindow.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108061/image7347.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108061/image7347.png?size=800x800" alt="image7347.png" title="image7347.png" /&gt;&lt;/a&gt;&lt;br /&gt;At this stage, we can run the program and check the order book update operation.&lt;br /&gt;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.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108062/image7717.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108062/image7717.png?size=800x800" alt="image7717.png" title="image7717.png" /&gt;&lt;/a&gt;&lt;br /&gt;Both handlers differ only by the order direction. &lt;br /&gt;Let&amp;#39;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&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108063/image90.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108063/image90.png?size=800x800" alt="image90.png" title="image90.png" /&gt;&lt;/a&gt;&lt;br /&gt;We run the program to check.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108064/image8902.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108064/image8902.png?size=800x800" alt="image8902.png" title="image8902.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Saving Market Data&lt;/h2&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108065/image7322.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108065/image7322.png?size=800x800" alt="image7322.png" title="image7322.png" /&gt;&lt;/a&gt;&lt;br /&gt;To save candles, trades, etc., we will need StorageRegistry.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108066/image809.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108066/image809.png?size=800x800" alt="image809.png" title="image809.png" /&gt;&lt;/a&gt;&lt;br /&gt;We will also need the SnapshotRegistry snapshot storages registry.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108067/image4003.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108067/image4003.png?size=800x800" alt="image4003.png" title="image4003.png" /&gt;&lt;/a&gt;&lt;br /&gt;All this we pass to Connector when it is created.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108068/image6704.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108068/image6704.png?size=800x800" alt="image6704.png" title="image6704.png" /&gt;&lt;/a&gt;&lt;br /&gt;Here I also specified that Connector will reconnect when the connection is broken, and also specified how many history days should be downloaded.&lt;br /&gt;The Connector.LookupAll(); string queries the available data.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108069/image6016.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108069/image6016.png?size=800x800" alt="image6016.png" title="image6016.png" /&gt;&lt;/a&gt;&lt;br /&gt;After starting the application, we will see that new folders have appeared in the Date folder.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108070/image7577.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108070/image7577.png?size=800x800" alt="image7577.png" title="image7577.png" /&gt;&lt;/a&gt;&lt;br /&gt;And when reconnecting the security and portfolio panels will already be filled.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Creating Strategy Panel&lt;/h2&gt;&lt;br /&gt;I will create the strategy panel just like all previous panels.&lt;br /&gt;We add another UserControl to the XAML folder. We call it StrategyControl. We split the screen form into two parts using the LayoutControl.&lt;br /&gt;There will be a tab with a candle chart on the left side.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108071/image344.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108071/image344.png?size=800x800" alt="image344.png" title="image344.png" /&gt;&lt;/a&gt;&lt;br /&gt;As well as a tab with strategy statistics, &lt;br /&gt;&lt;a href='https://stocksharp.com/file/108072/image4907.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108072/image4907.png?size=800x800" alt="image4907.png" title="image4907.png" /&gt;&lt;/a&gt;&lt;br /&gt;Here I use StatisticParameterGrid to display strategy statistics and EquityCurveChart to display profit and loss chart.&lt;br /&gt;In StatisticParameterGrid, we need to set some MaxHeight value, otherwise the application will not start.&lt;br /&gt;The strategy properties in PropertyGridEx will be configured on the right side.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108073/image721.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108073/image721.png?size=800x800" alt="image721.png" title="image721.png" /&gt;&lt;/a&gt;&lt;br /&gt;As well as strategy start and stop buttons.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108074/image1047.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108074/image1047.png?size=800x800" alt="image1047.png" title="image1047.png" /&gt;&lt;/a&gt;&lt;br /&gt;Full code.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108075/image2510.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108075/image2510.png?size=800x800" alt="image2510.png" title="image2510.png" /&gt;&lt;/a&gt;&lt;br /&gt;In the StrategyControl constructor, we set Connector as a data source for PropertyGridEx, we carried out similar actions in almost every control.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108076/image8773.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108076/image8773.png?size=800x800" alt="image8773.png" title="image8773.png" /&gt;&lt;/a&gt;&lt;br /&gt;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.&lt;br /&gt;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.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108077/image8230.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108077/image8230.png?size=800x800" alt="image8230.png" title="image8230.png" /&gt;&lt;/a&gt;&lt;br /&gt;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&amp;#39;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.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108078/image6360.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108078/image6360.png?size=800x800" alt="image6360.png" title="image6360.png" /&gt;&lt;/a&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108079/image3106.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108079/image3106.png?size=800x800" alt="image3106.png" title="image3106.png" /&gt;&lt;/a&gt;&lt;br /&gt;Full method code.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108080/image2024.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108080/image2024.png?size=800x800" alt="image2024.png" title="image2024.png" /&gt;&lt;/a&gt;&lt;br /&gt;We will call this method in the Start button click event handler. And also we will reset the strategy state and run it.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108081/image3375.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108081/image3375.png?size=800x800" alt="image3375.png" title="image3375.png" /&gt;&lt;/a&gt;&lt;br /&gt;We will stop the strategy in the Stop button click event handler.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108082/image3399.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108082/image3399.png?size=800x800" alt="image3399.png" title="image3399.png" /&gt;&lt;/a&gt;&lt;br /&gt;We add the created StrategyControl panel to the central part of MainWindow.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108083/image8678.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108083/image8678.png?size=800x800" alt="image8678.png" title="image8678.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Creating Strategy&lt;/h2&gt;&lt;br /&gt;For example, let&amp;#39;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).&lt;br /&gt;Let&amp;#39;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.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108084/image1577.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108084/image1577.png?size=800x800" alt="image1577.png" title="image1577.png" /&gt;&lt;/a&gt;&lt;br /&gt;Since our strategy uses candles, we will create a public property CandleSeries, and set its default value in our strategy constructor.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108085/image442.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108085/image442.png?size=800x800" alt="image442.png" title="image442.png" /&gt;&lt;/a&gt;&lt;br /&gt;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.&lt;br /&gt;Since we made the CandleSeries a public property, the CandleSeries can be additionally configured from the PropertyGridEx described in the previous paragraph.&lt;br /&gt;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.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108086/image6026.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108086/image6026.png?size=800x800" alt="image6026.png" title="image6026.png" /&gt;&lt;/a&gt;&lt;br /&gt;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.&lt;br /&gt;In our case, the ProcessCandle method contains the main strategy logic.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108087/image3324.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108087/image3324.png?size=800x800" alt="image3324.png" title="image3324.png" /&gt;&lt;/a&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108088/image2732.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108088/image2732.png?size=800x800" alt="image2732.png" title="image2732.png" /&gt;&lt;/a&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108089/image4474.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108089/image4474.png?size=800x800" alt="image4474.png" title="image4474.png" /&gt;&lt;/a&gt;&lt;br /&gt;We do opposite actions for a falling candle.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108090/image5127.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108090/image5127.png?size=800x800" alt="image5127.png" title="image5127.png" /&gt;&lt;/a&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108091/image374.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108091/image374.png?size=800x800" alt="image374.png" title="image374.png" /&gt;&lt;/a&gt;&lt;br /&gt;We run the program to check.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108092/image9399.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108092/image9399.png?size=800x800" alt="image9399.png" title="image9399.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108093/image5010.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108093/image5010.png?size=800x800" alt="image5010.png" title="image5010.png" /&gt;&lt;/a&gt;&lt;br /&gt;The strategy works, trades are made, but there are no candles and trades on the chart yet.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Adding Candles and Trades to Chart from Strategy&lt;/h2&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108094/image5547.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108094/image5547.png?size=800x800" alt="image5547.png" title="image5547.png" /&gt;&lt;/a&gt;&lt;br /&gt;InitChart chart initialization method.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108095/image977.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108095/image977.png?size=800x800" alt="image977.png" title="image977.png" /&gt;&lt;/a&gt;&lt;br /&gt;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.&lt;br /&gt;The chart.GuiSync(()=&amp;gt;{ ... }); construct is necessary in order to initialize the chart in the main thread.&lt;br /&gt;CandleSeriesProcessing is a method for drawing candles on a chart.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108096/image9921.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108096/image9921.png?size=800x800" alt="image9921.png" title="image9921.png" /&gt;&lt;/a&gt;&lt;br /&gt;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.&lt;br /&gt;We perform similar actions for trades.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108097/image4611.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108097/image4611.png?size=800x800" alt="image4611.png" title="image4611.png" /&gt;&lt;/a&gt;&lt;br /&gt;We run the program to check.&lt;br /&gt;&lt;a href='https://stocksharp.com/file/108098/image944.png' class='lightview' data-lightview-options="skin: 'mac'" data-lightview-group='mixed'&gt;&lt;img src="https://stocksharp.com/file/108098/image944.png?size=800x800" alt="image944.png" title="image944.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Short conclusion&lt;/h2&gt;&lt;br /&gt;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.&lt;br /&gt;Do not be afraid to try and create your own programs. I hope this paper will help you get used to this business.&lt;br /&gt;&lt;br /&gt;</content>
  </entry>
</feed>