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
tried ma1_1 = NormalizeDouble(iMA(100,MODE_EMA,PRICE_CLOSE,1),4) ; but i get errors. any other ideas?
thank you
todd
How bout simple algebra? If Ma1-Ma2>=.005 then buy, and if Ma1-Ma2<=-.005 then sell... Isn't that the simplest way to do it?
rondio, i thought you're talking in mql4. For mql2, just use Normalize() instead of NormalizeDouble()
How bout simple algebra? If Ma1-Ma2>=.005 then buy, and if Ma1-Ma2<=-.005 then sell... Isn't that the simplest way to do it?
You can use this way in real life calculation but in float number calculation in computer is different, the precision must be made clear. That's why MQ created Normalize() or NormalizeDouble() to round up float number in certain precision or digits.
If you don't believe me. Try below code in mql4. "INCORRECT" will appear on the chart. Isn't it weird that 3 * 1.2 does not equal 3.6?
The only work around to any float number problem is to round it up, so to just correct a simple calculation 3 * 1.2 = 3.6, we have to use NormalizeDouble(). The result is "CORRECT"
ma1_1 = Normalize(iMA (100,MODE_EMA,PRICE_CLOSE,1),4); i still have something wrong. i get an error. does this code look right?
Why don't u post all code, so that I compile for you?
Normalize(iMA(100,MODE_EMA,1),4)
Check the parameters when something wrong next time.
i think i might have got it to work using
ma1_1 = Normalize(iMAEx(100,MODE_EMA,0,PRICE_CLOSE,1),4);
complied with zerocode. i will let you know.
todd