
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
How my code could work as I want and still have bug ?
I'll wade in on both sides of the argument. You are each defining the word "bug" very narrowly: either only as something which is causing a problem now (software doesn't meet current requirements); or as anything which might conceivably cause a problem in future (software wouldn't meet possible future requirements). The difference between those two is always in part a personal and subjective assessment of what may happen in future.
There are plenty of things which are not bugs but which are still bad code, because it is very likely that requirements or circumstances will change and cause problems.
For example, even if someone thinks they are certain that they will only want to trade EUR/USD, I would still suggest it is a bad idea to use a hard-coded NormalizeDouble(..., 5).
But is that scenario comparable to using NormalizeDouble() instead of rounding to tick-sizes? I would argue that it's not the same, on three grounds:
JC:
There are plenty of brokers whose tick-value figures for equity indices etc are wrong, because they are in the contract's base currency rather than the account's deposit currency, and widely referenced code on this forum will not work properly.
... If we're being strict, using MODE_TICKVALUE is a potential bug just like NormalizeDouble() is a potential bug. It will work in most cases but not all; similar to NormalizeDouble(). It is more reliable to get SYMBOL_CURRENCY_PROFIT and do your own conversion from that currency to the account deposit currency.
... If we're being strict, using MODE_TICKVALUE is a potential bug just like NormalizeDouble() is a potential bug. It will work in most cases but not all; similar to NormalizeDouble(). It is more reliable to get SYMBOL_CURRENCY_PROFIT and do your own conversion from that currency to the account deposit currency.
Nice
... the difference being that the documentation says that MODE_TICKVALUE should work. But not in the real world.
I know...all what you wrote above is right.
Still I noticed your initial answer was with NormalizeDouble(), just fixing the digits and avoid hardcoded parameter. May I ask you why ?
Still I noticed your initial answer was with NormalizeDouble(), just fixing the digits and avoid hardcoded parameter. May I ask you why ?
Why what? Why that answer instead of rounding to the tick size?
Why what? Why that answer instead of rounding to the tick size?
Yes. Just curious, feel free to not answer.
Yes. Just curious, feel free to not answer.
The OP was saying that he/she hadn't managed to spot any of the messages in the Experts log where MT4 was recording "...invalid price" (plus an error log from the EA itself). Under those circumstances it seemed best to keep things simple.
That's it.
We now have a good topic to use as reference