Hi guys,
I seem to be having a problem that I cant seem to resolve. I basically have a function that plots the percentage change of the weighted close of the current bar against the MA of a certain period. There is also a loop to smooth the result.
The part I seem to have problems with is; MovAvgSlow = iMA(Pair, 0, MAPeriod, 0, MAType, MAMode, Shift + i);
If I replace "Shift + i" with 0 it seems to plot but it wont if I leave it in there. Obviously I cant have zero as it will only plot against the MA for the last candle.
All the variables have been declared and I can return MovAvgSlow as it appears but for some reason it wont do the Strength calculation with the MovAvgSlow shift set to "Shift + i"
"Shift" is passed to the function as the most recent candle position and "i" is to smooth the result.
Any ideas why am having problems?
Thanks in advance.
Cheers,
Sheefy
I seem to be having a problem that I cant seem to resolve. I basically have a function that plots the percentage change of the weighted close of the current bar against the MA of a certain period. There is also a loop to smooth the result.
Inserted Code
for (int i = 0; i < Smoothing; i++) { MovAvgSlow = iMA(Pair, 0, MAPeriod, 0, MAType, MAMode, Shift + i); WeightedClose = (iHigh(Pair, 0, Shift + i) + iLow(Pair, 0, Shift + i) + 2 * iClose(Pair, 0, Shift + i))/4; Strength += (WeightedClose - MovAvgSlow)/MovAvgSlow * 100; } Result = Strength/Smoothing; return (Result);
If I replace "Shift + i" with 0 it seems to plot but it wont if I leave it in there. Obviously I cant have zero as it will only plot against the MA for the last candle.
All the variables have been declared and I can return MovAvgSlow as it appears but for some reason it wont do the Strength calculation with the MovAvgSlow shift set to "Shift + i"
"Shift" is passed to the function as the most recent candle position and "i" is to smooth the result.
Any ideas why am having problems?
Thanks in advance.
Cheers,
Sheefy