Blog

Metatrader programming. Break Even

As well as Stop Loss, Break Even is a special case of Trailing Stop, which is created by means of mql programming and used in MetaTrader operations. The difference is that the Stop Loss value is set only once when the required level is reached and it does not change any more till the order is closed. Break Even allows to fix Stop Loss value at the break-even point.

Due to the features of mql programming a newly opened order has to surmount the spread which is a distance between purchase price and selling price to reach the break-even point. After this, the Stop Loss value needs to be fixed in this point. In this manner, if the price turns in the opposite direction then the order is closed with zero losses.

Break Even = Zero Loss

Break Even point can be fixed using automatic Stop Loss, which is developed using the mql programming. This is the most reliable method, which is commonly used in Metatrader. However, if broker configurations do not permit fixing this value so close to the current price then the closing can be done manually.

While using the products of mql programming, you can also combine manual Stop Loss and automatic one in the logic of Break Even, i.e., to close the order at the break-even point in any case, but to set the automatic Stop Loss if possible.

Example of the Break Even

Let’s look at an example with manual Stop Loss value. Break Even (BE)=0 pips. This means that the Stop Loss value will be set 0 pips higher than the break-even point. Current Bid price =1.4038, Ask=1.4040. We set a BUY order. We have the following characteristics of the opened order: opening price is 1.4040. Current profit is -2 pips. Closing point as per algorithm is set at the level of 1.4040, however, we have to remember that the algorithm will start operating only when the price surmounts this level.

The price increases by 10 pips. Current values of the order: opening price is 1.4040, Ask=1.4050, current profit is 8 pips. Requirements for triggering of the Break Even algorithm are met. We set Stop Loss to Break Even point. Now, when the price moves in the opposite direction and passes the BE level=1.4040, the order will be closed.

Break Even can be automatic or manual

The price lowered by 10 pips. Current values of the order: opening price is 1.4040, Ask=1.4040, current profit is -2 pips. Requirements for triggering of the Break even algorithm were met earlier. Order is closed as the price surmounts the BE level in the opposite direction.

In this example, we see the difference between conventional and automatic method of MetaTrader order closing, which are both executed with the help of mql programming. In automatic mode (Stop Loss=1.4040), the order was closed with 0 pips of profit. In our case the order is closed with -2 pips, because the closing method was manual.

***

In fact, Break Even is a special case of Stop Loss, but the individual term is used for convenience. Take Profit and Break Even can be combined in practice of mql programming.