Bad Bars reading

 

I'm using an Expert Advisor which is attached to a chart.

Every new bar it has to real the last 5 bars of ALL timeframes of the same symbol. It comes that sometimes, on the other timeframes, the last bar ( index=1 ) results equal to its preceding bar ( index=2 ), which is a bad reading of chart bars. Read bars are then written on files.

The error never happens when i force bars export manually.

Which can be the cause? Maybe other timeframe bars are still not loaded while the EA is reading them?

 
Marco Strazzeri:

I'm using an Expert Advisor which is attached to a chart.

Every new bar it has to read the last 5 bars of ALL timeframes of the same symbol. It comes that sometimes, on the other timeframes, the last bar ( index=1 ) results equal to its preceding bar ( index=2 ), which is a bad reading of chart bars. Read bars are then written on files.

"Read" what exactly ?

The error never happens when i force bars export manually.

What that means ?
 

By "Read" i mean reading any value of the bar ( open, close, etc. ).

By "export manually" i mean clicking on a button on the chart which calls the exact same function, which is the one that read and exports data and generates the explained problem