Download MetaTrader 5
To add comments, please log in or register
Enable MQL5 Storage to store your source codes. It is free!
lukasz
52
lukasz 2014.02.19 10:46 

Can somebody tell me. Why im not able to fill tab[][] in below example ?????????

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
#property link      ""
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
extern int rsi_period = 14;
extern int max_vectors = 150;
extern int vector_length = 50;

int bars;
double tab[][];

int init()
{
   bars = Bars;
   return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
{
   return(0);
}
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+

void prepare_past(int index)
{
   for(int i = 0; i < max_vectors; i++)
   {
      for(int j = 0; j < vector_length; j++)
      {
         tab[i][j] = iRSI(NULL,0,rsi_period,PRICE_CLOSE, i*vector_length + j + index); // even: tab[i][j] = 4.0; prints 0.00;
         Print( DoubleToStr( tab[i][j] , 2 ) );
      }
   }
}

int start()
{
   if(Bars > bars)
   {
      prepare_past(3);
      bars = Bars;
   }
   return(0);
}
//+------------------------------------------------------------------+
Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2014.02.19 10:57  
raniel:

Can somebody tell me. Why im not able to fill tab[][] in below example ?????????

tab is an array of zero element size . . . there is nothing to fill.
lukasz
52
lukasz 2014.02.19 11:01  
Even this:
double tab[150][50];
will not resolve my issue.
Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2014.02.19 11:14  
raniel:
Even this: will not resolve my issue.
What is the value of bars ?
lukasz
52
lukasz 2014.02.19 11:40  
Solved: There was not enough data in tester history ;-). Thank you Raptor.
/
To add comments, please log in or register