Script trading from horizontal lines.  Forex scripts to simplify trading.  Advantages and disadvantages, what is all this for

Script trading from horizontal lines. Forex scripts to simplify trading. Advantages and disadvantages, what is all this for

Greetings dear readers. Today I want to post some forex scripts that have been helping me in my work for many years. I remind you that a script, unlike an Expert Advisor, is designed for a one-time execution of a planned action.

As a rule, scripts are launched by the user, perform their function and stop working. Scripts are usually used when it is necessary to avoid routine, time-consuming work of the same type, for example, closing all positions, setting a common stop loss for a grid of orders, moving positions to breakeven, and the like.

Scripts are installed in the folder Scripts data directory trading terminal MT4, instructions for finding the data directory and installing Expert Advisors, scripts, indicators are given in the article.

Forex scripts are launched from the “Scripts” section of the navigator by double clicking or dragging the script onto the price chart.

I also use a wonderful feature built into the MT4 terminal - setting hotkeys that allow you to call a script or indicator.

It is very convenient in case of an urgent need to close all orders for the current instrument, just press keyboard shortcuts and enjoy the result, rather than looking for the desired script in the navigator, not to mention using the standard position management methods provided by the Metatrader functions.
To set a hot key by which the script will be called, you need to select the required forex script in the navigator, press the right mouse button and select the “Set hot key” section in the context menu that appears. Next, in the window that opens, for the selected script, set your unique keyboard shortcut Alt with a letter, or Ctrl with a letter. Carefully study the manual of the terminal itself so as not to override the default keyboard shortcuts that operate in the terminal itself.

So, here are the main forex scripts that I use almost every day:

The first group includes scripts for simultaneous closing of positions and pending orders.
KS_CloseAll– the script quickly closes all available open positions and pending orders. Convenient for multicurrency trading, when you need to fix the current achieved trading result. This script compares favorably with its counterparts in that it will do everything possible to complete the closing. Script fights against such phenomena as requotes, price changes, busy trading flow, new openings of orders by other Expert Advisors or scripts, and other "intrigues" of DCs. In the script settings you can set:

Close all positions - Close open positions
Delete Pended Orders - Delete pending orders
Magic Number (-1 for all) - Use a magic number
Slippage - Permissible slippage

west_close– the script closes all positions and deletes pending orders without first displaying a window asking whether to run the script or not, and even without displaying the parameters window. It is activated immediately after launch and works quickly. It is very convenient for scalping, the script sits on my hot key Alt + K (from the English Kill).

The following scripts require dragging the script itself from the navigator window to a certain place on the price chart with the mouse.

KS_Splitter– script for partial closing of the selected position. To select the desired position, you need to throw the script itself on the price chart directly on the order and set the volume of partial closing in lots in the window that opens.

west_SLTP_drop– a script for simultaneously setting Stop-Loss and Take-Profit for all positions and orders of the current instrument at the price at which the script was thrown. Depending on which side of the position the script was thrown from, the script itself automatically determines whether to set a stop or a take. It is very convenient when there are many positions, when the entry is performed by parts or by a grid of orders.

Important! To perform trading operations, it is necessary that the "Auto-trading" button be pressed. Keep this in mind when running scripts that perform any manipulations with positions and orders.

And bonus: west_objdelete– a script that deletes all constructions on the chart, clears it completely of objects, even those that have the property “not displayed in the list of objects. I also have a script on the Alt_C hotkey (from Clear - clear).

Download forex scripts:


Use the proposed Forex scripts and your productivity will undoubtedly increase.

»

