Ea order correct tp and sl issue
Hi
I recommend normalizing the prices you use or even add some standardization based on ticks – to be sure that the prices you use are properly managed and allowed by the broker. So use NormalizeDouble (sl, _Digits).
But more important is to set sl/tp based on open price – so calculate both SL/TP based on the open price – do not change it to Bid/Ask prices. For example for this buy trade set SL as NormalizeDouble(Ask-StopLoss*Point(), Digits()) and tp as NormalizeDouble(Ask+TakeProfit*Point(), Digits()) – so use Ask in both calculations. If spread would be “0” the prices would be the same but I assume this is not the real spread here since you get those wrong prices as a result.
Best Regards
Hi
I recommend normalizing the prices you use or even add some standardization based on ticks – to be sure that the prices you use are properly managed and allowed by the broker. So use NormalizeDouble (sl, _Digits).
But more important is to set sl/tp based on open price – so calculate both SL/TP based on the open price – do not change it to Bid/Ask prices. For example for this buy trade set SL as NormalizeDouble(Ask-StopLoss*Point(), Digits()) and tp as NormalizeDouble(Ask+TakeProfit*Point(), Digits()) – so use Ask in both calculations. If spread would be “0” the prices would be the same but I assume this is not the real spread here since you get those wrong prices as a result.
Best Regards
It is the first time for me to post on the forum so please be indulgent if anything is wrong. Thank you very much for any help