Backtesting-- Number of Shares Calculation
Author: gpetrie
Creation Date: 2/23/2009 11:53 PM
profile picture

gpetrie

#1
Hi, I am new to WLP having converted from Metastock. Happy to me in a more robust programming/testing environment! Built a simple system to see if I could duplicate test results. When using the same EOD data, all the trades match and so do share prices. However, I can't get WLP to purchase the correct number of shares. I am using Portfolio Simulation Mode with $1,000,000 and 80% of available equity. The first buy for example, is at $28.64 and WLP purchases 27,273 shares using only 78.1% of equity. I have turned off everything I could find in preferences (commissions, slippage round lots, volume, limit day qualifiers.)

Thoughts about what I am missing?

Thanks in advance!

Gene



profile picture

Eugene

#2
Hi Gene

Most likely what you experience is the effect could be explained by the basis price concept. Look for "Basis Price" in the Wealth-Lab User Guide:

a) Glossary
b) Strategy Window > Backtesting Strategies > 100% of Equity Sizing
profile picture

Cone

#3
You'll probably need to use the "Peeking Solution #2" to duplicate results for market order Strategies of other TA apps.
profile picture

gpetrie

#4
Hi. Thanks for the prompt responses. In order to avoid (hopefully) position sizing problems, I am using AtClose orders of the bar generating the signal for all trades. In the Trades tab WLP has the accurate closing price for the bar. It just doesn't quite use all of the Percent of Equity when making the buy.

Thanks for any other ideas, clarifications, etc.

Gene
profile picture

Cone

#5
As the documentation indicates, AtClose orders (like AtMarket orders) use the previous close for the basis price. (You can't know what the close is before the close, so there's no realistic way to use the closing price as its own basis price.)
profile picture

gpetrie

#6
Cone,

Thanks for the help. It worked fine. BTW do you ever sleep?

Gene
profile picture

Cone

#7
With 2 kids under 3, not much.
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).