- Can someone please add time option to this ea
- Indicators: Asymmetric Trend Pressure
- Can someone please add time option to this ea
for(int i=0; i<limit; i++) { while(i>=0) { //---- ExtBuffer3[i]= iMAOnArray(ExtBuffer0,0,MA_Periods,mShift,MA_MODE, i); //---- i--; } }
Your for loop is increasing i, then the while is decreasing it, a never-ending loop
The while needs to be after the for loop
I replaced
for(int i=0; i<limit; i++) with for(i=0; i<limit; i++)
and it compiled without errors but still will not attach to chart and then MT4 goes unresponsive again.
Did it work for you? Or did you spot the error in coding?
Thanks for looking at this Gumrai. I pasted the above, replacing the previous code and on compiling got error message 'i' - variable already defined
I replaced
and it compiled without errors but still will not attach to chart and then MT4 goes unresponsive again.
Did it work for you? Or did you spot the error in coding?
It's still an infinite loop. As GumRai suggested, place the while after the for loop.
ExtBuffer0[i]=(OPEN+HIGH+LOW+CLOSE)/4; //---- if (ExtBuffer0[i]>0) { ExtBuffer1[i]=ExtBuffer0[i]; ExtBuffer2[i]=0.0; } else if (ExtBuffer0[i]==0) { ExtBuffer1[i]=0.0; ExtBuffer2[i]=0.0; } else { ExtBuffer1[i]=0.0; ExtBuffer2[i]=ExtBuffer0[i]; } // // } i=limit; //---- Addition Moving Average - latest attempt (does not work - MT4 becomes unresponsive) while(i>=0) { //---- ExtBuffer3[i]= iMAOnArray(ExtBuffer0,0,MA_Periods,mShift,MA_MODE, i); //---- i--; } //---- return(0); }
Thanks for looking at this Gumrai. I pasted the above, replacing the previous code and on compiling got error message 'i' - variable already defined
I replaced
and it compiled without errors but still will not attach to chart and then MT4 goes unresponsive again.
Did it work for you? Or did you spot the error in coding?
Glad you got it working now.
I spotted the error in the coding, didn't try the code
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use