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

[amibroker] Re: Adding Buy & Hold Metric to backtest



PureBytes Links

Trading Reference Links

Continuing...I agree with Keith that ATC provides the way to detail 
custom indexes.

The method I gave in point 1 is a quick manual calculation to get the 
end result without the intervening data (drawdown, variance etc).
(I  like to break everything down into charts, explorer and Xcel to 
help understanding).

It is also exactly the same as manually calculating the average ROC 
for each symbol in your universe of stocks (or custom index) for the 
test period (the average ROC for index constituents for a single 
period = = the total or equity ROC if an equal $ value of each stock 
is bought and held, irrespective of the timeframe).

For a quick auto calculation (ATC not required), use D's formula in 
AA and add position size to the code e.g if there are three stocks in 
your *index* add them to, say watchlist 0 > select filter define and 
include watchlist 0 then backtest using the following code as per D's 
instructions:

Buy =1; 
Sell = 0; 
PositionSize = -33.3333; /* invests only one third of the initial 
equity in each stock in the watchlist*/  

You can then plot the equity curve and get the metrics for the 
*index* from the backtest report.

An explanation of Position Size is in the help>backtester tutorial.


Happy backtesting,

Regards,

BrianB2.





--- In amibroker@xxxxxxxxxxxxxxx, "brian.z123" <brian.z123@xxx> wrote:
>
> DM,
> 
> I like the question.
> 
> I am not sure if you got what you are looking for from Paul's or 
D's 
> posts.
> 
> To add some spice to the mix!
> 
> For comparing ROC or net profit, some quick starting suggestions
> (assuming you have your portfolio start and end equity):
> 
> 1. The index might not be the best *benchmark* especially if it is 
> weighted. 
> 
> Another approach would be to take the universe of stocks that you 
> select your trades from and assume that you buy an equal $ weight 
of 
> each (equal % of your equity allocated to each symbol)- calculate 
> the  final $ value of your individual stocks and total them to 
> produce your benchmark portfolio $ value at the end of the test 
> period (exploration will handle that part of it).
> 
> That is a true comparison because you could have *blindly* bought 
> each stock in your universe (equal chance) while you actually want 
to 
> compare the success of your selections to the unselected basket.
> 
> 2. If your portfolio involves high turn-over commissions need to be 
> costed in.
> If turnover is low the comparison can be approximated without 
> commissions.
> 
> There would probably be ways to graph the relative portfolios 
> although to me it might not be worth the effort.
> 
> Comment:
> 
> It might be necessary to dig a bit further after that as there is a 
> wide range of metrics to consider.
> 
>  The hard part is deciding which one leads to the best trading 
> results.
> This is where the discussion really gets started.
> Everyone has their favorites.
> 
> You need a measure of reward and risk for a meaningful comparison.
> Neither ROC nor net profit provide any measure of the risk you are 
> taking.
> 
> Regards,
> 
> BrianB2
> 
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "dmcleod1981" <dmcleod1981@> 
> wrote:
> >
> > Brian,
> > 
> > I want to add a custom metric to compare my total portfolio 
versus a
> > selected index. My guess was that I would write the first and last
> > entry date of my portfolio back test as a (static?)variable and 
then
> > take the ROC to compare with the portfolio's return. From there I
> > could expand to compare drawdown etc. However, I am no sure if 
that 
> is
> > the best or most efficient way to compare.
> > 
> > Dingo mentioned a security by security comparison but I want to 
use
> > the total portfolio relative to a buy and hold as that is more
> > appropriate for what I want to measure.
> > 
> > I am open to ideas.
> > 
> > Thanks
> > DM
> > 
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "brian.z123" <brian.z123@> 
wrote:
> > >
> > > 
> > > Hello DM,
> > > 
> > > I haven't tried it but I have theoretically considered the 
> *problem* 
> > > in the past and I came to the conclusion if your buy = = the 
> close on 
> > > the start date of your test period and your sell = = the close 
on 
> the 
> > > last day of your test period you would have it (MM set to buy 
> 100% of 
> > > equity).
> > > 
> > > If you just want it as a reference or cross comparison to your 
> system 
> > > backtest results then add code to an Exploration to perform the 
> above 
> > > task for all symbols for the test period and print the output 
> list.
> > > 
> > > I do have *indicators* that I use to visually compare the 
> evaluation 
> > > metrics for the full test period (I view them in charts and/or 
> add 
> > > them to Explorations) e.g. Win/Loss ratio, Profit Factor (gross 
> > > profit/loss method or Win/Loss ratio method).
> > > What they tell me is what the PF would have been if I had 
bought 
> and 
> > > held compared to trading my system.
> > > 
> > > I assume any of the back-test metrics can be converted to the 
> > > equivalent buy/hold return for comparison with your system 
> metrics.
> > > 
> > > Let me know if you are interested in that approach and I will 
> post 
> > > something.
> > > 
> > > I have only done the above two at this stage but the easier 
> metrics 
> > > in the backtest report shouldn't be hard to achieve.
> > > 
> > > Regards,
> > > 
> > > BrianB2.
> > > 
> > > 
> > > 
> > > 
> > > 
> > > --- In amibroker@xxxxxxxxxxxxxxx, "dmcleod1981" <dmcleod1981@> 
> > > wrote:
> > > >
> > > > I may be using the wrong key words when I am searching but I 
> can't 
> > > find 
> > > > any previous samples that show how to add the buy and hold 
> return 
> > > > during the back test period. If someone has any snippets or 
can 
> > > > reference a post number I would be greatful. 
> > > > 
> > > > Thanks
> > > > DM
> > > >
> > >
> >
>



Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.441 / Virus Database: 268.18.1/690 - Release Date: 2/16/2007 2:25 PM