Accessing more than 1000 data - page 2

 
MichelB :

All iFunctions trying to access datas with a "shift" higher than 1000 returns 0, and no one bar from W1 and MN1 is accessible.

From where those limitations are coming from ? and how to bypass them ???

Thank you for your reply !

Do you really want to get value from 1000-th bar on Mothly timeframe? See -> 1000 months ~ 83 years (1000 / 12)

Or may beyou have 1000 bars history on Weekly? Let's see -> 1000 week ~ 20 years (1000 / 52).

Do you understand what you want?


I tested your code:

#property copyright "Copyright © 2007, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

bool printed = false;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   Print("iBars M1: ", iBars(NULL, PERIOD_M1));
   Print("iBars M5: ", iBars(NULL, PERIOD_M5)); 
   Print("iBars M15: ", iBars(NULL, PERIOD_M15)); 
   Print("iBars M30: ", iBars(NULL, PERIOD_M30)); 
   Print("iBars H1: ", iBars(NULL, PERIOD_H1)); 
   Print("iBars H4: ", iBars(NULL, PERIOD_H4)); 
   Print("iBars D1: ", iBars(NULL, PERIOD_D1)); 
   Print("iBars W1: ", iBars(NULL, PERIOD_W1)); 
   Print("iBars Mn1: ", iBars(NULL, PERIOD_MN1));
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
   if (!printed)
      {
      Print("iClose(Symbol(),PERIOD_W1,1) = ", iClose(Symbol(),PERIOD_W1,1));
      printed = true;
      }   
//----
   return(0);
  }
//+------------------------------------------------------------------+


and what I got:


 
Rosh :
....

and what I got:

OK, but if you run it again few minutes later you will get another result, without the 1000 bars limit ; and after some more time another result again.
I do not need 20 years of history, but I need a relieble iBars() function, that means that iBars() returns just the number of bars of the history and NOT some fancy number depending from how long time I am using the backtester.
So, the question is simple: how can I know that the history is fully "pumped", that iBars() will return at each BT the same value, (eventually updated by the new bars) ?
Do you understand the problem ? If I have 5000 M1 bars in my history, when I wil be able to know iClose(NULL, Period_M1, 4000) ?
Its the topic of this thread, from where come this 1000 bars limitation and how to workaround ?
Thank you for your atention and your reply
 

My experience is very similar. This is happening for all currency pairs and all periods:

1) I start MetaTrader and connect to the Demo account (fictive money, real data)

2) iBars("EURUSD",PERIOD_M1): 2048

3) wait 5 minutes

4) iBars("EURUSD",PERIOD_M1): 2053

5) wait 10 minutes

6) iBars("EURUSD",PERIOD_M1): 2063

7) manually browse the graph - look at the history (about 3 days back in the past)

8) iBars("EURUSD",PERIOD_M1): 6294

- MetaTrader initially loads some amount of bars (my one does 2048 - probably depends on system/hardware configuration?)

- number of loaded bars is increasing with time - it doesn't load automatically more bars in the past, just the new ones - comming with time

- manual scrolling of the graph into the past and browsing history loads the past data and increases the number of loaded bars

My calculations are based on two weeks of data in the past. It was giving me weird results all the time. Finally I found that it was because the older bars were not there. I found two ways how to "load" the bars:

1. Wait 2 weeks for bars to load with time - great for bugfixing :D

2. Manually browse the graph into history of 2 weeks - this one is very unpleasant as I do trading with many pairs

I didn't find any other way how to get the bars automatically via code. Is there any procedure which can do that? If not, would it be possible to build in some into the MetaTrader? That would be much appreciated.

 

MetaQuotes, any ideas?

Cheers