And it's all in one bottle. Well, for those for whom this is not enough, the adviser can work not only with layoffs, but also with ordinary market orders. You can quickly set the Stop loss and Take profit levels using the horizontal lines of the adviser, press one button and the order is placed with all the specified parameters! Well, isn't it a miracle? It just makes life incredibly easy. Here's what it looks like on a chart.
Multi-colored horizontal lines correspond to the desired levels of stop loss, take profit and the level of placing the pending order itself. By the way, the adviser itself determines which order needs to be placed - a limit (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 less of one more 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 switches on the mode of placing a pending order, the Lines button - a market order. The Hide button removes the adviser's lines. Well, as already mentioned, the FastOrder Expert Advisor simplifies the opening of ordinary, market orders. Just 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 for one currency pair you can open only one order using an adviser. This seems to be related to the MagicNumber setting in the settings. The FastOrder EA assigns this number to each order, and the flaw of the authors is that the EA cannot automatically change this number for the next order. Thus, when trying to open another order on the same currency pair, this order simply cannot be assigned a number, since it is already busy and it is not possible to open an order. But this minus can be bypassed if you add the Expert 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 - Refresh this page after that, so that the download link appears

In general, the interface and settings are quite intuitive and I will not write a sheet of text describing each one, as this will only bore you. Instead, watch the video where I go into more detail on the settings and clearly show how to open orders using the Expert Advisor to set pending orders FastOrder. https://www.youtube.com/watch?v=NS7_v4C9Dy8

Profit to everyone! Subscribe and read our.

From the article you will learn:

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

Best Broker

So, what exactly I want to tell 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 start using 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, which, with its in-depth use, are available only through robots and scripts. This does not mean that anyone who wants to trade on Forex will not be able to do this, on the contrary, trading is available to everyone. It's just that the process of trading under the influence of evolution becomes more complicated, which means that traders become more advanced. In general, scripts do not interfere, but help. So, about everything in more detail.

Advantages and disadvantages, what is all this for

What is the script for?

  1. There are constantly recurring operations that can be trusted with a computer. There are conditions under which one should open, close, change something, count, and so on. All this can be done semi-automatically using a script,
  2. Another good example is the order opening script. The fact is that most parts of trading orders can most often be changed using simple windows for opening orders. However, there is such a part of the order as a magic number, below I will talk about it in more detail. As long as I say it's great main part order, it can only be changed using a robot or a script. And if we started using the script for opening orders, then the comments can already be edited, and so on.
  3. The script for setting pending orders will show us the other side of using these programs. Increasing the speed of reaction to certain situations in the market 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 a magic number, and why is it so important? Imagine that you, like me, have more than seventy terminals open on . You might think that only one robot can work on one terminal within one account. That is, seventy robots trade for themselves calmly. What else is needed? But everything may not be so. In fact, the use of Magic number offers to use an infinite number of robots on one account, even on the same pair. Of course, accounting for efficiency changes a little, but, in general, nothing changes. And now imagine that each terminal has 2-3 or more robots. What results can be achieved? It remains only to guess. To you. And I enjoy what is happening on my VPS with a grin, and I advise you: go through the free one, and I will share with you what I know.

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

I especially want to pay attention to the speed of script execution. Actions that can take you several tens of minutes are completed in a few seconds. This allows you to release some of the responsibility. Although it’s not entirely correct to say so, I’ll still take a chance. The fact is that you still take responsibility for yourself, but only at the moment when you are looking for a script and checking its suitability for your trading system. When you fulfill it, there is no question of any responsibility. At least on a conscious level. Somewhere in the subcortex, it remains. But, I believe, psychologically, it will already be much easier for you.

On the need for a system and examples

Watch a video about the script

I think that you have already understood 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 - he is completely unprincipled. No, of course, it contains the logic that you put in at the time of its selection or study. But at the moment of execution, nothing can stop him from doing what he has to do. But the conditions on the market can be either suitable for the operation of this auxiliary program, or completely harmful, not working at that moment. The moment you decide to launch it.

Download

That's why you need something more advanced than just the decision to run the script. Simply put, you should use it as part of some simple but working manual strategy. Those who are ready to use it to correct the work of their adviser also need to understand that it should be launched only when conditions have arisen under which your adviser should have reacted, but did not react, or in another suitable situation.

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

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

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 the effective distance checked in advance on the history and get two pending orders on two horizontal lines. On opposite sides we place stop-losses. In this case, take profit can not be set. Since, with the help of observations, we have established that in history, transactions with a duration of 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 didn’t go through history and set the length of the candle, after which it would be advisable to enter, if we didn’t calculate that it is precisely this distance between orders that 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 be able to work according to the forecast. And that's how we get great deals. Why am I all this? Only a systematic approach, coupled with the work of such auxiliary programs, can give a good result. No other approach, except for a systematic one, can give a positive expected result. Do not forget that there are many such tools. For example, .


This is the second, more functional version semi-automatic Expert Advisor Trade From Lines trading from lines set by the user. The EA needs two lines for normal operation: one must be above the current price, and the other must be below. The EA supports two types of lines: horizontal and trend lines. You can install two lines, both of the same type and different. You can draw a channel with lines and set up the trading of the adviser inside the channel: buy from the bottom, sell from the top. And you can organize trading on the breakdown of a certain price range up or down: buying from the upper line, selling from the lower one. In the second version, the offset of the input level relative to the line is implemented. It is set by the parameter OffsetTL in points and can be either positive or negative. And also in the second version, it became possible, at the request of the user, to automatically place stop reversal orders at the stop level of the position being opened. The setting of these orders is controlled by the parameter SetRevStopOrd. Since this is a semi-automatic adviser, we recommend that you use in the second window, the accompanying transaction adviser Integra NR

In the adviser, you can set following options:
NameUpLine="UPLine" - The name of the top line.
NameDnLine="DNLine" - The name of the bottom line.
BuyFromUp=False- Buy from the top line if True. Sell ​​if False.
BuyFromDn=True- Buy from the bottom line if True. Sell ​​if False.
OffsetTL=3- Offset of the trading level in points.
SetRevStopOrd=False- Place reverse stop orders at the stop level. opened position.
ShowComment=True- Show comments.
MarketWatch=True- Form trade requests for the execution of "Market Watch".
MagicNumber=20080320- Identifier of positions and orders of the adviser.
UseSound=True- Use a sound signal when making trades.
NameFileSound="expert.wav"- The name of the sound file.
Lots=0.1- The size of the traded lot.
StopLoss=30- Stop size in points.
TakeProfit=70- The size of the take in points.
slippage=3- Price slippage in points.
NumberOfTry=5- Number of trading attempts.

Trading from support and resistance levels, as well as on the basis of their breakdown, is a fairly effective approach.

However, even to this day there is no clear definition of levels, because two or three price touches are actually far from enough to claim that the drawn line is true, and not some kind of trader's conjecture.

However, on the run from the subjectivity of market perception, traders and programmers have created hundreds of different technical indicators levels that are somehow different from each other.

A quite logical question arises, which of the presented indicators really draws real levels? In fact, the levels are only those tools that indicate the place of concentration of stop orders of strong players.

Trade high only with a leading broker

One such obvious place where the concentration big players, are the lows and highs of the price of the month and the week, since it is precisely the emphasis on these values ​​that traders can hardly overcome.

Actually, you will get acquainted with one of the scripts that makes it possible to see these levels on the chart in the article.

The Monthly Weekly Levels script is an educational technical analysis tool that allows you to display the low and high levels of the day or week on the chart of any time frame you choose.

The script itself can be safely used as an indicator of support and resistance levels. Therefore, Monthly Weekly Levels will be equally effective on all currency pairs or time frames, which makes it a truly multi-currency tool.

Installing Monthly Weekly Levels script

A notable feature of the Monthly Weekly Levels script is the fact that it is distributed completely free of charge. Moreover, the script itself, and in terms of functionality the indicator, was published in the official library of the Metatrader 4 trading terminal developer.

Thus, you have two options for installing this tool. The first, and it is also the simplest, is through the built-in library directly in your trading terminal.

To implement this method, launch your trading platform and open the panel called "Terminal".

The next step is to perform a simple sorting to enable displaying scripts only. In the list that appears, find the script called Monthly Weekly Levels, then download using the additional menu as shown in the image below:

If the installation of the script through the library was not successful, you can install it in the second way, namely through the data directory of the trading terminal. To do this, go to the end of the article and download the script file.

Then just place the downloaded file in the appropriate folder of the terminal's data directory, and in the Scripts folder. In order for the trading platform to be able to see the installed file, it must be updated in the Navigator panel or simply restarted.

After updating the terminal, Monthly Weekly Levels will appear in the list of scripts, and in order for it to display information about the nearest levels, drag the name of the instrument to the chart.

The principle of using the script

After you drag the script onto the chart, it will immediately display the lows and highs of the week, as well as the month using horizontal lines on the chart.

It is worth noting that the script performs a one-time action, so after you add it to the chart, it will no longer update its data as the price changes.

so line in green I show the lows and highs of the weekly candle, and the yellow lines show the lows and highs of the monthly candle.

If we talk about the practice of application, then the indicator is used, like any other tool for trading from levels, or for their breakdown. Script view on the chart:

In the script settings, you can change the type of level display, line thickness, and so on. So, in the Number of Days line, you can specify how many days to display information on the chart based on.

Variable W1 Line Width you can set the thickness of the line, and in the line W1 Collor Line specify the color of the line.

Also, the script has the ability to display the lines solid or in pieces, as seen on the chart. In order to change the display style, you need to select the option you need in the Trend or Horizontal Line line.

In conclusion, it is worth noting that the Monthly Weekly Levels script is an excellent tool for automating the construction of levels on the chart, moreover, the lines drawn by the script can be useful to all traders without exception.