Script for placing pending orders. Order grid strategy - profitable trading with pending orders

Script for placing pending orders. Order grid strategy - profitable trading with pending orders

The metatrader 4(5) trading terminal has many additional features, but for comfortable work, you still need to use additional forex scripts. These programs can greatly facilitate trading, and therefore increase its efficiency. They do not analyze the trend and do not supply trading signals, but only add some functions to the trader's terminal.

Forex scripts allow you to place pending and instant orders with the mouse, close all orders with one click, calculate the breakeven level, manage already open positions, and also provide a lot of other features. All presented programs are absolutely free, by choosing the necessary program you can download it on our website.

Make waiting more enjoyable with Game 5ftee Puzzle

In trading, there are often moments when you have to wait a long time for the price to reach a certain mark.

In order to somehow occupy themselves, someone is talking on the phone, someone is listening to music, but you can also play a simple game right in the trader's terminal.

So to speak, spend time usefully training your mental and logical abilities, since this is what this game is aimed at.

Fifteen we all know from childhood in their offline version, you just need to arrange 15 numbers in a certain order on a square field.

The developers of the game have made a version that can be easily used in the Metatrader 5 trading platform, directly on top of the currency pair chart.

Trade Assistant (Trade Assistant MT5)

It so happened that someone trades on Forex, and someone tries to make this trade easier by creating various programs and scripts.

Today we will talk about the Trade Assistant program, which acts as a trader's assistant when placing orders.

That is, it helps to place market and pending orders taking into account the risk in relation to the deposit, as well as set the size of stop orders.

That is, now you do not need to think about the size of the transaction every time you change the amount of funds on the deposit, but simply set the percentage of risk in relation to the balance.

But this is only a small part of the capabilities of the script, which simply amazes with its functionality and visualization.

Gep statistics script for a currency pair

Such a phenomenon as a forex gap has brought quite a few troubles to many traders, it is this phenomenon that does not allow stop orders to work.

And to be more precise, they work, but only after the price gap has ended and at the price of its completion.

There are also a lot of strategies that use gaps as entry signals, and are guided by a pattern that says that each price gap must be closed.

Therefore, it is so important to choose a currency pair for which price gaps rarely occur, or vice versa, to find an instrument with the largest gaps.

For these purposes, a script for gap statistics on currency pairs was invented.

Script pending orders at a specified time

Trading using pending orders is quite multifaceted, there are just a huge number of strategies based on them.

At the same time, the standard capabilities of the Metatrader trading terminal only allow limiting the time of existence of a pending order.

But sometimes it is required the other way around, so that the order starts to operate from a certain time, that is, to delay the placement of a pending order.

This is done in order to enable the price to go a certain distance, after which to open a position at a better price.

You can add a new function to the trading terminal by installing a script for placing pending orders, which will set Buy Stop and Sell Stop on a specific day and at the right time.

Script money management

Most professional traders say that it is quite easy to make money in forex, it is much more difficult to keep the money earned.


One losing trade can easily wipe out the profit that was made from five successful ones.

Therefore, the money management system comes to the fore, which regulates aspects of money management, the ratio of profits and losses.

Many beginners neglect this point, preferring to plan the volume of transactions only based on the size of the desired profit.

This is largely due to the very process of calculating safe volumes of transactions, still nothing if we are talking about one or two positions, but what if you have a dozen orders open?

A simple script that allows you to determine the volatility for the period

What does the AccountInfoSample script show in the trader's terminal

The online trading industry does not stand still, and every year new auxiliary tools appear, the use of which will significantly simplify the analytical process.

In addition to indicators and tools for technical analysis, it is possible to integrate scripts into the MT4 platform - special programs written in MQL4.

Such add-ons can serve to perform various tasks:
trade automation:

Placing or canceling pending orders
making trading more comfortable
information functions

The last group of scripts is used most often.

These programs are designed to systematize information about trading, which allows the trader to objectively evaluate the effectiveness of the strategy, work on errors and make appropriate changes.

Automatic stop loss and take profit

Dynamic trading in the style of scalping, pipsing or grid trading requires maximum performance from the trader.

However, at such a huge pace, especially when it comes to pipsing, it is almost impossible to timely and quickly set the correct stop order or profit values.

Naturally, such a situation leads to the fact that the trader suffers losses, because a huge number of losing trades have to be closed manually and not all of them can be followed.

Naturally, not everyone can withstand such conditions, so many simply refuse scalping and pipsing as such.

Trailing Master Script

One of the ways to save profits and minimize losses is to use the Trailing Stop order in trading.

However, in many cases, the standard and familiar trailing does not meet all the requirements and does not solve the tasks that a trader can set for him.

Therefore, auxiliary scripts and Expert Advisors come to the rescue, which significantly expand the functionality of a standard order.

