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
Thanks Nicholi for that more streamlined code. After some experimenting, I found that declaring ask_diff as float produced differences with the correct number of digits but a compile error about possible data loss from type conversion. It looks like I have to choose between have very small inaccuracies in my differences or having a compile warning. The latter would be better for trading decisions, but does anyone else have a solution to get at most five decimal places in ask_diff?
your ask_diff should be type int and look like this instead.
I just discovered NormalizeDouble and DoubleToString. Hey, it's my first day at this...
As often happens, the code was doing what it was supposed to instead of what I wanted it to do. The logic requires tick_prev to always be populated but is not true on the first tick. I am interested in a logic that does not require tick_prev to be populated on the first tick, but otherwise this works.
As often happens, the code was doing what it was supposed to instead of what I wanted it to do. The logic requires tick_prev to always be populated but is not true on the first tick. I am interested in a logic that does not require tick_prev to be populated on the first tick, but otherwise this works.
This is a level of coding that I aspire to achieve. Thank you Ernst!
You don't want to store the point difference as a double since doubles are rarely equal. You want to store it as an integer value. For example (1.00001 - 1.00000) / 0.00001 = 1 point. So if you only were comparing two ticks then you can make your code more compact and just subclass MqlTick and add an int attribute for the point diff.