DEFPARAM CumulateOrders = False
buy .2 contract at low[3]+2 stop
set stop loss 45
startBreakeven = 11 //how much pips/points in gain to activate the breakeven function?
PointsToKeep = 1 //how much pips/points to keep in profit above of below our entry price when the breakeven is activated (beware of spread)
startBreakeven1 = 11.5
//reset the breakevenLevel when no trade are on market
IF NOT ONMARKET THEN
breakevenLevel=0
ENDIF
// --- BUY SIDE ---
//test if the price have moved favourably of "startBreakeven" points already
IF LONGONMARKET AND close-tradeprice>=startBreakeven*pipsize THEN
//calculate the breakevenLevel
breakevenLevel = tradeprice+PointsToKeep*pipsize
ENDIF
//place the new stop orders on market at breakevenLevel
IF longonmarket and breakevenLevel>0 THEN
SELL AT breakevenLevel STOP
if close-tradeprice>=startBreakeven1*pipsize then
quit
endif
ENDIF
IF shortONMARKET AND tradeprice-close>=startBreakeven*pipsize THEN
//calculate the breakevenLevel
breakevenLevel = tradeprice-PointsToKeep*pipsize
ENDIF
//place the new stop orders on market at breakevenLevel
IF breakevenLevel>0 and shortonmarket then
exitshort AT breakevenLevel STOP
if tradeprice-close>=startBreakeven1*pipsize then
quit
endif
ENDIF