Back Testing Adding Additional columns

Is it possible to add additional columns in the backtest result list through AFL. For example generally there are columns for Symbol,Trade,Date,Ex.date,Ex.price.... suppose I want to add my Target1 value as an additional column in the back test result window.

Yes it's possible. Read this: https://www.amibroker.com/guide/a_custommetrics.html.

Hi!
I want to do the same in the Explore mode. Here is my code:

f ( Status( "action" ) == actionExplore ) 
{     
    AddColumn( H, "High" );
    AddColumn( ATR(14), "ATR" );
    Filter = 1; 
} 

It is easy to add any column using "AddColumn". But I cannot find how to get some values to populate in the list using "AddColumn".

For example, I want to add a column (in the explore) to add "Ex. Price", "Ex. date" same as what I got when I Backtest mode. Something like:

AddColumn( price, "Ex. Price" );
AddColumn( date, "Ex. Date" );

In general, how can I add any column of backtesting mode to Explore mode.

Thanks.

Do not use explore but backtest.:wink:

Else check out Equity function.
https://www.amibroker.com/guide/afl/equity.html

And

Filter = Buy OR Sell;
AddColumn( IIf(Sell, Sellprice, Null), "Ex. Price" );
AddColumn( IIf(Sell, Datetime(), Null), "Ex. Date", formatDateTime );
3 Likes

Hi codejunkie, thanks for your reply.

I am not sure if I understand your reply.
This gives the entry date and not the exit one

AddColumn( IIf(Sell, Datetime(), Null), "Ex. Date", formatDateTime );

If my system closes a trade either on SL or TP, then "SellPrice" cannot be restored by what you suggest!

what I need to add the columns which return Exit date, Profit, Shares and Trade.

I also add the "AddColumn" to my code, but couldn't manage to add any column on backtest while it works on Explore.
Thanks again,

@Oscar: Did you read the link above on custom metrics? Adding columns to the backtest output is done differently than adding columns to an exploration.

Also, @codejunkie is correct when he told you that if you want to see backtesting results then you should run a backtest, not an explore. There's a lot of additional work that goes on during a backtest to determine whether your entry signals really result in a new trade, when to exit and at what price, what the trade profit is including commissions, etc.

1 Like