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

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



PureBytes Links

Trading Reference Links

Herman,

Try additionally including the flag to enable in backtest. Simply 
using atcFlagEnableInPortfolio may not be enough.

>From the user guide:
"AddToComposite function also detects the context in which it is run
(it works ONLY in scan mode, unless atcFlagEnableInBacktest or 
atcFlagEnableInExplore flags are specified)"

Mike

--- In amibroker@xxxxxxxxxxxxxxx, "Herman" <psytek@xxx> wrote:
>
> Thank you Tomasz, but this code still does not work. I changed the 
StaticVar
> to the Text type.
> 
> Can you help some more ... ?  or does anyone else see the problem?
> 
> TIA,
> Herman
> 
> StaticVarSetText( "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_" + StaticVarGetText
( "Symbol" ) +
> "_HISTORICAL", "X", atcFlagEnableInPortfolio | atcFlagDefaults );
> }
> PlotForeign( "~~~UI_HISTORICAL", "UlcerIndex Historical", colorRed,
> styleLine );
> 
> -----Original Message-----
> From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]
On Behalf
> Of Tomasz Janeczko
> Sent: July 24, 2008 3:00 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [SPAM]Re: [amibroker] How to save Metrics in Composites for
> Individual BTs
> 
> 
> The same code. The only distinction is that you need to run 
INDIVIDUAL
> backtest
> and use Static variable to save name
> 
> StaticVarSet Text ("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 Text 
("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
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/