You can get acquainted with one of these scripts in this article.

The Trailing Master script is an auxiliary trader's Expert Advisor, the essence of which is to automatically perform both mass and single trailing orders when the price reaches a predetermined profit value on the order.

Script Limit orders Pro. Universal grid trader assistant for all occasions

The profession of an analyst is to draw beautiful forecasts, and if they do not come true, then be able to correctly explain why.


A trader, on the other hand, rarely thinks for a long time, moreover, most trading strategies are focused not on making forecasts, but on working with the consequences of a particular price behavior.

That is why, against the background of the unpredictability of the market, grid trading strategies began to gain more and more popularity, where a trader, like a fisherman, sets traps for the price on its way and earns from almost any of its movements.

However, working with grids has its drawbacks, and one of them is a huge amount of routine with pending orders, which not all traders can handle.

The cost of any mechanical error is a huge loss. That is why most traders always use either advisors or auxiliary scripts that allow them to solve a number of problems. Actually, you will get acquainted with one of these scripts in this article.

Script for transferring history to a chart

Investing in the forex market is extremely risky, and even the huge potential return in many cases is broken against the reality of the efficiency and stability of managers.


How to find out if the manager will be able to conduct effective trading?

What is his strategy and, most importantly, are these indicators boosted due to the competent use of risky money management models, which give a beautiful picture of the profitability graph, but at the same time, the drain occurs suddenly and instantly?

In order to give answers to this question, it is necessary to study in detail the principle of a trader's trading, and the script for transferring history to a chart will help you with this.

The script for transferring history to the StrategyViewer chart is an auxiliary program for your MT4 that allows you to pull history from an Excel report, which often allows you to download various services for copying transactions and also PAMM platforms.

It is worth noting that the script was developed specifically to pull trade histories onto the chart from the signal copying service from the metatrader developer, which are still directly in your platform.

Invisible feet. An expert who can keep your secret from a dishonest broker

One of the problems when working with brokers is the lack of output of transactions to the real interbank market, when all transactions are virtual and are carried out within the company.


Why would a broker do this, you ask? And what is the point of bringing traders to the real market if nine out of ten participants merge?

It is easier for a broker to arrange virtual trading and take the deposits of traders for himself, rather than give them to the market to be torn to pieces. There is practically no difference in trading within the company or in the interbank market if the broker withdraws profits.

But such a scheme of work presents a certain conflict of interest. After all, the company will never be interested in efficient traders, so unscrupulous brokers often interfere in the trade of traders.

The most important tool in the hands of a dishonest broker is a stop order and a trader's profit, which the company may not execute, transfer or fix, as it is convenient for it.

Manipulating quotes in modern conditions is not possible, since such facts would be identified and made public very quickly, but the stop order and profit still remain the most vulnerable point.

Drawdown script. Be aware of what is happening on your account

Many traders pay attention to trading instruments, from trading strategies to forex advisors. However, in the pursuit of the Grail, stupid and ridiculous mistakes are often made, the price of which is a huge part of the trader's deposit.


For example, many do not even think about how important it is to track the situation on the account, because they think that the set profits and stop orders will always work.

And if only manual trading is used on the account, such a disregard is still excusable, but when advisors are used and full automation, any even the slightest failure that occurred due to a temporary disconnection can simply lead to terrible consequences.

However, not everyone can always be constantly at their monitor in order to track the drawdown on the account.

It is for this purpose that Push messages are provided in the trading terminal, and you can track the situation with their help using a special auxiliary script-advisor.

Binary Option open trade script. Instant opening of binary options trades

In the process of trading, it is very important to respond in a timely manner to the emerging strategy signals, as well as to open a position in time, so as not to miss a potential piece of profit.


It is especially important to work on the speed of opening deals for scalpers, as well as traders trading on the news, because at the time of the release of a certain economic indicator, the market covers a huge distance with lightning speed.

However, if the forex market has created a lot of scripts and assistant advisors that significantly implement this opportunity, then the binary options market can only dream of such opportunities.

Unfortunately, most binary brokers do not use a perfect trading platform, so many use additional terminals, which undoubtedly affects the speed of opening a transaction.

infopanel. Information script for MT4

In the process of trading, it is very important to have basic information right in front of your eyes.


The price of the asset, the size of the spread with the broker, the balance, as well as the profit on open positions, the number of open positions and the banal time until the close of the candle - all these small details, one way or another, are used in trading.

However, in the basic functionality of MT4, in order to find out about the same spread for the selected asset, you need to subtract prices yourself.

Moreover, if on four-digit quotes it is quite simple, then on five signs it is already difficult, and time is simply lost when you need to make a decision and conduct active trading.

