Trend Line Advisor. Forex scripts to simplify trading Script trading from horizontal lines

  • 16.05.2020

From the article you will learn:

My warm greetings to all readers and guests of the site. Today I’m talking about a very relevant topic - scripts. The script for opening orders and the script for setting pending orders will be a good example for us of how a systematic approach and the desire to transfer some functions to a computer in trading forces a trader to take the first step from manual trading to automatic trading. I'm talking about him starting to use scripts. On the other hand, an algorithmic trader will use scripts with the first one on an equal basis when his automatic system is under development.

Best broker

So, what exactly do I want to tell you today? The fact is that trading at the very beginning of its appearance was manual. And the transition to automatic systems came along with the evolution of computers. Accordingly, this evolutionary step is taken by many traders sooner or later. They are starting to use robots instead of manual strategies. At the same time, it is important to use a systematic approach; without this, this transitional step - the use of scripts - will not be relevant, because scripts are not a panacea. They cannot replace a complete trading system. It's just a tool in your arsenal.

In addition, traders who already use robots, due to the specifics of trading, also resort to the help of scripts. This is due to the fact that there are features of the terminal that, when used in depth, are only accessible through robots and scripts. This does not mean that anyone who wants to trade Forex cannot do so; on the contrary, trading is available to everyone. It’s just that the trading process, under the influence of evolution, is becoming more and more complicated, which means that traders are becoming more advanced. In general, scripts do not interfere, but help. So, about everything in more detail.

Advantages and disadvantages, why is all this needed?

What is the script for?

  1. There are constantly repeated operations that can be entrusted to a computer. Conditions arise under which it is necessary to open, close, change something, count, and so on. All this can be done semi-automatically using a script,
  2. Another good example is a script for opening orders. The fact is that most parts of trade orders can most often be changed using simple order windows. However, there is such a part of the order as a magic number; below I will talk about it in more detail. For now, I will say that this is a very important part of the order; it can only be changed using a robot or script. And if we started using the script for opening orders, then the comments can be edited, and so on.
  3. The script for setting pending orders will show us another side of using these programs. Increasing the speed of reaction to certain market situations is a very urgent task. Everyone would like to grab as much as possible in a volatile market. It is for these purposes that the script for setting pending orders is used, which I will talk about today.

However, what is the magic number and why is it so important? Imagine that you, like me, have more than seventy terminals open. You might think that only one robot can work on one terminal within one account. That is, seventy robots are trading quietly. What else do you need? But things may not be like that. In fact, the use of Magic number offers the use of an infinite number of robots on one account, even on the same pair. Of course, efficiency accounting changes a little, but overall nothing changes. And now imagine that there are 2-3 or more robots at each terminal. What results can be achieved? We can only guess. To you. And I’m enjoying what’s happening on my VPS with a grin, and I advise you: go for free, and I’ll share with you what I know.

Returning to our auxiliary programs, I want to emphasize: you will not be able to create a trading system if there is nothing in it except a script. This program is not a panacea or a grail. It just helps you perform some operations. He won't think for you. Therefore, it should be used only within the framework of an integrated trading system. Thus, the main disadvantage of scripts for opening orders, setting pending orders and all others is that manual labor is still needed. You make the decision to carry out the planned actions, and only you are responsible for the consequences of your actions. Of course, the result may be stunning, but the credit for this will be more yours than this auxiliary program.

I especially want to draw attention to the speed of script execution. Actions that may take you several tens of minutes are completed in a few seconds. This allows you to relieve yourself of some responsibility. Although it’s not entirely correct to say this, I’ll still take the risk. The fact is that you still take on your responsibility, but only at the moment when you look for a script and check its suitability for your trading system. When you fulfill it, there is no longer any talk of responsibility. By at least, on a conscious level. Somewhere in the subcortex, it remains. But, I believe, it will be much easier for you psychologically.

About the need for a system and examples

Watch a video about the script

I think you already understand that without a system there is nothing to do with this auxiliary program. Yes, he opens orders, does it completely automatically, but he does it completely without ideas. No, of course, it contains logic that you put into it at the moment of selecting or studying it. But at the moment of execution, nothing can stop him from doing what he must do. But market conditions can be both suitable for the operation of this auxiliary program, and completely harmful, not working at this moment. The moment you decide to launch it.

