Thanks Raptor and WHRoeder. Just a bit confused; you said it is a quick and dirty fix but on the NormalizeDouble page,it did says using this method to Normalize TP and SL. so this is not the orthodox method?
yuan83: Thanks Raptor and WHRoeder. Just a bit confused; you said it is a quick and dirty fix but on the NormalizeDouble page,it did says using this method to Normalize TP and SL. so this is not the orthodox method?
If you are trying to trade an instrument whose price changes in increments of 0.25 then NormalizeDouble() will not do what you need it to. For Forex it will work.
For example if you calculated a value of 9.30 and the instrument had a ticksize of 0.25 you would need to adjust this value from 9.30 to 9.25 NormalizeDouble() could not be used in this instance as it could only give you 9, 9.3 or 9.30
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Thanks both for your advice. I will look into them.
i am now getting another error when I backtest - invalid price 1.24985571 for OrderSend function - OrderSend error 4107.
Is it because there are too many decimal places?
Essentially, yes.
The quick and dirty fix is to use NormalizeDouble(value, Digits) on that value.
NormalizeDouble will change it to a power of 10. It must be a multiple of ticksize (for pending orders) and Metals are 0.25 not 0.10
Thanks Raptor and WHRoeder. Just a bit confused; you said it is a quick and dirty fix but on the NormalizeDouble page,it did says using this method to Normalize TP and SL. so this is not the orthodox method?
If you are trying to trade an instrument whose price changes in increments of 0.25 then NormalizeDouble() will not do what you need it to. For Forex it will work.
For example if you calculated a value of 9.30 and the instrument had a ticksize of 0.25 you would need to adjust this value from 9.30 to 9.25 NormalizeDouble() could not be used in this instance as it could only give you 9, 9.3 or 9.30
Noted, thanks. I saw WHRoeder's post on the other thread, so I believe it Can use that if need to.
for mql4, I shd normalise to 4 dp, right?
By the way, is there a command to track that a pending order has been activated? Other than use if price reaches buy stop price etc?
thanks
Noted, thanks. I saw WHRoeder's post on the other thread, so I believe it Can use that if need to.
for mql4, I shd normalise to 4 dp, right?
Hi WHRoeder,
I will try that out. Thanks. But for the case of a trade hitting stop loss, what can I use to identify that? Thanks
Raptor, thanks for the advice!