Also, the function of displaying the time until the closing of the candle is one of the most important for traders trading binary options, but it is not available in the platform at all.

Script to move stop loss

One of the biggest problems faced by both novice and more experienced traders is the early exit of a position.


Such an approach to the market, in which a trader closes a profitable position at the slightest opportunity, leads to the fact that the ratio of risk to potential profit changes far from the trader's side.

The real way to deal with this situation is to use a trailing stop.

However, trailing, which is present in the classic form in the MT4 trading platform, is far from ideal, because at the moment when the price starts to correct, the position is closed early and profits are not received.

That is why many traders use two-way trailing, the essence of which is to move the stop order following the price at a certain distance from it. If you wish, you can automate the process if you use the StopLossMove script to move the stop loss.

Strategy evaluation script

Any trading trading strategy sooner or later lends itself to better testing for various indicators by the trader.


Profit factor, mathematical expectation, a series of profitable and unprofitable transactions, maximum and average drawdown, profit to loss ratio, as well as the average profitable and unprofitable transaction - all these indicators characterize the strategy and make it clear to the trader, as well as the investor, its potential.

Actually, in this article, you will get acquainted with a special script that will evaluate your trading strategy in a matter of seconds based on the history of your transactions and give it a qualitative assessment.

Tradingsystemrating is a custom script developed for the MT4 trading terminal, the main task of which is to evaluate your trading strategy, which is applied on the account.

The script evaluates a strategy to choose from using two methods. The first technique for evaluating a strategy was described by Van Tharp in the book “Super Trader.

The speed of opening a position plays a crucial role for traders who prefer news trading or scalping in sharp market jumps.


However, if the extensions for the MT4 trading platform called "One Click" allow you to quickly open a position, then you have to spend enough time setting stop orders and profits.

Such a delay for a trader whose profit is calculated in several points of profit is comparable to losses.

And if traders who trade with a static lot somehow smooth out this situation by quickly opening a transaction in one click, then what should a trader who uses a dynamic lot do, risking a certain percentage of risk per position?

The only way to solve the problem is to use auxiliary assistant programs, and in this article we are one of them.

Trading statistics with Iprofit Custom script

Each trader has his own goals, namely, someone stops trading after reaching a certain amount of profit, someone after reaching a certain percentage of the deposit, and someone stops trading after receiving a certain percentage of loss.


One way or another, no matter what strategy a trader uses, the main thing is to have clear tasks and limits that allow you not to give in to animal instinct and the desire to win back or conquer the forex market.

However, in practice, keeping such statistics is not easy, since on an ongoing basis you have to carry out additional calculations or register in special monitoring services.

That is why, in order to see all the trading statistics on the account and not resort to third-party services, special informational assistant indicators were created.

Volatility script

The volatility of a financial asset is the most underestimated characteristic of the market, because of which many traders fail.


The fact is that volatility displays the range of price movement in points for a certain unit of time.

Thanks to this indicator, each trader will be able to outline for himself certain goals that a particular currency pair can achieve during the day or even a couple of hours.

The VolScript volatility script is a special application for trading on the MT4 platform, thanks to which you can find out the current and average volatility in the market.

It is worth noting that, unlike many similar scripts and indicators that determine volatility, VolScript displays its hourly change, and also brings statistics by day.

Range Bars script. Remove market noise

The complexity of technical analysis, as well as the use of various technical indicators, is that the chart is simply oversaturated with market noise, which makes it quite difficult to assess the current market situation.


This is due to the fact that the chart construction we are accustomed to, whether it be candles or bars, is tritely tied to a time interval.

Yes, each new candle appears not because the price has overcome a certain distance, but because five or fifteen minutes have ended and even the minimum price shift is fixed on the chart.

That is why at the moment when the price is in a very narrow range, we can observe a series of horizontal candles, which do what they do to confuse every trader.

Due to the peculiarities of chart construction, indicators following the price can give a lot of false signals, because the instrument simply does not understand that the market is flat.

Script to reverse positions

In the process of trading, every trader is faced with a deceptive market maneuver, when at first glance a clear trend changes its direction in a matter of seconds.


Many traders accept their defeat and wait for a stop order to exit the forex market.

But you can also reverse the position, which will make it possible to profit from a new trend, while the amount of profit directly depends on how quickly the reversal is made.

Revers script is a great solution for traders who practice position reversal. Unlike many analogues, the script automatically remembers the volume and number of previously opened orders and performs a flip with exactly the same lot.

It is worth noting that this script is a universal tool and performs a one-time action, which does not overload your trading platform.

Indicator for screenshots of forex transactions

In the process of studying exchange literature, almost every author of the book advises his readers to start their own diary. Probably, you have repeatedly wondered why this is necessary, because the entire history of transactions is stored directly in the trading terminal and can be retrieved at any time in the form of a report.


