[amibroker] Annualized Standard Deviation?

 

Hi

I'd like to add code to my system for Annualized Standard Deviation. I'd like it printed out to the backtest report as a custom metric. I've been experimenting and cant get anything to work. Please help. Examples of my code, that DONT work, are below. The number 2321 represents the number of bars I have.


portfolioEq = Foreign( "~~~Equity", "C" );
annStDev = (StDev( portfolioEq, 2321 )) * sqrt( 252 );
StaticVarSet( "PortfolioEquity", annStDev );

SetCustomBacktestProc( "" );
if ( Status( "action" ) == actionPortfolio )
 {
 bo = GetBacktesterObject();
 bo.Backtest();
 annualSD = StaticVarGet( "PortfolioEquity" );
 bo.AddCustomMetric( "AnnStDev", annualSD );
 }



SetCustomBacktestProc( "" );
if ( Status( "action" ) == actionPortfolio )
 {
 bo = GetBacktesterObject();
 bo.Backtest();
 StaticVarSet( "PortfolioEquity", bo.EquityArray() );
 }

if ( Status( "action" ) == actionIndicator )
 {
 portfolioEq = StaticVarGet( "PortfolioEquity" );
 annStDev = (StDev( portfolioEq, 2321 )) * sqrt( 252 );
 //bo.AddCustomMetric( "AnnStDev", annStDev );
 }



Thanks for any help.


CK

__._,_.___

Posted by: sladbrook@hotmail.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/


.

__,_._,___

Related Posts


EmoticonEmoticon

:)
:(
=(
^_^
:D
=D
=)D
|o|
@@,
;)
:-bd
:-d
:p
:ng
:lv