Why do I get invalid price error !!!

Anil Varma -
514

Hi

Just a thought come to mind, if Bid has moved below SELL STOP Price on the very next bar, could that cause this error !!!

MF 0 14:50:44.317 AKT Algo v1.0 (US30,M5) 2021.10.01 04:05:00   capitalToRisk[49.92] pRiskPerTrade[0.010] slPoints[165] optimumLot[3.000000]

GE 2 14:50:44.317 Trades 2021.10.01 04:05:00   failed sell stop 3 US30 at 33857.5 sl: 33874.0 tp: 33771.4 [Invalid price] ... (Prices are Normalized with required Symbol Digits) 

FK 0 14:50:44.318 AKT Algo v1.0 (US30,M5) 2021.10.01 04:05:00   CTradeAKT::OrderSend: SELL STOP 3.00 US30 at 33857.5 sl: 33874.0 tp: 33771.4 [invalid price]

Any clues why I am getting invalid price error, yet ...

SL [33874.0] - SellStop [33857.5] = 16.5 positive pips || SellStop [33857.5] - TP 33771.4  = 86.1 positive pips

I am not sure, if I need to provide any additional information, so please let me know if any more information is needed.

regards.

Documentation on MQL5: Constants, Enumerations and Structures / Codes of Errors and Warnings / Trade Server Return Codes
Documentation on MQL5: Constants, Enumerations and Structures / Codes of Errors and Warnings / Trade Server Return Codes
  • www.mql5.com
Trade Server Return Codes - Codes of Errors and Warnings - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Vladimir Karputov
Moderator
273996
Check the specification of the symbol - there is a suspicion that the price may end in either .5 or .0 - for example 33771.5 or 33771.0
Anil Varma -
514
Anil Varma -  
Vladimir Karputov #:
Check the specification of the symbol - there is a suspicion that the price may end in either .5 or .0 - for example 33771.5 or 33771.0

Thanks Vladimir

I figured out, it was caused by Bid price being below the StopSell price ... as it took the trades where this was not true.

for _Digits, I had already taken care for find Symbol Digits and Normalize it before sending the order.