My EA
comes up with an error code of 4059
which means
that the OrderModify()
function is apparently not allowed in (back) testing.
Is there any way in which this could be allowed at all?
All I'm wanting to do is change the position to breakeven, when it gets 100 pips "to the good"
PrintFormat( "TKT[%.2d]OP:[%7.5f]SL:[%7.5f]CurrentPrice:[%7.5f]Stoplevel:[%.3d]FreezeLevel:[%.3d]",
aTicket,
anOpenPrice,
aCurrentSL,
anAskPrice,
stopLevel,
freezeLevel
);
SellMod = OrderModify( aTicket,
NormalizeDouble( anOpenPrice, Digits ),
NormalizeDouble( aNewSLPrice, Digits ),
NormalizeDouble( aNewTpPrice, Digits ),
0,
sellcolor
);
SendMail( "Notification of Order Modification for Ticket#"
+ IntegerToString( OrderTicket(), 10 ),
"Good news! Order Ticket#"
+ IntegerToString( OrderTicket(), 10 )
+ "has been changed to breakeven"
);
if ( !SellMod )
{ PrintFormat( "Order modification for ticket %10d has failed modify the order under the Error Code# %5d. Check MQL4 Documentation",
aTicket,
GetLastError()
);
result = false;
}