Download

That's why you need some more advanced idea than just a solution to run a script. Simply put, you should use it as part of some simple but workable manual strategy. Those who are ready to use it to correct the work of their advisor also need to understand that you need to launch it only when conditions have arisen under which your advisor should have responded, but did not react, or in another suitable situation.

The system does not make your actions the grail, but it brings them as close to it as your mind allows.

Let's look at a simple system for a script for setting pending orders, which you can download from this page, as well as a script for opening orders.

So, here we see the EURUSD pair, the M1 interval, as well as the indicator that showed the candle height required for entry. At the opening of the next one, we execute the script for placing pending orders at an effective distance previously checked on history and get two pending orders on two horizontal lines. We place stop losses on opposite sides. IN in this case Take profit need not be set. Since we have established through observations that on history, trades lasting 70 candles work well. On the right vertical line we exit both trades. As a result, we get an impressive profit-to-loss ratio of about 8 to 1, the second order did not even enter the market.

At the same time, you need to understand that if we had not gone through history and established the length of the candle after which it is advisable to enter, if we had not calculated that exactly this distance between orders gives, on average, a good mathematical expectation. If we had not calculated at what distance from the entry the orders would give a good profit, then we would not have been able to work according to the forecast. And this is how we get great deals. What am I talking about? Only a systematic approach coupled with the work of such auxiliary programs can give good result. No other approach other than a systematic one can produce a positive expected result. Don't forget that there are many similar tools. For example, here.

Semi-automatic trading system

"Line Trading".

Operating principle.

The "Line Trading" utility is designed to make the trader's work easier. Everything is very simple: using a special utility, we overlay a channel of 4 lines on the chart. Two lines will be needed for entry, the other two will be needed for exit. Then you can change the angle of inclination of each line, change the distances between them, etc. When the price reaches one of the entry lines, a buy or sell entry occurs. After this, when the price reaches one of the exit lines, the transaction will be fixed with a profit (take profit) or a loss (stop loss). In this way, price channel trading and other strategies can be easily organized.

  • Setting stop or limit orders based on custom lines (horizontal or trend);
  • User adjustment of the position of the lines after the advisor (robot) starts working;
  • Tracking opening and closing prices according to trend lines;
  • Calculating the risk of everyone open positions for the current instrument;
  • Risk calculation based on the percentage of the deposit set by the user;
  • Risk/Profit ratio calculation;
  • Calculation of channel width.

Installation and preparation for work.

1. Install the system in MetaTrader4, indicating the correct path.


2. Launch MetaTrader 4 (exit and log in again if MetaTrader 4 was downloaded before installing the add-ons).

