Global variable to use in different function
Hi all
I've a global variable defined like this:
Then I've a function in my EA defined as follows.
Now I would like to use the variable ga_rates in the section onTick().
I do expect, that I receive 4 different values, but I only get one. It's always the open-value.
Anybody an idea?
Thanks for any help in advance.
FX_TA
Hello FX_TA!
It's easy, you're calling getBarInfo() when new bar shows up so naturaly you only got the first price of that bar which is the open.
When the first bar arrives Open=Close=High=Low, then they will all change except the open, of course.
Try geting the previous bar rates, ga_rates[1].open; ga_rates[1].close,... You will get all 4 prices correctly, or, remove the new_bar function.
Hope it helps, regards
Helghast
Hi Helghast
Thank you! Problem solved.
Best Regards
FX_TA

- Free trading apps
- Free Forex VPS for 24 hours
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi all
I've a global variable defined like this:
MqlRates ga_rates[];
Then I've a function in my EA defined as follows.
Now I would like to use the variable ga_rates in the section onTick().
I do expect, that I receive 4 different values, but I only get one. It's always the open-value.
Anybody an idea?
Thanks for any help in advance.
FX_TA