[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] How to save Metrics in Composites for Individual BTs



PureBytes Links

Trading Reference Links

The same code. The only distinction is that you need to run INDIVIDUAL backtest
and use Static variable to save name
 
StaticVarSet("Symbol", Name() );

// Demo trading system
Short = Cover = 0;
Buy=
Cross( MACD(), Signal() );
Sell=
Cross( Signal(), MACD() );


// Using the CBT to retrieve/save metrics
SetOption("UseCustomBacktestProc", True );
if( Status("action") == actionPortfolio )
{
  bo = GetBacktesterObject();
  bo.PreProcess();
  MyHistStat1 = Null;

  for(bar=0; bar < BarCount; bar++)
  {
   bo.ProcessTradeSignals( bar );
   stats = bo.GetPerformanceStats( 0 );
   MyHistStat1[ bar ] = stats.GetValue("UlcerIndex"); // any metric can be retrieved
  }

  bo.PostProcess();
  AddToComposite( MyHistStat1, "~~~UI_" + StaticVarGet("Symbol") + "_HISTORICAL", "X", atcFlagEnableInPortfolio | atcFlagDefaults );
}

PlotForeign("~~~UI_HISTORICAL", "UlcerIndex Historical", colorRed, styleLine );

__._,_.___

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

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

For other support material please check also:
http://www.amibroker.com/support.html




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___