- Brokers only keep data up to a certain amount of time in the past. It could be several years, or just a few months of M1 data. There is no pre-defined amount for this.
- Not every single bar has to have tick activity. Less active symbols can easily have gaps of no activity lasting more than a minute or longer which will result in missing M1 bars. So it is easily plausible that CADJPY can have less bars than CADCHF.
- Since there can be gaps in M1 bar data, when working with multi-currency, you have to align the data by checking the open time of each bar of each symbol in order to synchronise them.
- Brokers only keep data up to a certain amount of time in the past. It could be several years, or just a few months of M1 data. There is no pre-defined amount for this.
- Not every single bar has to have tick activity. Less active symbols can easily have gaps of no activity lasting more than a minute or longer which will result in missing M1 bars. So it is easily plausible that CADJPY can have less bars than CADCHF.
- Since there can be gaps in M1 bar data, when working with multi-currency, you have to align the data by checking the open time of each bar of each symbol in order to synchronise them.
Thanks for the reply Fernando.
1) in this case - i know the broker has enough history, as I am able to view the bars on the chart itself.
2) understand, but this will not affect the result of iBars return.
3) How does checking the open time synchronize the symbols?
I agree with most of what you are saying, however I am not comparing bars on CADJPY with bars on CADCHF. I am comparing bars on CADCHF in both instances.
ie...
Alert(iBars("CADCHF",1));
gives me a different value when I drag and drop it onto the CADJPY chart, as opposed to the CADCHF chart. So in my understanding the result "should" always be the same, but its not.
I think I misunderstood your original question. I was assuming that the two different bar counts was one for CADJPY bar data and the other for CADCHF bar data.
I believe I may have have misunderstood your original question.
This part I am not quite understanding what you saying.
Are you saying that you have opened two charts, one CADJPY and another CADCHF, and that you have scrolled to the beginning of each chart to make sure that all the data was loaded properly on the chart, and then you proceeded to run the script on each chart and the the result was different?
EDIT: Please note my emphasis on making sure that the data is properly loaded.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi there,
I'm running into problems creating an EA that runs through history, fetches a bunch of trade data and then exports that to Excel. The EA works fine except that I seem to be getting inaccurate data when I go back to around Nov 2021 in history on the M1 chart.
I have setup MT4 to show max bars in chart, and in history as follows:
I have also downloaded M1 history data for all the pairs I am using.
To test my issue, I wrote a simple script as follows:
When I apply the script to the "CADCHF" M1 chart, I get a response of 3127863.
When I apply the script to the "CADJPY" M1 chart, I get a response of 1759278.
This difference is clearly causing the inacurate data, but why on earth would the values be different, depending on which chart I apply the script to? Surely specifying the "CADCHF" should mean the values should always be the same?
Note: this does not seem to occur on the H1 timeframe with Alert(iBars("CADCHF",60));
Any idea's as to what's causing this and how to get around it?
Thanks
Richard