Download MetaTrader 5

How to create a variable to point to double &close[] ?

To add comments, please log in or register
Publish your application in the Market - 7 million potential clients will see it
nicolasxu
296
nicolasxu 2015.04.14 08:12 
int OnCalculate(const int rates_total,       // number of available bars in history at the current tick
                const int prev_calculated,   // number of bars, calculated at previous tick
                const datetime &time[],      
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])   {

    double yy[];
    yy = close[]; // error here, "invalid array access"
    // question: how to create a variable to point to a reference to dynamic double array? 

    // so that the yy can be used in the following way:
    // yy[0], yy[1], ....

}

Aleksei Beliakov
24391
Aleksei Beliakov 2015.04.14 10:13  
i think you need to copy close[] to yy[]
Roberto Jacobs
46479
Roberto Jacobs 2015.04.15 07:56  
nicolasxu:
double yy[];
//yy = close[]; // error occurs because the variable yy is not invoked as arrays, whereas yy is declared as an array (double yy[];)
//should:
yy[0]=close[0];
yy[1]=close[1]; // etc
nicolasxu
296
nicolasxu 2015.04.18 08:43  
3rjfx:
double yy[];
//yy = close[]; // error occurs because the variable yy is not invoked as arrays, whereas yy is declared as an array (double yy[];)
//should:
yy[0]=close[0];
yy[1]=close[1]; // etc
I see. Thanks!
To add comments, please log in or register