However, it should be understood that the diary is not intended to preserve history, but to analyze it. We doubt that one of you, a month later, will be able to say why he opened a deal, what judgments he was guided by and corny, what mood he was in.

However, it is the work on oneself and one's mistakes that allows a trader to improve, improve his strategy and method of entering the market, identify patterns, and also identify his own vulnerabilities.

However, despite the fact that many agree to this step and start keeping a diary, they often do it wrong.

The vast majority of traders, and especially the older generation, keep their diary in an ordinary notebook or notebook, forgetting about the most important object of analysis - the trading chart at the time of transactions. Naturally, there is an opportunity to take a screenshot in the trading terminal, but this takes time and effort, which leads to the fact that the trader forgets to do this.

The best place to take profit - EasyTakeProfit

Many traders over-emphasize their own strategy entry system rather than exit points. No matter how strange it may sound, but the number of traders changing trading tactics one after another is simply thousands, but really those who thought about the reason for the loss of a unit deposit.


Often, two banal parameters like the profit level and the stop level can radically change the statistics of a forex strategy.

So, succumbing to emotions, many beginners set a too large stop order, or refuse it altogether. In the first case, with a large stop order, the ratio is violated, which subsequently leads to the loss of the strategy.

In the second case, the absence of a stop order generates the accumulation of a huge loss, which sooner or later will have to be closed.

With the increasing popularity of scalping among many traders, the practice of setting too small a stop order due to the unwillingness to lose a lot in one transaction has appeared.

Price movement speed script

When analyzing the foreign exchange market, it is necessary to pay attention not only to such characteristics as trend, flat and direction of price movement, but also to its speed in Forex.

Almost every practicing trader noticed that opening a series of transactions at different times of the day, but under the same conditions, the speed of its closing (reaching a profit or a stop order) will be radically different.

This is primarily due to the speed of price movement at a certain moment. So, if you are trading on the news, the speed of reaching a stop order and profit will be significantly different than when a deal is opened with the same goals and risks, but at a quiet time.

The price movement speed factor can directly affect the efficiency of the deals you open, because even experienced traders say that a deal is considered successful if it goes up in the first seconds, and does not stay in place.

How to write a forex script

Modern trading is already quite difficult to imagine without automation, and with the current level of development of computer technology, not only simple programs, and even artificial intelligence, which is capable of self-learning.

However, if complex programs are affordable only for large hedge funds, banks and other large financial institutions, then simple software solutions such as scripts are affordable even for a student, and in most cases you can find a script for your tasks for free.

A script is a program that is designed to perform a one-time action. For example, if you have come across trading advisors, then you probably know that this program performs certain tasks as long as it is on the chart.

The script, on the other hand, differs from the Expert Advisor in the one-time execution of the command during drawing on the chart. Thus, the script can perform the task that the EA cannot handle.

For example, if you want to close only profitable trades from your series of open orders, then when you apply the script to the chart, the program will close only profitable trades once, when the EA will do this all the time.

GrailMeter script - measure the grailness of your robot

Almost every trader who is actively interested in automatic trading and various forex advisors has come across the so-called Grails.

Experts who show phenomenal results over a historical period, but in real trading conditions display a completely opposite result, are usually called the Holy Grail among stock market players.

As a rule, naive beginners who are prone to the desire for quick profit fall into the trap of the Grail.

The situation is quite typical, namely, that a person, having seen phenomenal results in the tester, puts an adviser on a real account and, due to increased trust and hope, quickly loses his deposit.

To avoid such situations, professional players always advise testing an Expert Advisor on a demo account before placing it on a real one.

GUI-Robot - automatic trading without programming knowledge

The modern realities of exchange trading are such that programmed algorithms have almost completely pushed traders away from manual trading.

As a rule, in modern realities, a trader is assigned the function of monitoring and confirming signals, as well as a master who will timely make changes to his pre-programmed algorithm.

However, the creation of an autonomous algorithm that can duplicate you and your strategy costs quite a lot of money, not to mention the fact that it is quite difficult for a programmer to explain what you want, since he writes programs, and has nothing to do with trading on the stock exchange.

Exhausted nerves and wasted money are just a small part of the troubles that you have to face if you yourself do not know the programming language. Of course, you can spend years learning the code, but you can go the other way.

Today, it is rather difficult to discuss the importance of graphical analysis, since even the most inveterate critic It is known that this tool has proven its effectiveness over time.

However, graphical analysis is a rather complicated approach, despite the clear, at first glance, the principle of constructing figures.

Do you agree that the head and shoulders in the book look so realistic that you can’t distinguish from a real person, but in the market, if you meet this once a year, it’s not anyhow what happiness.

