**about spread** :

in metatrader5 : its work , as below:

int OnCalculate(const int rates_total,const int prev_calculated, const datetime &Time[], const double &Open[], const double &High[], const double &Low[], const double &Close[], const long &TickVolume[], const long &Volume[], const int &Spread[]) { . if (!ArrayGetAsSeries(High)) ArraySetAsSeries(High,true); . . Comment("" ,"\n High[0]=",High[0] ,"\n Spread[0]=",Spread[rates_total-1] ,"\n Spread[1]=",Spread[rates_total-2] ,"\n Spread[2]=",Spread[rates_total-3] . . .

and i have this :

///////////////////////////

but for metatrader4 : it does not work . see below;

int OnCalculate(const int rates_total, const int prev_calculated, 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[]) { . . . Comment("\n" ,"\n high[0]=",high[0] ,"\n Spread[0]=",spread[0] ,"\n Spread[1]=",spread[1] ,"\n Spread[2]=",spread[2] . . . );

the code doesn't have error/warning but in Experts tab i have : " array out of range in 'PipValueCalculatorV1_02 2.mq4' (90,35) ".

////////////////

where is the problem ?

hi

for a specified time , for example 1 day before , or 4h ,

is there average spread function, for mq4 ?

or can have it .? how can have such this ?