Nurudeen Amedu:
when i call the attached indicator during run time like this:
double buff[];
CopyBuffer(hHandle,0,0,Bars(_Symbol,_Period),buff);
double UL = buff[Bars(NULL,0)-1];
CopyBuffer(hHandle,1,0,Bars(_Symbol,_Period),buff);
double UD = buff[Bars(NULL,0)-1];
CopyBuffer(hHandle,0,0,Bars(_Symbol,_Period),buff);
double UL = buff[Bars(NULL,0)-1];
CopyBuffer(hHandle,1,0,Bars(_Symbol,_Period),buff);
double UD = buff[Bars(NULL,0)-1];
it works for a while but after 1 or 2 hours i get array out of range error and the EA is removed from chart
how can i fix this
You need to check the return value of CopyBuffer(), then act accordingly.
Not directly related but : Bars() is a function, you called it 4 times with the same parameter, call is once and record the value in a variable.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
when i call the attached indicator during run time like this:
CopyBuffer(hHandle,0,0,Bars(_Symbol,_Period),buff);
double UL = buff[Bars(NULL,0)-1];
CopyBuffer(hHandle,1,0,Bars(_Symbol,_Period),buff);
double UD = buff[Bars(NULL,0)-1];
it works for a while but after 1 or 2 hours i get array out of range error and the EA is removed from chart
how can i fix this