The most common disease of traders, due to which dozens or even hundreds of accounts merge, is non-compliance disciplines in the field of capital management.

Moreover, I would like to separately note that it doesn’t matter if a trader uses an adviser or trades personally, the mistake of timely fixing profits and losses is common to everyone.

Separately, I would like to touch upon Expert Advisors, which for the most part use highly risky money management models like martingale or averaging, which leads to an instant loss of all funds.

Those traders who have ever encountered such robots know that in the event of a strong drawdown, you need to make a tough decision and fix the loss so as not to lose all your money. However, the banal hope that by opening the next order with an overvalued lot will lead to the expected resolution of the force majeure situation, we get a backlash to its aggravation.

Scripts for opening or closing deals (orders) are now used by all novice traders. But before talking about the intricacies of using such programs, it’s worth understanding what a script is.

A script is a small, but not significant, program. It is additionally installed on the MT4 or 5 terminal.

Unlike Expert Advisors, scripts do not perform their role all the time, they are used one-time. That is, to perform a certain operation and only once. Such an operation can be, for example, opening or closing an order or . In general, scripts are written for a variety of purposes.

Script for opening and closing several orders at once for the MT4 platform

Some scripts are already written in the MT4 platform. This is, in particular, the opening script. It is used to open a position. Also, there is a script for deleting a previously opened position. All scripts are stored in the section of the same name in a special navigator window. Here, you can view the entire list of available software modules.

In order to start working with some kind of script, it needs to be transferred to an open chart. You will need to activate the script in the window that appears, with the question do we really want to attach "close" to the EUR/USD Daily chart?

When you press the "YES" key, the script will run. And after performing the set function, it will automatically close and get out of the chart without distracting attention. You can also delete the script ahead of schedule. For example, if it is no longer needed.

To delete, right-click on the chart and click on the “Delete script” function. Ready.

Placing orders in MT4

Installing scripts directly to open / close multiple orders in addition to the existing ones

Any scripts today can be found on the net. Scripts for MT4 are also easy to download from the forums. In order to get started, make sure that you have the Metatrader4 program installed. As a rule, scripts are downloaded in whole archives.

After downloading, such an archive must be unpacked. All content must be copied to MQL4/scripts folder. By the way, it is in the data directory itself. Next, you need to go to this directory: File => Open data directory.

The next step– opening the Scripts folder of the MQL4 section. This is where the downloaded scripts are placed. After a successful copy, the MT4 platform needs to be restarted. Without this action, the scripts will not be displayed.

Now you can start the MT4 program again and follow these steps:

  • Select the section Service => Settings on the top panel
  • In the Expert Advisor tab, place crosses/checkmarks as shown in the picture below:
  • The last step is to click "OK"

Now you can open the chart of the selected . You can drag the installed script onto the chart.

Changing the parameters of the script for opening and closing protective orders in MT4

The script for opening / closing orders (single or multiple) works well with preset parameters. But sometimes these parameters require a little adjustment. For example, if you want to increase or decrease the lot you are opening. To change the parameters of the script, you need to change its code. You can do this only if you have saved the source in MQL format.

To get started you need:

Find the desired script in the program and select the menu item Edit by clicking on the right button.

In the MetaEditor application window that opens, the parameters are changed. The main thing is not to change too much. Be careful what settings you change. Otherwise, your script will simply stop working correctly and instead of benefit, it will only bring harm, and therefore losses.

After making all the necessary changes, save them by pressing the "Complite" key. After that, you need to close all the MT4 program.

Difficulties with programs or any unforeseen situations should not arise. Since all scripts are extremely clear and simple.

It should be borne in mind that there are all sorts of scripts. Some are useful, and some are not. But there is a whole set of scripts that won't hurt. There are many names on the list of the most common.

Script for closing and opening protective orders — Urdala Helper

This script helps a lot when Forex trading is done manually. Management is simple - with a mouse, as in working with standard Windows windows. This script is designed to open orders. Moreover, both market ones and those with a set profit take and stop loss.

Urdala Helper is also used when closing orders (one or a whole group). It can even be all orders at once. And with the help of this script, you can modify orders. You can also work with one or several orders. They can be converted to profit above or below the line, and the profit will not be lost.

Working with the script is extremely easy. It needs to be dragged onto the chart. In the settings window and the design.

The script is presented in the form of windows. It starts the action you choose and automatically closes when it is done.

How does the script work for multiple orders?

To open a market order, you need to move the price label of the take profit (green) or stop loss (red) value to where you plan to stop orders. The same with a pending order.

Today it is difficult to start trading in the Forex market without the use of advisors. However, sometimes it is necessary to use special scripts that help these tools to trade on the market.

In this article, we will look at scripts for placing a grid of pending orders. And to begin with, let's take a closer look at what they are and why they are needed at all.

