PureBytes Links
Trading Reference Links
|
Hello,
In the User's Guide Backtester Interface section, Stat object is says,
"Metrics are usually calculated once backtest is completed but it is also possible to calculate metrics during backtest. To calculate current metrics and get the access to them simply call GetPerformanceStats method of Backtester object. Please note that if you calculate statistics in the middle of the backtest they will include only closed trades."
I was hoping I could get access to the current long and short capital stats. The following code produces the correct results in AA window following optimization, but does not plot on the chart (values remain 0 ).
Is this feasible in any way? Or do I have to figure out (not likely at my skill level) how to control trades in the backtester procedure?
TIA,
Joe
//////////////////////////////////////////////////////////
Sp = Lp = 0;
SetCustomBacktestProc( "" );
if ( Status( "action" ) == actionPortfolio )
{
bo = GetBacktesterObject();
bo.Backtest();
stats = bo.GetPerformanceStats( 0 );
stats_long = bo.GetPerformanceStats( 1 );
stats_short = bo.GetPerformanceStats( 2 );
Longprofit = stats_long.getvalue( "EndingCapital" )
- stats.GetValue( "InitialCapital" );
bo.AddCustomMetric( "Long profit", Longprofit );
Shortprofit = stats_short.getvalue( "EndingCapital" )
- stats.GetValue( "InitialCapital" );
bo.AddCustomMetric( "Short profit", Shortprofit );
for ( i = 0; i < BarCount - 1; i++ )
{
Lp[ i ] = Longprofit;
Sp[ i ] = Shortprofit;
}
}
Plot( Lp, "Long profit", colorBlack );
Plot( Sp, "Short profit", colorBlack );
------------------------------------
**** 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/
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/
|