it works for me..... AA window....current symbol....n last quotation....n =1
Anthony ----- Original Message ----- From: thomasdrewyallop To: [email protected] Sent: Saturday, December 29, 2007 2:17 PM Subject: [amibroker] Formula not working 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 ------------------------------------------------------------------------------ No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 269.17.11/1201 - Release Date: 12/28/2007 11:51 AM
