Hello,
I’m interested in writing a basic indicator that will show the average variation in the last X years between the previous and current month. This is the first draft, so is nothing fancy, however as simple as it sems it doesn’t show anything. (this code is written for a monthly timeframe).
Can someone help me check it?
Thanks!
For i=(Years-1) downto 0 do
BarsCalc=Month+12*i
PrevMonthCalc=BarsCalc+1
cummulatedRatioHigh=High[BarsCalc]/High[PRevMonthCAlc]+cummulatedRatioHigh
cummulatedRatioLow=Low[BarsCalc]/Low[PRevMonthCAlc]+cummulatedRatioLow
cummulatedRatioClose=Close[BarsCalc]/Close[PRevMonthCAlc]+cummulatedRatioClose
next
AverageHigh=cummulatedRatioHigh/Years
AverageLow=cummulatedRatioLow/Years
AverageClose=cummulatedRatioclose/Years
RETURN AverageHigh as "Average High", AverageLow as "Average Low", AverageClose as "Average Close"