validation error: no trading operations
Crispin Tibilla:
You already have the solution. I mean, that code snippet is okay, and it's needed for one to pass validation. So, don't worry, them trade levels needs be checked.my EA places buyStop and sellStop orders when certain criteria are met
after so many trials and errors, i realised the validation does not pass this line of code
but when that condition is removed, i get 'invalid price' errors during validation
but everything works fine on a my mt5 tester
Additionally, it is more safe for you to check also against the SYMBOL_FREEZE_LEVEL
thanks
i have fixed it now
i used only the freeze level as a check
double ask = NormalizeDouble(SymbolInfoDouble(_Symbol, SYMBOL_ASK), _Digits); double bid = NormalizeDouble(SymbolInfoDouble(_Symbol, SYMBOL_BID), _Digits); int freezeLevel = (int)SymbolInfoInteger(_Symbol, SYMBOL_TRADE_FREEZE_LEVEL); if(orderEntry-ask>=freezeLevel*_Point) result = m_trade.BuyStop(NormalizeDouble(buyLot, 2), NormalizeDouble(orderEntry, _Digits), _Symbol, NormalizeDouble(orderSL, _Digits), orderTP, ORDER_TIME_GTC, 0, "FVG"); if(bid-orderEntry>=freezeLevel*_Point) result = m_trade.SellStop(NormalizeDouble(sellLot, 2), NormalizeDouble(orderEntry, _Digits), _Symbol, NormalizeDouble(orderSL, _Digits), orderTP, ORDER_TIME_GTC, 0, "FVG");
Okay. You're welcome. Glad I could help.
my EA places buyStop and sellStop orders when certain criteria are met
after so many trials and errors, i realised the validation does not pass this line of code
but when that condition is removed, i get 'invalid price' errors during validation
but everything works fine on a my mt5 tester