The script will help you place all pending orders and teach you the basics of working with them.  Order grid strategy - profitable trading with pending orders Script for opening pending orders

The script will help you place all pending orders and teach you the basics of working with them. Order grid strategy - profitable trading with pending orders Script for opening pending orders

Trading position in other words is called a trading order (order). An order is an order to open or close a trading position in the broadest sense.

Orders can be either simple (you can order to open or close a trading position at any price), or complex (such that they are valid only for a certain time, are triggered when the instrument reaches a certain price, or with some additional conditions. This was the case before. Even and 100 years ago Little has changed at the present time except that trade is now largely computerized.

To simple methods orders include market orders. To complex - deferred. Let's consider them in more detail. For example, you do not have the opportunity to constantly monitor the development of the price of a financial instrument. But there are intentions:

    open a trading position;

    close a trading position;

    add volume to an already open trading position;

    reduce the volume of a previously opened trading position;

There are such main types of pending orders as STOP and LIMIT.
STOP orders include:

  • BUYSTOP - open a BUY order for the instrument above the current price at the specified level;
  • SELLSTOP - open a SELL order for an instrument below the current price at the specified level;

LIMIT orders include:

  • BUYLIMIT - open a BUY order for the instrument below the current price at the specified level
  • SELLLIMIT - open a SELL order for the instrument above the current price at the specified level.

In addition, pending orders in MT4-5 can be entered Extra options expiration. You specify the date and time when the order becomes irrelevant.

When you need to quickly place a pending order, but it is extremely inconvenient to calculate in your mind and indicate the price of the order, it all takes a lot of time, and time is one of the main factors for an ideal entry, so we recommend using scripts or advisors for quick and easy placement of pending orders (BuyStop, BuyLimit , SellStop, SellLimit), which allows you to set pending orders with one mouse movement, simply by dragging the script to the desired level on the chart.

  1. SetOrderBuy and SetOrderSell scripts

  • Script SetOrderBuy sets pending orders of the BuyStop or BuyLimit type.
  • Script SetOrderSell sets pending orders of the SellStop or SellLimit type.

2. Scripts bvnopen, bvnbuy, bvnsell and bvnpending

Scripts are designed to open pending orders different ways(dragging the script with the mouse, calling the script with a hot key),

Script parameters:

    Risk - transaction risk as a percentage of the deposit balance;

    Lot - number of order lots;

    OrdersNumber - number of orders;

    StopLoss - Stop Loss level in points;

    StopLossPrice - Stop Loss level by price;

    TakeProfit - Take Profit level in points;

    TakeProfitPrice - Take Profit level by price;

    BuySell - buy (1) or sell (-1), if the 0-direction is determined by the place where the script is inserted on the chart (see below);

    UserComment - comment to the order.

    Magic - a magic number that can be used to work with Expert Advisors.

The only difference between the bvnopen, bvnbuy and bvnsell scripts is the different recompiled value of the BuySell parameter. Since the first one is designed to work with the mouse, this parameter value is 0, so for the other two it is 1 and -1, respectively, since they are intended for use with hot keys, separately for buying and selling.

A separate purpose of the bvnpending script is to open pending orders. It can only be used with the mouse, and the order type is determined by a combination of two circumstances: what is the value of the BuySell parameter (must be set, otherwise it will not work) and where the script is dropped on the chart, above or below the current price. For example, if BuySell is equal to -1, then it will be a sell order, while if it is below the price, then SELL STOP, and if it is higher, then SELL LIMIT.

An interesting feature of all scripts from the set is the use of global terminal variables to configure script parameters, while using a weighted priority system so that you can set different values ​​for different conditions. Variables have the following format:
bvnopen.varname

Thus, the action of a variable with the specified designation financial instrument has a higher priority than is possible without such a designation. Therefore, different parameters can be configured for different pairs.

List of global variables used by the script:

    DnDLevel is one of the key variables in the script when using the mouse. By default, this parameter is 0, and in this mode, the place where the script is inserted determines only the trading direction: above the price on the chart - buy, below - sell. Stop Loss and Take Profit levels are not set if they are not set by script input parameters.

    • If you set this variable to 1, then the Take Profit level will be set at the script injection point, provided that they are not set by the script parameters, that is, the input parameters take precedence over the script injection point. The choice of trade direction remains the same as with a value of 0.

      If you set the value to -1, then the definition of the trading direction is inverted: above the price on the chart - sell, below - buy, and the script face-off point determines the Stop Loss level, provided that they are not specified by the script input parameters, that is, the input parameters take precedence over script injection site

    LotMagnifier - this variable sets the coefficient for the number of lots, i.e. if you set it to 0.01, then you can simply enter 1, 2, 4, etc. to get lots of 0.01, 0.02, 0.04, etc.

    Risk - This variable takes precedence over any set trade volume values, but it also requires a Stop Loss level to be set. If this is not set, then this variable (as well as the input parameter) is ignored. The following priority is used to set the risk level:

    • the value set by the Risk variable for a particular instrument;

      the value set by the Risk variable globally;

      the value of the input parameter Risk.

    Lot - this variable allows you to simply hardcode the size of the deal, and then neither the value specified in the input parameters, nor the coefficient will have any effect, that is, we can say that the following priority is used to set the number of lots:

    • the value calculated according to the set Risk parameter;

      the value set by the Lot variable for a specific instrument;

      the value set by the Lot variable globally;

      the value of the Lot input parameter multiplied by the value of the LotMagnifier variable for a particular instrument;

      the value of the Lot input parameter multiplied by the value of the LotMagnifier variable globally;

      the value of the Lot input parameter.

    StopLoss - a variable that sets the Stop Loss level by the number of points and it has priority over the corresponding input parameter, but not over the StopLossPrice parameter. The complete list of priorities will look like this:

    • the value of the input parameter StopLoss, if different from 0;

      value of input parameter StopLossPrice;

      the value set by the StopLoss variable for a specific instrument;

      the value set by the StopLoss variable globally;

      the place where the script is inserted into the chart.

    TakeProfit - a value that sets the Take Profit level by the number of points. The order of priorities is similar to the previous case.

    OrderNumber - this variable can be used to set the number of orders to be opened. It takes precedence over the corresponding input parameter. This feature can be used when it is necessary to bypass the limit on the maximum number of lots. For example, according to the competition rules, you can open 5 orders with a maximum lot of 1. You would like to open one order with a lot of 5, but you have to break one order into 5 separate orders.

    Magic - this variable, as well as the corresponding parameter, sets the magic number of the order, which can be used together with Expert Advisors.

    Sound - this variable enables (1) or disables (0) the sound signal (clap) when the script is executed.

    At first glance, it may seem too complicated, but it's worth a try, maybe you'll like it.

    You can use these scripts on the hot keys ATL+B and ATL+S.

Monday, August 27, 2018

Manual trading in the Forex market is painstaking work that requires mental effort and time. This is especially true for scalpers and other traders who use foreign exchange market lower timeframes. There are ways to automate routine actions of the same type. For this purpose are used scripts. What are they and how to use them? How to simplify placing pending orders with a script? How to install the program in the broker's trading platform?

Forex scripts - what is it?

Scripts are trader's assistants that automate the usual routine processes, such as closing a large number of transactions with one click or placing stop orders. This is a regular program written in the same programming language as an Expert Advisor or an indicator. Scripts are less popular only because of the lack of sufficient knowledge of their capabilities among traders. How does the script work?

Unlike the Expert Advisor, which also works in automatic mode according to a given algorithm, the script works a little differently. It is aimed at a one-time action. In order to perform the action again, you will have to re-run the script. Only then will he do it again. necessary actions, which are embedded in its algorithm.

Scripts cannot be called a miraculous pill that can work on the foreign exchange market instead of a trader. They have enough limited opportunities, however, it is hard to overestimate the help they can provide to a trader. So, you can delete pending orders using scripts and create a grid from them, close only profitable deals, delete all constructions from the working chart currency pair, set a stop loss at breakeven, and so on. The script functions for traders who prefer active trading are more than enough to simplify the work.

Installing scripts in the trading terminal

Install script to trading terminal as simple as an indicator or an adviser. It is necessary to act according to the same algorithm. Initially, you need to open the "File" menu and select the "Open data directory" item. This will take you to the root directory of the trading platform (terminal installation folder).

In the folder that opens, select the MQL 4 folder and place the script file in the appropriate folder. She and is called - Scripts. After restarting the trading platform, the script will appear in the corresponding drop-down menu in the navigation window of the MetaTrader 4 trading platform. To activate it, you need to drag the script onto the working chart. After these steps, he is ready to go. This is how it looks in practice (screenshot from the terminal of the company Forex4You).

Pending orders

There are a lot of tools for automatically placing pending orders with a script, both simple and complex. The script called Remove Pending Order removes all pending orders on its own. It does not need to be configured (it has no settings options).

The Open Buy Sell Order script is able to open two pending orders in the opposite direction. The reference point is the current price. It has customizable options. If you use trading strategies based on breaking through levels, a price corridor, then you will surely appreciate such a script.

The following script can open a grid of pending orders in one go. Its name is OpenStopOrderNet. It has several customizable options. You can set the size in settings. stop loss and take profit in points. If you specify the number 0 in this line, no losses and profits will be fixed. You can also specify in the settings the maximum number of orders in the grid, the distance between them, the volume of the transaction and the type of order (Sellstop or Bystop).

Another script called CloseStopLimitOrders ensures that all orders are closed. It does not need to be configured, since it does not have parameters for configuration.

The following pending order script called cm script OpenGread also performs the function of opening a grid of orders, but it has a larger set of functions. So with its help, you can set the time of placing an order and its lifetime, different distances between transactions, the coefficient of increase in the lot of opened orders, the number of attempts that the script must make before opening a transaction.

The algorithm of the scripts is similar to the algorithm of the Expert Advisors, however, the scripts are designed only to simplify and facilitate the work, and all responsibility for financial results lies with the trader. With their help, you can automate only part of the processes, but they only mechanically perform the task, and this is different from advisors.

Remember that the profitability of trading is very dependent on

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 to delete earlier open 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 I want to tell you about a useful tool. It is useful for those traders who have order grid is the basis of the trading system. Since this strategy involves opening a large number orders, doing the work with your hands is difficult. This requires a lot of time and attention. Using the script will greatly facilitate the work of the trader. , which applies order grid, does not require deep knowledge of the market. The behavior of the price in this case does not really matter. It is built on mathematical calculations that allow you to "catch" the price.

The essence of trading on a grid of orders

It is as follows. Pending orders are placed at a certain distance from each other (grid step). The direction of opening deals is chosen by the trader. It can only be BUY orders or only SELL orders. But in practice, pending orders are more often placed in both directions from the current price, that is, both for buying and for selling.

Now let's talk about a script that can successfully complete this task. In order to install it in the trading terminal, we use the usual scheme of actions. The copied script file is placed in the MT4 "Scripts" folder. More detailed instructions can be read in the article.
And then, in the “Navigator” terminal menu, select “Scripts”, and in it “Grid” and drag the script onto the chart of the pair we are going to trade.

The success of trading is largely related to the correct selection of script parameter values.

First you need to specify the grid step in points - the Steps parameter. Another important parameter is Volume. This is the volume of each transaction. Then we tell the script the minimum deviation from the current price in points - the Price parameter. Next is the Slippage parameter. It defines the allowable slippage in points. Specify the size of the take profit and stop loss in the corresponding lines of the script settings. And the last parameter is Count Orders. In it, you need to put a number that will correspond to the number of orders to be opened. What should be borne in mind that if it is supposed to open trading orders in both directions (both SELL and BUY), then if the parameter value is 5, the script will open five BUY orders and five SELL orders. You can choose the direction of transactions in the general settings of the script.

As you can see, there is nothing complicated in the settings of this script. Before using it in real trading, we will definitely try its operation on a demo account. There you can also choose the optimal parameters.

Script order grid download.