3. Using the mouse pointer, drag the line drawing script LinesToChart onto the chart. A settings window will appear.

  • The settings are very simple. After drawing the lines on the chart, you can move them as you wish. Variables require clarification UpLowCorrection And UpperLowerPercent. UpperLowerPercent defines the distance as a percentage between the main and additional lines and is calculated as a given percentage of the channel width (see figure). UpLowCorrection in the disabled state (false) does not change the position of the channel lines Up/Low. Thus, we can apply the lines with a script for the first time, determine the channel lines, then apply the script again with UpLowCorrection = false, additional lines will be determined themselves in accordance with the selected UpperLowerPercent. There is one thing important rule: The lines must be in strict order, if you count from top to bottom, then the order is: Upper, Up, Low, Lower. Everything is described in the screenshot below.

  • After drawing the lines, you need to load the advisor. Drag the line trading advisor LinesToOrders onto the chart. A settings window will appear.
  • Here are also all the descriptions on the chart. Variable requires clarification TradeType(see pictures).

  • Now the utility is ready to work. Stops and opening prices will move according to the line. After receiving a new tick, the advisor will place two pending orders to buy and sell. You can change the position of the lines, change risks, and disable control of buy and sell positions.
  • System requirements.

      operating system Microsoft® Windows®98/2000/ XP/Vista/Windows 7

      Pentium® 4 2Ghz processor or higher

      terminal MetaTrader4 build 600 and higher

    An advisor for trading along trend lines opens signals to complete a transaction (order) if the price and trend line come into contact. Trading is carried out on a rebound basis. This means that when the price crosses the support line, a BUY order will be opened, and when the price contacts the resistance line, a SELL order will be opened.

    Interested in rebound trading? Choose the right robot and get started

    .

    The program simultaneously monitors two lines, which the trader configures manually. Having designated trend lines, the user needs to indicate their names, given in the expert settings. After opening an order, the advisor adds his comment to the trend line. Please note that if you do not delete this description, the program will not open an order at the right time.

    The advisor is suitable for online trading. On one currency pair More than one user can work if each one is assigned their own Magic_Number settings. To start working with the advisor, you need to set trend lines and name them in accordance with the Support_Line_Name and Resistance_Line_Name parameters. Please note that it is not necessary to use two lines at the same time. If one is missing, it will be accepted normally by the program and will not cause any failures.

    Do you want to download a robot for effective trading? Use our site

    Trend lines are considered the most convenient and effective method for determining the current trend in the Forex market. The tool is suitable for identifying advantageous points entry into trading, and due to the simplicity of the trend line, it is possible to take advantage of market reversals. To ensure that your trading activities are not accompanied by unnecessary difficulties, use trading advisors. This is a universal assistant that you can use when composing any currency pairs. To download it for free, our Forex portal is at your service. Here you will find a lot of useful thematic information and trading robots to simplify the automation of many processes. Waiting for you.

    If you are interested in using Fractals effectively, then it is worth considering using an advisor.

    Settings:

    Support_Line_Name ="SP" – Support line name
    Resistance_Line_Name = "RS" – Resistance line name
    It is by these names that the expert will determine which lines he will work with.
    Invers_Orders = false – Invert orders. If you enable (true) this parameter, a Buy order will open on the resistance line instead of a Sell order, and a Sell order will open on the support line instead of a Buy order.
    SL = 50 – Stoploss size in points.
    TP = 50 – Takeprofit size in points.
    Lot = 0.1 – volume of positions opened by the expert.
    Show_Alert = true when the parameter is enabled, signals the opening of a position.
    Magic_Number = 818798 – unique identifier expert.

    »

    And it's all in one bottle. Well, for those for whom this is not enough, the advisor can work not only with pending orders, but also with regular market orders. You can quickly set the Stop loss and Take profit levels using the horizontal lines of the advisor, press one button and the order is placed with all the specified parameters! Isn't it a miracle? It just makes life incredibly easier. Here's what it looks like on a graph.
    Multi-colored horizontal lines correspond to the desired levels of stop loss, take profit and the installation level of the pending order itself. By the way, the advisor itself determines which order needs to be set - a limit order (Buy Limit, Sell Limit) or a stop order (Buy Stop, Sell Stop), so if you are confused about the types of orders, then you have one less headache. And in order to better understand the differences between the types of pending orders, read and watch the video (new tab). The PLines button enables the mode of placing a pending order, the Lines button - a market order. The Hide button removes the advisor's lines. Well, as already mentioned, the FastOrder advisor simplifies the opening of regular market orders. We simply set the stop loss and take profit lines to the desired levels, press the BUY or SELL button in the lower left corner and that’s it, the order is opened with the specified parameters.

    Unfortunately, there were some downsides. The downside is that you can only open one order for one currency pair using an advisor. This appears to be related to the MagicNumber parameter in the settings. The FastOrder advisor assigns this number to each order, and the authors' flaw is that the advisor does not know how to automatically change this number for the next order. Thus, when you try to open another order on the same currency pair, you simply cannot assign a number to this order, since it is already occupied and it is not possible to open an order. But this disadvantage can be circumvented if you add the advisor to the chart again and change one digit in the MagicNumber parameter, then you can place another order. This technique can be repeated as many times as you like, but the Expert Advisor’s Close button will become unavailable for the previous order. But the loss is not great; the order can always be closed in the terminal itself by clicking on the cross.

    The file is available for download only to registered users - Afterwards, refresh this page so that the download link appears

    In general, the interface and settings are quite intuitive and I won’t write a sheet of text describing each one, as this will only bore you. Look instead better video, where I go into more detail about the settings and clearly show how to open orders using the advisor for setting pending orders FastOrder. https://www.youtube.com/watch?v=NS7_v4C9Dy8

    Profit for everyone! Subscribe and read our.