Reputation: 1571
I'm building my first indicator. I want to retrieve all the historical bars of a symbol in some graphical period; in concrete in H1
timeFrame.
But the next code returns very different results, depending of the Symbol()
.
For example, for USDCHF, it returns 19752, which seems to be correct;
but, for EURUSD, it returns only 2047, which, for me, seems rather a few bars.
int totalBars = Bars( Symbol(), PERIOD_H1 );
Any help will be appreciated.
Thanks!
Upvotes: 1
Views: 1348
Reputation: 1
Typically, until you hit a "ceiling", pre-set in MT4/Terminal settings, the number of Bars changes. From small numbers up. Say from a few thousands to more than 1.000.000 bars, if one wishes ( and takes care ).
Once you are comfortable with loading OHLCV-datapoints from your Broker, there is one more speciality in how #indicators
handle their MQL4
code-execution, which is different from any your prior experience with {
Script
| ExpertAdvisor
}
code, but will not complicate the story right in the start.
Well, your next surprise for today, webmeiker
MQL4
code cannot on it's own explicitly manage data access.
In principle, Broker defines it's data-retrieval policy. MT4/Terminal piece of software runs a localhost
part of the circus.
A Graph constitutes a view into a (hidden) model.
F2
may introduce you to the History Center
interface, which may help you inspect how deep into past your Bar-inventory goes.
Well, the ALL itself is not under your control.
If and only if your Broker allows, you may do a few tricks to receive more "historical" datapoints.
Time, as usual, works against you in this dilemma. After some time, Broker need not allow you anymore to re-load history and your "missed" part of the OHLCV
-world will then remain un-retrievable.
So a due care is in place.
If interested in how to load more bars from your Broker, do not hesitate to raise a question on this trick.
Upvotes: 3