There’s a few things that could give the Invalid Prices error from OrderModify.
1. If you are trying to modify price, SL, TP, with the same values as before.
2. If you are trading on an asset which tick size is not the same as the smallest increment of the least significant value, e.g. Nikkei 225 mini futures increments by 5, e.g. 16830 -> 16835. NormalizeDouble(calculated_value, Digits()) may return 16818, which is not a valid price to change SL or TP to. You’ll have to round to a valid price, e.g.
double tickSize = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_SIZE); double roundedValue = MathRound(calculatedValue / tickSize) * tickSize; //you may want to round up or down according to your needs
No comments yet.