{"id":1705,"date":"2019-10-24T11:21:49","date_gmt":"2019-10-24T08:21:49","guid":{"rendered":"https:\/\/roboforex.com/blog\/?p=1705"},"modified":"2026-05-26T10:51:52","modified_gmt":"2026-05-26T07:51:52","slug":"creating-expert-advisor-in-r-trader-from-scratch-practical-advice","status":"publish","type":"post","link":"https:\/\/roboforex.com/blog\/blog\/2019\/10\/24\/creating-expert-advisor-in-r-trader-from-scratch-practical-advice\/","title":{"rendered":"Creating Expert Advisor in R StocksTrader from Scratch: Practical Advice"},"content":{"rendered":"<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/REC-html40\/loose.dtd\">\n<html><body><p><a href=\"https:\/\/roboforex.com/blog\/blog\/2019\/02\/22\/trading-trading-what-is-trading\/\">Trading <\/a>on a currency or stock market requires a set of rules to comply with &mdash; this is the only way to success. Even long-term investing includes following certain rules, which regulate the choice of the asset and calculation of the term of the investment.<a name=\"1\"><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"0-trading-systems\"><span class=\"ez-toc-section\" id=\"Trading_systems\"><\/span>Trading systems<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Such a set of rules may be called a trading system. The latter may be based on either the <a href=\"https:\/\/roboforex.com/blog\/blog\/2019\/08\/20\/basics-of-technical-analysis\/\">technical analysis<\/a> or <a href=\"https:\/\/roboforex.com/blog\/blog\/2019\/07\/18\/the-basics-of-fundamental-analysis\/\">fundamental analysis<\/a>.<\/p>\n\n\n\n<p><a href=\"https:\/\/roboforex.com/blog\/blog\/2019\/08\/20\/basics-of-technical-analysis\/\" data-internallinksmanager029f6b8e52c=\"64\" title=\"Tech analysis\">Tech analysis<\/a> implies an analysis of the chart of an instrument. It is carried out with the help of various <a href=\"https:\/\/roboforex.com/blog\/blog\/2019\/11\/19\/top-10-forex-indicators-that-every-trader-needs\/\" data-internallinksmanager029f6b8e52c=\"99\" title=\"Indicators\">indicators<\/a> or well-known price <a href=\"https:\/\/roboforex.com/blog\/blog\/2019\/08\/05\/trading-the-most-popular-patterns\/\" data-internallinksmanager029f6b8e52c=\"60\" title=\"Patterns\">patterns<\/a>.<\/p>\n\n\n\n<p><a href=\"https:\/\/roboforex.com/blog\/blog\/2019\/07\/18\/the-basics-of-fundamental-analysis\/\" data-internallinksmanager029f6b8e52c=\"57\" title=\"Fundamental analysis\">Fundamental analysis<\/a> includes analyzing news, insider information, statistics, etc., which helps imagine the current dynamics and forecasts further price movement.<a name=\"2\"><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"1-trading-robots\"><span class=\"ez-toc-section\" id=\"Trading_robots\"><\/span>Trading robots<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>When the trader makes up their mind about the type of analysis most suitable for them, they start trading. With time, their trading nears perfection, becoming their daily routine. And then, the trader decides to automatize their strategy.<\/p>\n\n\n\n<p>Fundamental analysis is rather hard to automatize; this requires programming skills to create robots that can \"read and analyze\" the news. Some experience of working with artificial intelligence is even better. So, the number of such traders is rather limited while the efficacy of such systems is no higher than of those based on tech analysis.<\/p>\n\n\n\n<p>A trading system based on technical analysis is much easier to automatize. If it consists of indicators, it is enough to know the programming language of the trader's platform.<\/p>\n\n\n\n<p>For example, on <a href=\"https:\/\/roboforex.com/blog\/blog\/2019\/03\/05\/what-is-forex\/\">Forex <\/a>the most popular platform is <a href=\"https:\/\/roboforex.com/blog\/blog\/2019\/07\/01\/how-to-use-metatrader-4-mt4\/\">MetaTrader 4<\/a>. To write a trading robot for this platform, the MQL4 programming language is necessary, i.e. you need to study a programming language.<a name=\"3\"><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"2-where-can-you-create-a-robot-without-programming-skills\"><span class=\"ez-toc-section\" id=\"Where_can_you_create_a_robot_without_programming_skills\"><\/span>Where can you create a robot without programming skills?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Markets are developing, and new opportunities for automatizing trading systems appear.<\/p>\n\n\n\n<p>A great option for creating a trading robot for those who do not know any programming language will be a <a href=\"https:\/\/roboforex.com/blog\/blog\/2019\/02\/20\/why-r-trader-multi-asset-platform-is-a-real-blast\/\">multi-market platform R StocksTrader<\/a>. It has a built-in simple and intuitively understandable strategy constructor. It is meant for automatizing your trading system if you have no programming skills. All you need is a moderate experience in trading so that you understood what is a closing\/opening price and the minimal\/maximal price of the <a href=\"https:\/\/roboforex.com/blog\/blog\/2019\/09\/06\/candlestick-analysis-on-forex-main-principles-application-options\/\">candlestick <\/a>you are interested in.<a name=\"4\"><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"3-description-of-the-trading-system\"><span class=\"ez-toc-section\" id=\"Description_of_the_trading_system\"><\/span>Description of the trading system<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>I will try to answer all of your possible questions by showing you how to create a trading robot on <a href=\"https:\/\/roboforex.com\/forex-trading\/platforms\/stock-market\/\" data-internallinksmanager029f6b8e52c=\"47\" title=\"R StocksTrader\">R StocksTrader<\/a> on the example of a very simple trading system consisting of two indicators.<\/p>\n\n\n\n<p>The first and the most important thing you will need at the start is a trading system. It must have clear rules of opening buy and sell positions. To avoid mistakes, you should draw all the indicators on the chart.<\/p>\n\n\n\n<p>In our case, opening a Buy position will look like this:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/1-us500-m5.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"608\" src=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/1-us500-m5-1200x608.png\" alt=\"Description of the trading system in R StocksTrader\" class=\"wp-image-1706\" srcset=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/1-us500-m5-1200x608.png 1200w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/1-us500-m5-360x182.png 360w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/1-us500-m5-768x389.png 768w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/1-us500-m5.png 1471w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/a><\/figure>\n\n\n\n<p>1. <a href=\"https:\/\/roboforex.com/blog\/blog\/2019\/08\/27\/what-is-a-moving-average\/\">Moving Average<\/a> (EMA) &mdash; 200, Close, 0 &mdash; less than the closing price of the current candlestick.<\/p>\n\n\n\n<p>2. The lower border of the <a href=\"https:\/\/roboforex.com/blog\/blog\/2019\/08\/09\/bollinger-bands-indicator-description\/\">Bollinger Bands<\/a> Low (20, Close, 2, 0) is above the minimum price of the current candlestick.<\/p>\n\n\n\n<p>If these two conditions are fulfilled, then a Buy position is opened.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/2-us500-m5.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"605\" src=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/2-us500-m5-1200x605.png\" alt=\"Description of the trading system in R StocksTrader\" class=\"wp-image-1707\" srcset=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/2-us500-m5-1200x605.png 1200w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/2-us500-m5-360x181.png 360w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/2-us500-m5-768x387.png 768w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/2-us500-m5.png 1466w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/a><\/figure>\n\n\n\n<p>Now let us describe the conditions for closing the Buy position.<\/p>\n\n\n\n<p>1. The upper border of the <a href=\"https:\/\/roboforex.com/blog\/blog\/2019\/08\/09\/bollinger-bands-indicator-description\/\" data-internallinksmanager029f6b8e52c=\"62\" title=\"Bollinger Bands\">Bollinger Bands<\/a> High (20, Close, 2, 0) is below the maximum price of the current candlestick.<\/p>\n\n\n\n<p>2. <a href=\"https:\/\/roboforex.com/blog\/blog\/2019\/08\/27\/what-is-a-moving-average\/\" data-internallinksmanager029f6b8e52c=\"68\" title=\"Moving Average\">Moving Average<\/a> (EMA) &mdash; 200, Close, 0 is above the closing price of the current candlestick.<a name=\"5\"><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"4-creating-a-trading-robot\"><span class=\"ez-toc-section\" id=\"Creating_a_trading_robot\"><\/span>Creating a trading robot<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>I have shown you how to describe an entrance point for a Buy. Now we need to transfer it to the R StocksTrader platform.<\/p>\n\n\n\n<p>We log in the platform and click \"Strategies\" &mdash; \"My Strategies\", then click \"Add new strategy\".<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/4-rtrader.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1050\" height=\"630\" src=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/4-rtrader-1050x630.png\" alt=\"Creating a trading robot in R StocksTrader\" class=\"wp-image-1708\" srcset=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/4-rtrader-1050x630.png 1050w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/4-rtrader-333x200.png 333w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/4-rtrader-768x461.png 768w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/4-rtrader.png 1198w\" sizes=\"(max-width: 1050px) 100vw, 1050px\" \/><\/a><\/figure>\n\n\n\n<p>Next step, you will need to invent a name for your strategy and describe it briefly.<\/p>\n\n\n\n<p>After these steps are complete, you get to the constructor itself, where you specify the parameters of your trading system.<\/p>\n\n\n\n<p>To start with, the constructor suggests setting up the condition for a Buy position. As long as we have described them above, it will be enough to just choose the corresponding parameters of the indicators and specify the conditions.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/5-rtrader.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"441\" src=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/5-rtrader-1200x441.png\" alt=\"Creating a trading robot in R StocksTrader\" class=\"wp-image-1709\" srcset=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/5-rtrader-1200x441.png 1200w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/5-rtrader-360x132.png 360w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/5-rtrader-768x282.png 768w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/5-rtrader.png 1469w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/a><\/figure>\n\n\n\n<p>Now, we need to specify the closing conditions described above.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/6-rtrader.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1124\" height=\"630\" src=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/6-rtrader-1124x630.png\" alt=\"Creating a trading robot in R StocksTrader\" class=\"wp-image-1710\" srcset=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/6-rtrader-1124x630.png 1124w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/6-rtrader-357x200.png 357w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/6-rtrader-768x430.png 768w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/6-rtrader.png 1567w\" sizes=\"(max-width: 1124px) 100vw, 1124px\" \/><\/a><\/figure>\n\n\n\n<p>Additionally, you can set up the <a href=\"https:\/\/roboforex.com/blog\/blog\/2019\/07\/12\/what-is-stop-loss-and-take-profit\/\">Stop Loss<\/a> and <a href=\"https:\/\/roboforex.com/blog\/blog\/2019\/07\/12\/what-is-stop-loss-and-take-profit\/\">Take Profit<\/a> values (close at SL and close at TP, respectively). If these values are specified, the position will be closed at the condition that is fulfilled first.<\/p>\n\n\n\n<p>So, we have formulated the necessary conditions for opening and closing a Buy. Now let us check whether this system will demonstrate good results.<\/p>\n\n\n\n<p>For this, choose your preferred instrument, choose a <a href=\"https:\/\/roboforex.com/blog\/blog\/2020\/05\/21\/how-to-choose-a-timeframe-for-trading\/\" data-internallinksmanager029f6b8e52c=\"135\" title=\"Timeframe\">timeframe<\/a>, \"<a href=\"https:\/\/roboforex.com/blog\/blog\/2021\/10\/28\/main-order-types-in-trading\/\" data-internallinksmanager029f6b8e52c=\"311\" title=\"Order\">Order<\/a> volume\", and click \"<a href=\"https:\/\/roboforex.com/blog\/blog\/2023\/03\/03\/how-to-test-a-trading-strategy\/\" data-internallinksmanager029f6b8e52c=\"296\" title=\"Test a strategy\">Backtest<\/a>\".<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/7-rtrader.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1137\" height=\"630\" src=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/7-rtrader-1137x630.png\" alt=\"Creating a trading robot in R StocksTrader\" class=\"wp-image-1711\" srcset=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/7-rtrader-1137x630.png 1137w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/7-rtrader-360x200.png 360w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/7-rtrader-768x426.png 768w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/7-rtrader.png 1575w\" sizes=\"(max-width: 1137px) 100vw, 1137px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"5-testing-the-trading-strategy-\"><span class=\"ez-toc-section\" id=\"Testing_the_trading_strategy\"><\/span>Testing the trading strategy<a name=\"6\"><\/a><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Testing is performed historically, the timeframe is picked up by the platform and depends on the number of testable quotations. Unfortunately, you cannot upload quotations for longer testing here.<\/p>\n\n\n\n<p>If we have done all right, the results of testing will appear.<\/p>\n\n\n\n<p>In our case, the strategy demonstrates a positive result with a profit of 1,304 USD. A negative result would have meant that the system needed reworking.<\/p>\n\n\n\n<p>In this tester, the starting deposit is not specified. The growth of profit starts from zero, so everything below zero can be considered a slump. This strategy showed a slump of 400 USD at the very beginning. Then all losses were covered by the money earned.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/8-rtrader.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1122\" height=\"630\" src=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/8-rtrader-1122x630.png\" alt=\"Testing the trading strategy in R StocksTrader\" class=\"wp-image-1712\" srcset=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/8-rtrader-1122x630.png 1122w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/8-rtrader-356x200.png 356w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/8-rtrader-768x431.png 768w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/8-rtrader.png 1565w\" sizes=\"(max-width: 1122px) 100vw, 1122px\" \/><\/a><\/figure>\n\n\n\n<p>However, this is not it, and the result can be enhanced by adding some more standard conditions. Go back to editing the strategy (click \"Editor\") and type 2 in \"Max open deals\".<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/9-rtrader.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1125\" height=\"630\" src=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/9-rtrader-1125x630.png\" alt=\"Testing the trading strategy in R StocksTrader\" class=\"wp-image-1713\" srcset=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/9-rtrader-1125x630.png 1125w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/9-rtrader-357x200.png 357w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/9-rtrader-768x430.png 768w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/9-rtrader.png 1572w\" sizes=\"(max-width: 1125px) 100vw, 1125px\" \/><\/a><\/figure>\n\n\n\n<p>By this, we allow the trading robot to open a second position even if the first one has not closed yet.<\/p>\n\n\n\n<p>\"Max open deals\" lets open new positions before the previous ones are closed. I must warn you that in this particular strategy the parameter works incorrectly. The conditions are checked on every tick, and in one minute a whole load of positions may be opened.<\/p>\n\n\n\n<p>To avoid such a situation but still be able to open a new position at a better price, we can use the \"Enter every 0 ticks above last entry\" function. It allows opening a new position a certain number of points above\/below the previous one. Instead of zero, type in the necessary number of points.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/11-rtrader.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1127\" height=\"630\" src=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/11-rtrader-1127x630.png\" alt=\"Testing the trading strategy in R StocksTrader\" class=\"wp-image-1714\" srcset=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/11-rtrader-1127x630.png 1127w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/11-rtrader-358x200.png 358w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/11-rtrader-768x429.png 768w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/11-rtrader.png 1488w\" sizes=\"(max-width: 1127px) 100vw, 1127px\" \/><\/a><\/figure>\n\n\n\n<p>Additionally, in \"Multiplicator\" we type 2, by which we tell the robot to make the volume of the second position 2 times bigger than that of the first one.<\/p>\n\n\n\n<p>\"Multiplicator\" multiplies the volume of the previous order by the value specified in it. Click \"Backtest\" and check the new results.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/12-rtrader.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1131\" height=\"630\" src=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/12-rtrader-1131x630.png\" alt=\"Testing the trading strategy in R StocksTrader\" class=\"wp-image-1715\" srcset=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/12-rtrader-1131x630.png 1131w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/12-rtrader-360x200.png 360w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/12-rtrader-768x428.png 768w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/12-rtrader.png 1575w\" sizes=\"(max-width: 1131px) 100vw, 1131px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"6-launching-the-trading-robot-\"><span class=\"ez-toc-section\" id=\"Launching_the_trading_robot\"><\/span>Launching the trading robot<a name=\"7\"><\/a><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>If we are satisfied with the result, we only have to launch the strategy.<\/p>\n\n\n\n<p>To do it, click \"Enable\"; a window will appear. In it, you should specify the volume of the opening position and the TP and SL in the USD, if desired. If the two last boxes are left blank, the positions will be closed at the conditions implied by the strategy.<\/p>\n\n\n\n<p>The choice of the instrument is performed automatically. In our case, the program will choose the instrument the chart of which is currently on the screen. This is US500.<\/p>\n\n\n\n<p>After the launch of the strategy, we can check the name and all the information (such as the time of launching, the instrument, the timeframe, the profit, etc.) about it in \"Running Strategies\".<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/13-rtrader.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1155\" height=\"630\" src=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/13-rtrader-1155x630.png\" alt=\"Launching the trading robot in R StocksTrader\" class=\"wp-image-1716\" srcset=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/13-rtrader-1155x630.png 1155w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/13-rtrader-360x196.png 360w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/13-rtrader-768x419.png 768w, https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/13-rtrader.png 1573w\" sizes=\"(max-width: 1155px) 100vw, 1155px\" \/><\/a><\/figure>\n\n\n\n<p>Same way, we can launch the strategy on any instrument that it shows a positive result. However, you will have to calculate the volume of the trade for each instrument to avoid exceeding risk limits on the deposit as the simultaneous closing of all positions on the account with a loss can cause serious damage to the deposit.<\/p>\n\n\n\n<p>To delete the strategy, it is enough to click the cross at the end of the line.<\/p>\n\n\n\n<p>With R StocksTrader, unlike <a href=\"https:\/\/roboforex.com\/forex-trading\/platforms\/metatrader4-mt4\/\" data-internallinksmanager029f6b8e52c=\"9\" title=\"metatrader 4\">MetaTrader 4<\/a> and <a href=\"https:\/\/roboforex.com/blog\/blog\/2019\/07\/11\/how-to-trade-in-metatrader-5\/\">MetaTrader 5<\/a>, there is no need to keep your computer on all the time for the robot to trade. Neither do you need a <a href=\"https:\/\/roboforex.com/blog\/blog\/2019\/07\/17\/what-do-we-need-vps-for\/\">VPS<\/a>. You only need to launch the robot on the platform, and then it starts trading on the server automatically.<\/p>\n\n\n\n<p>While trading, you can close the positions manually and alter both the order and the strategy itself. You can put the <a href=\"https:\/\/roboforex.com\/beginners\/info\/expert-advisors\/\" data-internallinksmanager029f6b8e52c=\"21\" title=\"expert advisors\">expert advisor<\/a> on a halt or simply delete it if your results are worsening.<\/p>\n\n\n\n<p>Yet another advantage of the trading robots on R StocksTrader is the vast selection of instruments, including the <a href=\"https:\/\/roboforex.com\/forex-trading\/assets\/stocks\/\" data-internallinksmanager029f6b8e52c=\"10\" title=\"invest in stocks\">stocks<\/a> traded on European and American exchanges and currency pairs. Thus you can try one robot on several markets, otherwise, you would have had to create a separate robot for each platform and study programming languages, which is time-consuming.<a name=\"8\"><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"7-summary\"><span class=\"ez-toc-section\" id=\"Summary\"><\/span>Summary<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Now you see that anyone can create their trading robot. A platform features standard trading strategies, all of them having their work conditions transparent. In our case, you can enhance them according to your ideas and find the best instruments for them.<\/p>\n\n\n\n<p>All you need is a strong desire to progress in trading and use all the opportunities for making a profit on <a href=\"https:\/\/roboforex.com/blog\/blog\/2019\/02\/19\/financial-market-players-who-are-they\/\">financial markets<\/a>. One such opportunity is discussed in this very article.<\/p>\n\n\n\n<p class=\"wp-block-button aligncenter\">\n<a class=\"button button-green\" href=\"https:\/\/my.roboforex.com\/en\/register\/\" rel=\"nofollow\">Open Trading Account<\/a><\/p>\n<\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>Trading on a currency or stock market requires a set of rules to comply with \u2014 this is the only way to success. Even long-term investing includes following certain rules, which regulate the choice of the asset and calculation of the term of the investment.<\/p>\n","protected":false},"author":22,"featured_media":1717,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[29],"tags":[249,19,250],"class_list":["post-1705","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-education","tag-expert-advisor-mt4","tag-r-stockstrader-trading-platform","tag-trading-robot"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Creating Expert Advisor in R StocksTrader from Scratch: Practical Advice - R Blog - RoboForex<\/title>\n<meta name=\"description\" content=\"Trading on a currency or stock market requires a set of rules to comply with \u2014 this is the only way to success. Even long-term investing includes following\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/roboforex.com/blog\/blog\/2019\/10\/24\/creating-expert-advisor-in-r-trader-from-scratch-practical-advice\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Creating Expert Advisor in R StocksTrader from Scratch: Practical Advice - R Blog - RoboForex\" \/>\n<meta property=\"og:description\" content=\"Trading on a currency or stock market requires a set of rules to comply with \u2014 this is the only way to success. Even long-term investing includes following\" \/>\n<meta property=\"og:url\" content=\"https:\/\/roboforex.com/blog\/blog\/2019\/10\/24\/creating-expert-advisor-in-r-trader-from-scratch-practical-advice\/\" \/>\n<meta property=\"og:site_name\" content=\"R Blog - RoboForex\" \/>\n<meta property=\"og:image\" content=\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/trading-robot-guide.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1160\" \/>\n\t<meta property=\"og:image:height\" content=\"500\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Eugene Savitsky\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/roboforex.com/blog\/blog\/2019\/10\/24\/creating-expert-advisor-in-r-trader-from-scratch-practical-advice\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/roboforex.com/blog\/blog\/2019\/10\/24\/creating-expert-advisor-in-r-trader-from-scratch-practical-advice\/\"},\"headline\":\"Creating Expert Advisor in R StocksTrader from Scratch: Practical Advice\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/roboforex.com/blog\/blog\/2019\/10\/24\/creating-expert-advisor-in-r-trader-from-scratch-practical-advice\/\"},\"wordCount\":1497,\"commentCount\":5,\"publisher\":{\"@id\":\"https:\/\/roboforex.com/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/roboforex.com/blog\/blog\/2019\/10\/24\/creating-expert-advisor-in-r-trader-from-scratch-practical-advice\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/trading-robot-guide.png\",\"keywords\":[\"expert advisor mt4\",\"r stockstrader trading platform\",\"trading robot\"],\"articleSection\":[\"Education\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/roboforex.com/blog\/blog\/2019\/10\/24\/creating-expert-advisor-in-r-trader-from-scratch-practical-advice\/\",\"url\":\"https:\/\/roboforex.com/blog\/blog\/2019\/10\/24\/creating-expert-advisor-in-r-trader-from-scratch-practical-advice\/\",\"name\":\"Creating Expert Advisor in R StocksTrader from Scratch: Practical Advice - R Blog - RoboForex\",\"isPartOf\":{\"@id\":\"https:\/\/roboforex.com/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/roboforex.com/blog\/blog\/2019\/10\/24\/creating-expert-advisor-in-r-trader-from-scratch-practical-advice\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/roboforex.com/blog\/blog\/2019\/10\/24\/creating-expert-advisor-in-r-trader-from-scratch-practical-advice\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/trading-robot-guide.png\",\"description\":\"Trading on a currency or stock market requires a set of rules to comply with \u2014 this is the only way to success. Even long-term investing includes following\",\"breadcrumb\":{\"@id\":\"https:\/\/roboforex.com/blog\/blog\/2019\/10\/24\/creating-expert-advisor-in-r-trader-from-scratch-practical-advice\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/roboforex.com/blog\/blog\/2019\/10\/24\/creating-expert-advisor-in-r-trader-from-scratch-practical-advice\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/roboforex.com/blog\/blog\/2019\/10\/24\/creating-expert-advisor-in-r-trader-from-scratch-practical-advice\/#primaryimage\",\"url\":\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/trading-robot-guide.png\",\"contentUrl\":\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/trading-robot-guide.png\",\"width\":1160,\"height\":500,\"caption\":\"Creating Expert Advisor in R Trader From Scratch: Practical Advice\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/roboforex.com/blog\/blog\/2019\/10\/24\/creating-expert-advisor-in-r-trader-from-scratch-practical-advice\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Main\",\"item\":\"https:\/\/roboforex.com/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Expert Advisors\",\"item\":\"https:\/\/roboforex.com/blog\/blog\/category\/expert-advisors\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Creating Expert Advisor in R StocksTrader from Scratch: Practical Advice\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/roboforex.com/blog\/#website\",\"url\":\"https:\/\/roboforex.com/blog\/\",\"name\":\"R Blog - RoboForex\",\"description\":\"RoboForex Blog for Traders: Trading News, Analysis, Forecasts - Forex and Stocks | R Blog\",\"publisher\":{\"@id\":\"https:\/\/roboforex.com/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/roboforex.com/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/roboforex.com/blog\/#organization\",\"name\":\"RoboForex Ltd\",\"url\":\"https:\/\/roboforex.com/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/roboforex.com/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2018\/10\/rf-logo_square.png\",\"contentUrl\":\"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2018\/10\/rf-logo_square.png\",\"width\":512,\"height\":512,\"caption\":\"RoboForex Ltd\"},\"image\":{\"@id\":\"https:\/\/roboforex.com/blog\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Creating Expert Advisor in R StocksTrader from Scratch: Practical Advice - R Blog - RoboForex","description":"Trading on a currency or stock market requires a set of rules to comply with \u2014 this is the only way to success. Even long-term investing includes following","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/roboforex.com/blog\/blog\/2019\/10\/24\/creating-expert-advisor-in-r-trader-from-scratch-practical-advice\/","og_locale":"en_US","og_type":"article","og_title":"Creating Expert Advisor in R StocksTrader from Scratch: Practical Advice - R Blog - RoboForex","og_description":"Trading on a currency or stock market requires a set of rules to comply with \u2014 this is the only way to success. Even long-term investing includes following","og_url":"https:\/\/roboforex.com/blog\/blog\/2019\/10\/24\/creating-expert-advisor-in-r-trader-from-scratch-practical-advice\/","og_site_name":"R Blog - RoboForex","og_image":[{"width":1160,"height":500,"url":"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/trading-robot-guide.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_misc":{"Written by":"Eugene Savitsky","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/roboforex.com/blog\/blog\/2019\/10\/24\/creating-expert-advisor-in-r-trader-from-scratch-practical-advice\/#article","isPartOf":{"@id":"https:\/\/roboforex.com/blog\/blog\/2019\/10\/24\/creating-expert-advisor-in-r-trader-from-scratch-practical-advice\/"},"headline":"Creating Expert Advisor in R StocksTrader from Scratch: Practical Advice","mainEntityOfPage":{"@id":"https:\/\/roboforex.com/blog\/blog\/2019\/10\/24\/creating-expert-advisor-in-r-trader-from-scratch-practical-advice\/"},"wordCount":1497,"commentCount":5,"publisher":{"@id":"https:\/\/roboforex.com/blog\/#organization"},"image":{"@id":"https:\/\/roboforex.com/blog\/blog\/2019\/10\/24\/creating-expert-advisor-in-r-trader-from-scratch-practical-advice\/#primaryimage"},"thumbnailUrl":"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/trading-robot-guide.png","keywords":["expert advisor mt4","r stockstrader trading platform","trading robot"],"articleSection":["Education"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/roboforex.com/blog\/blog\/2019\/10\/24\/creating-expert-advisor-in-r-trader-from-scratch-practical-advice\/","url":"https:\/\/roboforex.com/blog\/blog\/2019\/10\/24\/creating-expert-advisor-in-r-trader-from-scratch-practical-advice\/","name":"Creating Expert Advisor in R StocksTrader from Scratch: Practical Advice - R Blog - RoboForex","isPartOf":{"@id":"https:\/\/roboforex.com/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/roboforex.com/blog\/blog\/2019\/10\/24\/creating-expert-advisor-in-r-trader-from-scratch-practical-advice\/#primaryimage"},"image":{"@id":"https:\/\/roboforex.com/blog\/blog\/2019\/10\/24\/creating-expert-advisor-in-r-trader-from-scratch-practical-advice\/#primaryimage"},"thumbnailUrl":"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/trading-robot-guide.png","description":"Trading on a currency or stock market requires a set of rules to comply with \u2014 this is the only way to success. Even long-term investing includes following","breadcrumb":{"@id":"https:\/\/roboforex.com/blog\/blog\/2019\/10\/24\/creating-expert-advisor-in-r-trader-from-scratch-practical-advice\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/roboforex.com/blog\/blog\/2019\/10\/24\/creating-expert-advisor-in-r-trader-from-scratch-practical-advice\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/roboforex.com/blog\/blog\/2019\/10\/24\/creating-expert-advisor-in-r-trader-from-scratch-practical-advice\/#primaryimage","url":"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/trading-robot-guide.png","contentUrl":"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/trading-robot-guide.png","width":1160,"height":500,"caption":"Creating Expert Advisor in R Trader From Scratch: Practical Advice"},{"@type":"BreadcrumbList","@id":"https:\/\/roboforex.com/blog\/blog\/2019\/10\/24\/creating-expert-advisor-in-r-trader-from-scratch-practical-advice\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Main","item":"https:\/\/roboforex.com/blog\/"},{"@type":"ListItem","position":2,"name":"Expert Advisors","item":"https:\/\/roboforex.com/blog\/blog\/category\/expert-advisors\/"},{"@type":"ListItem","position":3,"name":"Creating Expert Advisor in R StocksTrader from Scratch: Practical Advice"}]},{"@type":"WebSite","@id":"https:\/\/roboforex.com/blog\/#website","url":"https:\/\/roboforex.com/blog\/","name":"R Blog - RoboForex","description":"RoboForex Blog for Traders: Trading News, Analysis, Forecasts - Forex and Stocks | R Blog","publisher":{"@id":"https:\/\/roboforex.com/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/roboforex.com/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/roboforex.com/blog\/#organization","name":"RoboForex Ltd","url":"https:\/\/roboforex.com/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/roboforex.com/blog\/#\/schema\/logo\/image\/","url":"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2018\/10\/rf-logo_square.png","contentUrl":"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2018\/10\/rf-logo_square.png","width":512,"height":512,"caption":"RoboForex Ltd"},"image":{"@id":"https:\/\/roboforex.com/blog\/#\/schema\/logo\/image\/"}}]}},"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/roboforex.com/blog\/wp-content\/uploads\/2019\/10\/trading-robot-guide.png","views":{"total":795,"cached_at":1628511319},"_links":{"self":[{"href":"https:\/\/roboforex.com/blog\/wp-json\/wp\/v2\/posts\/1705"}],"collection":[{"href":"https:\/\/roboforex.com/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/roboforex.com/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/roboforex.com/blog\/wp-json\/wp\/v2\/users\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/roboforex.com/blog\/wp-json\/wp\/v2\/comments?post=1705"}],"version-history":[{"count":6,"href":"https:\/\/roboforex.com/blog\/wp-json\/wp\/v2\/posts\/1705\/revisions"}],"predecessor-version":[{"id":7378,"href":"https:\/\/roboforex.com/blog\/wp-json\/wp\/v2\/posts\/1705\/revisions\/7378"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/roboforex.com/blog\/wp-json\/wp\/v2\/media\/1717"}],"wp:attachment":[{"href":"https:\/\/roboforex.com/blog\/wp-json\/wp\/v2\/media?parent=1705"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/roboforex.com/blog\/wp-json\/wp\/v2\/categories?post=1705"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/roboforex.com/blog\/wp-json\/wp\/v2\/tags?post=1705"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}