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
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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