What is an order in the Forex market?

In essence, an order is an order for a dealer to perform an operation to buy or sell a currency. In the foreign exchange market, two order options are noted. The first - .

However, defining an order is quite simple. To do this, remember one simple rule. The order option is always determined directly in relation to the current value at the moment it is placed.

If you need to buy higher or sell lower, then we are talking about Stop/Loss. In the case when you should sell higher and buy lower, we are talking about Take / Profit.

At the same time, it is important to know that, depending on the purpose of a particular order, it can always be qualified as a simple mutually cancelable order and directly by execution.

So, simple order, (otherwise single) is used directly to enter or exit a position when the market reaches the value set in it. It is important to consider that an order can be placed no more than and no closer than ten points from the current market price.

Considering that traders always sell at the bid price and buy currency at the ask price. Mutually cancelable orders are a combination of the orders mentioned above. Usually this class of orders is placed when there is an open position. And it is necessary for better control over the position.

Its main advantage lies directly in the fact that when using this tool, if you use one order, the second one is automatically canceled. Execution orders are a bunch of several orders, in which one is simple, and one is mutually canceled, in some cases, maybe even two.

The peculiarity of this bundle is that the user does not need to constantly sit at the computer monitor to monitor the market. The dealer himself can open a position for you, and then control the state of this position until the moment any order in this bundle is triggered.

Pending order - types, commands

Now let's talk directly about the pending order. In fact, this is an order to the dealer to sell or buy a currency at a given price for a given number of lots when a certain type of price is reached.

Pending orders

As a rule, the New Order window is called to place pending orders. To do this, perform the following procedure. Find the “Service” command and then select the “New Order” section. After completing these tasks, you must press the F9 key. You can now double-click on Market Watch.

As for the “Order” window that opens, the option called “ Pending order". It is important to correctly fill in all the fields that relate to this section. After that you can start the installation. Take your time. You should gradually wait for confirmation of the acceptance of the order from the selected server. Information indicating the successful placement of the order should appear in the trading terminal window. Now, having familiarized ourselves with the basic concepts, we are ready to reveal the main essence of this article.

Scripts for placing a grid of pending orders. Easy Installation

This installation option provides for the installation of pending orders only with the mouse. This script allows the user to place pending orders directly in the trading terminals using only the mouse.

This really greatly simplifies the operations associated with installation, because you are given the opportunity to visually see where the value of the currency is located in a certain period of time. In addition, you get the opportunity to make all the adjustments and parameters necessary for the trading process.

The script for placing pending orders is a very convenient tool with which you can immediately set not just one order on the chart of the selected currency pair, but also settings that will help in triggering StopLoss/TakeProfit orders.

Basic settings of the script for placing (installing) a grid of pending orders

First of all, you should talk about the choice of positions. In this section, you can open either exclusively short positions, or, conversely, only long positions. At the same time, Long is the value of only buying, and Short is the value of orders exclusively for selling.

It should be understood that if you decide to choose Long and Short, then 2 pending orders may appear on the given chart, and in different directions.

Stop-loss allows you to set a risk indicator in advance, which will allow you to save a lot of money in some unprofitable transactions.

Take-profit is also an important value that refers to a take-profit order. It is responsible for determining the amount of profit, especially when determining the amount of profit within which automatic closing of the instrument is achieved.

Slippage is an indicator of slippage.

In addition to these settings, there are also a number of other parameters, however, which are of less importance. Therefore, if you wish, you can find information about their settings, but they are of little use in trading. As for the script given in the example, I would like to note that it functions remarkably well in the MetaTrader 4 database.

Pending orders allow a trader to automatically execute a specific trading operation when the price reaches a certain level. Such an operation may consist of opening, closing or changing a position. Some trading strategies involve placing multiple pending orders that are triggered when the required market situation occurs. At the same time, they are relevant only for a certain time period, after which their activation can only bring losses. In such cases, it is advisable download script for deleting pending orders, which provides fast execution of this function.

Watch the video review of the article

When you need to place and delete pending orders

As a rule, a pending order (OO) is triggered when the price of an asset reaches a predetermined level. After installing the OO, the trader does not need to wait for the conditions required for a particular trading strategy to be met for opening, closing or changing a position. The broker, through which the trader conducts his trading activities, automatically executes the OO at the most favorable price (i.e., the order is executed even when the trading terminal is turned off).

At the same time, pending orders do not have an expiration date - after being placed, they remain active until they are triggered. During their installation, you can set the required stop loss and take profit sizes, and in the installed OO you can change any parameters.

