Libraries: SL_Breakeven

 

SL_Breakeven:

The function for moving an open position to a breakeven.

Author: Alexey Viktorov

 

Alexei, the EA description is quite minimal, what in Russian do these two lines do?


input int     LevelBreakeven  = 70; // Distance to travel in breakeven
input int     StopLoss_Pips   = 30; // Distance from stop loss to price open
 

The inbuilt translator translates as follows

input int     LevelBreakeven  = 70; // Distance to breakeven
input int     StopLoss_Pips   = 30; // Distance from stop loss to opening price

It means that if the price passes 70 pips towards profit in 5-digit quotes, the Stop Loss will be placed at a distance of 30 pips from the opening price in order to compensate for slippage. Actually, the code of the library was placed. And the Expert Advisor is only to demonstrate the use of this library.

 
There will be an error of order change if StopLoss_Pips is set more than LevelBreakeven (the error will occur until gapBU is equal or greater than StopLoss_Pips, as a result, the order change will occur and SL will be set in line with the current price, which will most likely lead to almost instantaneous closing of this order). It is necessary to insert a check or change the calculation of newSL so that StopLoss_Pips would be the distance not from the opening price but from the current price.