PureBytes Links
Trading Reference Links
|
I have been able to add custom metrics to the Optimization Reports, but for some reason can't add a column to the Trade List Backtest report. Hoping someone might be able to chime in here, as the custom backtester confuses me.
What I want to do is fairly simple. In my actual trading system, I cycle through hundreds of possible conditions per bar. If any one condition is true, then I Buy. I want to add a custom metric to the backtest report that lists which condition generated the Buy signal.
For the sake of debugging, below is a very simplified AFL (not my actual system). I simply want to feedback the condition number into the backtester. But it does not work. If I add an optimize statement at the top, it will add the custom metric to the Optimization report. But even then that column does not reflect correct values.
So how do I add the column to the Backtest report? I would have thought the below code would do the trick. And how do I feedback the correct values? Perhaps I need to FPUT each condition, during the loop, to an external file, then FGET the file for every trade in the backtester? That might work, but feels inefficient:
//------------------------------------------------------------------------ // SIMPLE TRADING SYSTEM BASED ON VARIOUS CONDITIONS //------------------------------------------------------------------------
FastMA = MA( C, 10 ); SlowMA = MA( C, 20 );
Condition1 = Cross(FastMA, SlowMA); Condition2 = Cross(SlowMA, FastMA); Condition3 = Cross(C, SlowMA); Condition4 = Cross(SlowMA, C );
for(a = 1; a < 5; a++) { Condition = VarGet( "Condition" + NumToStr( a, 1.0, 0 ) ); Buy = Condition; Sell = BarsSince(Buy) > 12; }
//--------------------------------------------------------------------------- // WANT TO ADD THE CUSTOM COLUMN, "CONDITION" TO BACKTEST REPORT //---------------------------------------------------------------------------
SetCustomBacktestProc( "" );
if ( Status( "action" ) == actionPortfolio ) { bo = GetBacktesterObject(); bo.Backtest( 1 ); // Call Backtest but set NoTradeLists to true bo.AddCustomMetric( "Condition", a, 0,0,0 ); // Add the custom metric bo.ListTrades(); // Now generate the backtest report with custom metric }
__._,_.___
**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
*********************
TO GET TECHNICAL 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
*********************************
__,_._,___
|