If a trader has set a dozen pending orders or more when the corresponding signals of the used TS appear, then it will take some time and effort to remove them when market conditions change. Although it seems that such an operation is very simple and easy to perform, it is tedious to perform it repeatedly. In such cases, a script is useful for deleting pending orders, which ensures their prompt deactivation in a minimum number of manipulations. After the completion of its work, a window is displayed with a notification about the removal of all OOs (Fig. 1),

Such a quick removal of OO is required for high-frequency trading on short timeframes (for example, scalping), when the profitability of a trading strategy directly depends on the speed of decision-making.

Another case where the use of pending orders is advisable is channel trading on a flat. For example, when trading inside a channel (Fig. 2), an OO to buy is set at the level of the lower channel border with a stop loss below it and a take profit in the center of the channel. Accordingly, OO is placed for sale on the upper border of the channel with a stop loss above it and a take profit in the middle of the channel.

It is much easier to trade on the breakdown of the channel. In this case, when its boundaries are identified, Buy Stop and Sell Stop orders are placed, respectively, at the upper and lower boundaries of the channel (Fig. 3). When the price exits the channel, the corresponding OO is triggered, and the other one is removed.

What other scripts are available for pending forex orders

At the request of traders, programmers create a wide variety of algorithmic sequences that perform the necessary trading operations with pending orders. For example, del_orders_afte_VLINE can delete the TOE over time. The moment of deletion is displayed on the chart as a vertical line (red in Fig. 4) and is initially placed 10 periods ahead of the current candle (the number of seconds remaining until the close of all OO seconds is displayed in the left upper corner price chart window). This straight line can be grabbed with the mouse and moved further or closer.

And it allows you to close strictly defined types of orders. When launched, it displays a window (Fig. 5), in which you can set the values ​​of the following parameters:

  • Close_pending_buy orders? – whether to apply to Buy orders;
  • Close_pending_Sell orders? – whether to apply to Sell orders;
  • Close_profit_orders? – whether to apply to profitable orders;
  • Close_losing_orders? – whether to apply to losing orders;
  • Delete_pending_orders? – whether to apply to the TOE;
  • Close/delete_orders_only_with_magik_below? – whether to apply the script only to orders with a magic equal to the number of the “Magic” parameter;
  • Magic – a number corresponding to the magic of the orders that will be deleted/closed if the parameter "Close/delete_orders_only_with_a_magic_below?" is set to true;
  • Slippage is the maximum change in the market price from the one at which the script command to close/delete an order was activated.

All variables whose name is formulated as a question can take two values: true (yes) or false (no).

Below are some more scripts for pending orders that simplify and facilitate trading:

  • closes all placed orders at the moment when the price reaches a horizontal line, initially placed at a distance from the current price equal to the value of the TakeProfit variable. The position of this line can be changed. From each order, the part specified as a percentage in the PercentClose variable will be closed.
  • reverses positions.
  • deletes only orders that meet the specified conditions defined in the parameters: Magic – deals number; MagicAll – whether to close all orders (true – yes, false – no); Profit - the amount of profit sufficient to close the OO (0 - all OO); TipOrder – type of OOs to be closed (0 – all, 1 – Buy, -1 – Sell); SymbolAll – whether to close the OO on all currency pairs (true – yes, false – only on the current one); DeleteOrders – which orders to delete (true – all, false – only market orders); attempts – number of closing attempts.

