Luis Alejandro Diaz Vidal:
Why this is happening?
http://screencast.com/t/IVUWE3n2
I use the next codeline but some values are correct and others not, why it could be?
NormalizeDouble(value,1);
It's to do with how the values get stored in binary. There has been a rather protracted discussion about this on another thread yesterday.
For example, you might think you can store 0.1 exactly. Unfortunately, you can't.
double value=0.1;
printf("%.20f",value);
printf("%.20f",value);
Result: 0.10000000000000000555
This is a good explanation of why that happens.
The solution is to accept that many numbers don't have a finite representation in binary and just control the output when you want to display the number e.g.
DoubleToStr(value,1);
Do NOT use NormalizeDouble, EVER. For ANY Reason. It's a kludge, don't
use it. It's use is always
wrong
- SL/TP (stops) need to be normalized to tick size (not Point.) (On 5Digit Broker Stops are only allowed to be placed on full pip values. How to find out in mql? - MQL4 forum) and abide by the limits Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial and that requires understanding floating point equality Can price != price ? - MQL4 forum
- Open price for pending orders need to be adjusted. On Currencies, Point == TickSize, so you will get the same answer, but it won't work on Metals. So do it right: Trailing Bar Entry EA - MQL4 forum or Bid/Ask: (No Need) to use NormalizeDouble in OrderSend - MQL4 forum
- Lot size must also be adjusted to a multiple of LotStep. If that is not a power of 1/10 then NormalizeDouble is wrong. Do it right.
LoL guys you have been very helpfull!
Thanks a lot.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Why this is happening?
http://screencast.com/t/IVUWE3n2
I use the next codeline but some values are correct and others not, why it could be?