Hello altogether,
I try to develop myself an EA including the StochRSI indicator. Now i just want to modify the indicator a bit, and want to smooth it a bit by calculating the average,
of the last 10 values of the indicator. I tried it with this code of Buffer3[i]:
Now the Buffer3 gives always the value zero,although by the print the Buffer1 values are printed out correctly.
Can you see why its not working ?? Maybe i have to insert a loop ??
Cheers
Check the run-time errors (if you use strict mode) or check how many buffers you declared to be in use (if you don't use strict mode)
i declared enough buffers for sure. What do you understand with strict mode ?
I tried to use this solution now:
Buffer1[i]=((Current_RSI-Lowest_RSI)/(Highest_RSI-Lowest_RSI))*100; Buffer2[i]=sum_K/Percent_D; //Buffer3[i]=Buffer[i]+Buffer1[i+1]+Buffer1[i+2]+Buffer1[i+3]+Buffer1[i+4]+Buffer1[i+5]+Buffer1[i+6] //+Buffer1[i+7]+Buffer1[i+8]+Buffer1[i+9]+Buffer1[i+10])/11; if(counted_bars>0) counted_bars--; for(int j=1; j<limit; j++) Buffer3[j]=(Buffer1[i]+Buffer1[i+1]+Buffer1[i+2]+Buffer1[i+3]+Buffer1[i+4]+Buffer1[i+5]+Buffer1[i+6] +Buffer1[i+7]+Buffer1[i+8]+Buffer1[i+9]+Buffer1[i+10])/11; Print("buffer11:", Buffer1[i]); Print("buffer15:", Buffer1[i+5]); Print("buffer3:", Buffer3[j]);
But still the calculated value of Buffer3 is zero.
I also tried this version
for(int x=0;x<=Percent_K;x++){ Lowest_RSI=MathMin(Lowest_RSI,iRSI(NULL,0,RSI_Periods,PRICE_TYPICAL,i+x)); Highest_RSI=MathMax(Highest_RSI,iRSI(NULL,0,RSI_Periods,PRICE_TYPICAL,i+x)); } sum_K=0; for(x=0;x<=Percent_D;x++) sum_K=sum_K+Buffer1[i+x]; Buffer1[i]=((Current_RSI-Lowest_RSI)/(Highest_RSI-Lowest_RSI))*100; Buffer2[i]=sum_K/Percent_D; for( int f=0; f<limit; f++) { double r = iMAOnArray(Buffer1,0,period_MA,0,ma_method,i); double r1 = iMAOnArray(Buffer1,0,period_MA,0,ma_method,f+1); if (r<20) Buf1[f]=r;f] if (r>80) Buf0[f]=r; }
like i want to write the moving average into the Buf1[f]. But its not working as well.
Can somebody guess whats wrong. ?
cheers
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello altogether,
I try to develop myself an EA including the StochRSI indicator. Now i just want to modify the indicator a bit, and want to smooth it a bit by calculating the average,
of the last 10 values of the indicator. I tried it with this code of Buffer3[i]:
Now the Buffer3 gives always the value zero,although by the print the Buffer1 values are printed out correctly.
Can you see why its not working ?? Maybe i have to insert a loop ??
Cheers