Buy and Hold starting at specific bar
Author: avishn
Creation Date: 10/23/2009 3:23 PM
profile picture

avishn

#1
Any indicator-based custom strategy would have some unused/lead bars at the beginning of the time range because of the indicator data stability/availability issues. To compare strategy's results against Buy and Hold I need to be able to get B&H starting at specific bar, not at bar zero. What's the prescribed way to do that?
profile picture

Cone

#2
It's not supported in Version 5 and the subject is treated in the 5.5 User Guide: Strategy Window > Backtesting Strategies > Inside a Portfolio Simulation > Note on Lead Bars
profile picture

avishn

#3
Thank you. Yes, I saw that in the manual and I think I understand that it might be difficult or even impossible to generalize a notion of lead bars across different strategies and performance metrics. Having said that I just need a simple B&H baseline, which I can use to filter out optimization parameters in my strategy, which perform worse than B&H. Should I take the initial position size and calculate B&H baseline manually? I guess my question now is how do I access the position size in raw mode from within the strategy?
profile picture

Cone

#4
QUOTE:
how do I access the position size in raw mode from within the strategy?
Generally speaking (always leaving the possibility for arcane solutiosn), it's not possible unless you use the SetPositionSize method to know the size a priori.

QUOTE:
I just need a simple B&H baseline
Version 5.6 will provide the ability to identify a "Benchmark Buy and Hold" symbol. Just think of the possibilities!
profile picture

ronc

#5
I am running Wealth-Lab 6.4. Has this issue been fixed in 6.4? It seems that without the ability to tell when the "buy & hold" is to start (e.g. a specific bar) then the comparison to buy and hold seems rather meaningless. Buy and Hold always seems to start at the first bar, as opposed to my trading strategies which start much later. Thus the buy and hold might have several months of stock appreciation which my strategy does not. The WealthLab user guide discusses benchmark buy and hold but I could not find anything there that specifies how to start B&H on a specific date.
Thanks!
profile picture

Eugene

#6
At the risk of beating this dead horse even stronger (it has been a popular question), fixing it is not planned because it's working by design.

FAQ: FAQ

Thoughts and workarounds:

1. Cone once suggested to create a "Buy and Hold" strategy, i.e., BuyAtMarket(1); and run it in a separate window that corresponds to the dates you need to evaluate.

2. Since it affects a handful of standard performance metrics like Exposure, Annualized Gain (%), and Sharpe Ratio and probably the by-period figures, focus on other performance metrics that are less sensitive to changes in start and stop dates.

3. As a single backtest is just one possibilty, a far more reliable gauge is a Monte Carlo simulation.
profile picture

Cone

#7
Make sure you see that FAQ. Although not mentioned in the post above, it contains a link to the best solution imho - GetAllDataForSymbol. Using this technique, you can create indicators that are valid from bar 0, and therefore can start the trading loop at bar 1.
profile picture

Eugene

#8
You're right, let's make it sound more pronounced in the FAQ (done).
profile picture

ronc

#9
Thanks Eugene & Cone. Using the GetAllDataForSymbol technique I am able to get an indicator to start at the simulation start date, but I cannot get other data series calculated from that indicator to do the same. For example. I have a dataseries which is the SMA of the absolute value of the MACD histogram. Despite using the same technique on it, it always starts later. I have tried this with and without the Synchronize statements but no success. Code:

CODE:
Please log in to see this code.


I have been assuming that the indicator based on all data from the symbol would itself start well in the past, as soon as it has enough data to be calculated. But now I am wondering if the "zero-start" indicators actually start at the sim start bar (rather than way in the past) and because of that, anything I derive from such an indicator will incur another lag? If so, any recommendations?

Thanks,
Ron




profile picture

Eugene

#10
CODE:
Please log in to see this code.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).