Just a suggestion, not checked or tested.
int uncalculatedBar = rates_total - prev_calculated; if(prev_calculated==0) uncalculatedBar--; //You may want to change this so that it doesn't calculate the first MA period bars for (int i = uncalculatedBar; i >=0; i--) deltaBuffer[i] = MovingAverageDelta(symbol, timeFrame, DELTA_Period, DELTA_Shift + i, DELTA_Method, DELTA_AppliedPrice, shift); for (int i = uncalculatedBar; i >=0; i--) smoothedBuffer[i] = iMAOnArray(deltaBuffer, 0, 3, 0, MODE_SMA, i);Edited to correct the error that William noticed.
smoothedBuffer[i] = iMAOnArray(deltaBuffer, 0, 3, 0, MODE_SMA, 0);You are placing the same value into each element.
Ok, thank You all for help. Turned out I misunderstood meaning of shift and MA_shift,
plus some minor mistakes with number of indicator_buffer and indicator_plot.
Two for loops helped. It turned out in one loop indicator had to fill deltaBuffer
and with full deltaBuffer I was able to calculate moving average.
I have one more question:
Its regarding MovingAverageDelta():
Is there some way to get access to previous calculated values of MA.
It seams waste of computing power and time to calculate MA two times.
PS.: Current result in attachment.
plus some minor mistakes with number of indicator_buffer and indicator_plot.
Two for loops helped. It turned out in one loop indicator had to fill deltaBuffer
and with full deltaBuffer I was able to calculate moving average.
I have one more question:
Its regarding MovingAverageDelta():
Is there some way to get access to previous calculated values of MA.
It seams waste of computing power and time to calculate MA two times.
PS.: Current result in attachment.
Files:
Przechwytywanie.PNG
42 kb

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
noisy result of my function. What am I doing wrong?