Any ideas on why this formula returns nothing for the variable
"Mean
Return"?
_SECTION_BEGIN("Close-Close
Volatility");
Filter = BarIndex() > 252;
nPeriods =
Param("Volatility Period", 5, 5, 252, 5);
LogReturn = ln (Close /
Ref(Close, -1));
MeanReturn = Sum (LogReturn, nPeriods) / (nPeriods
-1);
ReturnVariance = Sum ((LogReturn - MeanReturn) ^ 2,
nPeriods);
Volatility = sqrt ((252 / ( nPeriods - 2)) *
ReturnVariance);
Plot(Volatility , "Volatility Periods (" + nPeriods +
")",
colorOrange,
styleLine|styleOwnScale);
AddColumn(Close,"Close",1.4);
AddColumn(Ref(C,-1),"c-1",1.4);
AddColumn(LogReturn
,"LogReturn",1.9);
AddColumn(MeanReturn
,"MeanReturn",1.9);
AddColumn(ReturnVariance ,"ReturnVariance
",1.9);
AddColumn(Volatility ,"Volatility
",1.9);
_SECTION_END();
Many thanks for your help.
Drew
Yallop