annStDev = (StDev( portfolioEq, 2321 )) * sqrt( 252 );
---In amibroker@yahoogroups.com, <sladbrook@...> wrote :
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: rosenberggregg@yahoo.com
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (2) |
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/
EmoticonEmoticon