winston:
The term in my EA 'if(CopyBuffer(handle,1,0,10,zm)<0)' works as expected and returns valid array variables.
When I attempt to shift the plot in my custom indicator using 'PlotIndexSetInteger(1,PLOT_SHIFT,10)' to show a future prediction, the term in my EA returns unitialised array values.
Any ideas how to resolve this other than by having a second array which is not shifted.
Read this topic https://www.mql5.com/en/docs/series/copybuffer
On error function CopyBuffer will return -1 and set LastError is not zero value.
It is small positive example for you
int OnStart() { int h1=iMA(_Symbol,_Period,13,0,MODE_EMA,PRICE_CLOSE); int h2=iMA(_Symbol,_Period,13,10,MODE_EMA,PRICE_CLOSE); if(h1!=INVALID_HANDLE && h2!=INVALID_HANDLE) { double a1[],a2[]; int cp1=CopyBuffer(h1,0,0,1,a1); int cp2=CopyBuffer(h2,0,-10,1,a2); } //--- return(0); }
Documentation on MQL5: Timeseries and Indicators Access / CopyBuffer
- www.mql5.com
Timeseries and Indicators Access / CopyBuffer - Documentation on MQL5
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
The term in my EA 'if(CopyBuffer(handle,1,0,10,zm)<0)' works as expected and returns valid array variables.
When I attempt to shift the plot in my custom indicator using 'PlotIndexSetInteger(1,PLOT_SHIFT,10)' to show a future prediction, the term in my EA returns unitialised array values.
Any ideas how to resolve this other than by having a second array which is not shifted.