Trading with pending orders has the following advantages:

  • Strategy No. 2 - trading using a grid of orders in a flat

    If, subject to the presence of a trend, everything seems simple enough, then what to do when the market is experiencing a prolonged flat. In this case, it is recommended to use limit orders instead of stop pending orders. Let's consider a specific situation with an example. Suppose there is a flat on the market, then we place four Buy Limit orders below the current price and Sell Limit orders above the price.

    When one of the orders is triggered, the opposite series of positions should be deleted. Stop losses of all orders must be set at the same level, so if the price does not go in our direction, we can fix the losses and build a new grid of orders. The same applies to take profits. When the predetermined cumulative profit is reached, all orders must be deleted. If the first order worked and closed by take profit, then everything is clear here. If the price goes against us, then new trades will be opened, but to close trades at the total take profit, the price will need to travel a much shorter distance. This strategy works well for trading in calm markets with weak price movements and quick pullbacks, for example, during.

    Scripts for automatically placing a grid of orders

    In addition to manually placing pending orders, there are also special order grids, one of which is the SetGridOrders script. With it, you can place an unlimited number of pending orders. You just need to drag it from the "Navigator" to the chart, specifying the necessary settings for the following parameters in the window that opens:

      extern double Price – opening price of the first order;

      extern double Lot – lot size;

      extern int SetOrders – number of orders;

      extern int Step – distance between orders;

      extern int StopLoss – stop loss level;

      extern int TakeProfit – take profit level;

      extern bool GeneralProfit - total take profit, upon reaching which all orders will be closed;

      extern bool GeneralStop – total loss, upon reaching which all open positions will be closed and unworked pending orders will be deleted.

    You can also turn on a sound signal that will notify you when the first order is triggered. Having specified all the necessary settings, you should click OK, as a result of which a new window will open in which you will need to select the type of pending orders - stop or limit. Thus, this script will be useful for anyone and will greatly simplify manual trading.

    As can be seen from the descriptions of the strategies, trading with pending orders requires the trader to have maximum concentration and attention. You need to constantly monitor the current situation, add a new order in time if the strategy requires it, or delete the grid if the total take profit or loss is reached, and then add a new grid of orders to the chart. The script described above partially relieves you of the burden of placing orders, but this is just a script, not , it needs to be run manually each time a new grid of orders is built. We bring to your attention to consider one profitable Expert Advisor, which showed good work on the GBPUSD currency pair.

    This Expert Advisor is based on the principle of random walk of numbers - Brownian motion. When this Expert Advisor is installed on the chart, it splits the area around the price into two parts and places sell limit orders above the price, and buy limit orders below the price. The high profitability of the Expert Advisor is ensured by the use of , which is activated on non-recoil price movements. However, when losing trades appear, the lot is not doubled, as in most EAs based on the Martingale system, but by a certain coefficient specified in the PlusLot parameter, which makes the use of this EA less dangerous.

    Since the grid of orders is based on the difference in points between orders, it does not matter much, but it is best to install the adviser on M5 or M15. The Order Grid Expert Advisor can work in two directions at the same time. If multidirectional orders work, he will bring each of them to take profit, and if necessary, reopen the grid at new levels. The main disadvantage of this Expert Advisor is that in the case of a power or Internet outage, it does not “remember” which orders it has and which do not. Therefore, you have to delete the old grid of orders and restart the adviser. To prevent this from happening, we recommend installing the adviser on .

    The EA has the following settings:

      Orders - here you need to specify the maximum number of orders;

      lot1 – initial lot size for the first order in the grid;

      PlusLot – coefficient by which the initial lot will increase when losing trades appear;

      FirstStep - distance from the current price to the first order;

      Step - distance between orders;

      SLoss - stop loss size for each trade or for the entire grid;

      TProfit - take profit size for each trade or for the entire grid;

      ProfitClose - this parameter is responsible for closing all unidirectional orders when the total take profit is reached;

      TrailingPercent - the size of the total take profit that will be trailed, in percent;

      magic - unique number of the adviser;

      CloseEndWeek - when this parameter is activated, the adviser forcibly closes all orders at the end of the week;

      HourClose - this specifies the time to close all orders on Friday.

    As mentioned above, it is quite difficult to predict the direction of price movement, which is why gridders use a grid of orders to catch any price movement. However, in practice, a favorable scenario is extremely rare - which is the weakness of such strategies. The market is constantly changing, if yesterday one of the currency pairs was 200 points, now it does not exceed 50 points. Perhaps the whole point is in the incorrect determination of levels for placing pending orders. And all because before placing orders, no analysis is carried out and the grid of orders is placed at random. If trading with pending orders was carried out from significant levels, then it would bring much more profit. We propose to consider the FractalGrid grid Expert Advisor, based on the use of fractal analysis.

    The trading of this Expert Advisor consists in placing pending orders at the level of breaking through the fractal highs and lows. You can read about what fractals are and how to define them. It is recommended to use H1 as a working timeframe. There are two EA trading tactics:

      When a new fractal is formed, an unworked pending order is transferred from the old level to the new one;

      When a new fractal is formed, the old pending order is not deleted, but a new order is added to it.

    Let's move on to the description of the FractalGrid Expert Advisor settings:

      Lots – this parameter sets a fixed value of trading lots;

      Risk – if you put zero in front of the Lots parameter and specify the value of the Risk parameter, then the lot size for each new order will be calculated based on the current deposit size;

      RiskOnBalance – by setting this parameter to true, the lot size will be calculated based on the balance size, and by selecting the false mode, the amount of free margin will be taken as the basis;

      FractalPeriod - here you need to specify the period of the fractal, which must necessarily be odd;

      DeleteOldOrder - this parameter is responsible for choosing the tactics for placing pending orders, which was mentioned above. If you want to use the first tactic, then select true, and for the second tactic, specify false;

      The order grid strategy is not, but can be quite profitable. Depending on the state of the market, you can use a stop order grid - in the presence of a trend, or a limit grid - during a flat. To simplify the construction of a grid of orders, you can use scripts, as well as advisors. However, it is recommended to use gridded Expert Advisors only under the supervision of a trader in a semi-automatic mode. Good luck trading!



Liked the article? Share with friends!