"Price above value" and "Price above value (backtest)" produce identic trades
Author: wernerhh
Creation Date: 11/7/2020 2:06 PM
profile picture

wernerhh

#1
Hello,

I want to define a minimum price for a long entry.

There are two rule based conditions for that:
Price is above a value (backtest)
Price is above a value

However, I created a little strategy which should buy at a minimum price and sell when older than three bars. And I ran this strategy on APPL which had some splits in the last 20 years.

What I want is that the historical price will be the relevant one, not the price adjusted for (future) splits. But both of these conditions aren't able to realize that. It seems to me that these two conditions work exactly alike - the number of trades for both is exactly the same.

I know that these two conditions create very different code when converted to code based strategies, but it seems that the "Price is above a value (backtest)" does not work (differently).

Or maybe I have to use a special dataset to achieve that? Help would be appreciated very much!

Best regards
Werner
profile picture

Eugene

#2
Hi Werner,

I'm sure it works correctly. Double check that you're using the right Split Item (there are 6 providers to choose from in a parameter) and the data is up to date. Click "Plot adjusted series" to visualize the split-adjusted series on the chart.
profile picture

wernerhh

#3
CODE:
Please log in to see this code.
profile picture

wernerhh

#4
Sorry for the wrong format!

I have this debugging command, when I print closing price next to adjusted price. And it is always the same. No matter if I choose "split", "Split (Yahoo! Finance)" or "Split (MSN)". (I havo only these three options listed.) So, the debug window output starts with:

1: Close = 0,39843571 Adjusted = 0,39843571
2: Close = 0,39732142 Adjusted = 0,39732142
3: Close = 0,38281428 Adjusted = 0,38281428
4: Close = 0,38057857 Adjusted = 0,38057857
5: Close = 0,35825714 Adjusted = 0,35825714
6: Close = 0,36049285 Adjusted = 0,36049285

and ends with:

5013: Close = 115,08 Adjusted = 115,08
5016: Close = 124,4 Adjusted = 124,4
5019: Close = 120,71 Adjusted = 120,71
5022: Close = 117,51 Adjusted = 117,51
5025: Close = 115,04 Adjusted = 115,04
5028: Close = 111,2 Adjusted = 111,2

So it seems this "reverseAdjustment" always equals 1.

Best regards
Werner
profile picture

Eugene

#5
QUOTE:
And it is always the same. No matter if I choose "split", "Split (Yahoo! Finance)" or "Split (MSN)".

The only option that will work is "Split (Yahoo! Finance)". The other two are either N/A or broken beyond repair. Sorry I must've been talking about an unreleased revision of Rules.xml with 6 choices of split items of the actual data provider extensions. Forgot that I've made the change but we haven't repackaged the installer yet.

Anyway, "Split (Yahoo! Finance)" is the way to go. Your code works on AAPL using Yahoo data.
profile picture

wernerhh

#6
Eugene, thank you! Now it works when I use Yahoo data and the setting "Split (Yahoo! Finance)".

Up to now I always tried to use only Wealth Data and not Yahoo, as I assumed it is more accurate. But I guess for having appropriate minimum prices in the past, I will only work with Yahoo. Hopefully it is also reliable.

Regarding price adjustment for splits there are some issues which came to my mind:

1. In Wealthlab under "Tools" -> "Preferences" -> "Commissions" you can define commissions for having realistic results. However, if the data used for backtesting adjusts historical prices for future splits, these commissions will not always be calculated accurately: Let's say a share XYZ had in 2005 a price of 10$. But 5 years later there was a 1:10 split. So, in backtesting its price for 2005 would be calculated with 1$, resulting in higher commissions - at least if the commission is a fixed amount per share bought. Am I correct with this assumption?

2. There is also a minimum price of 5$ in your LDL2 strategy to "avoid buying penny stocks". But because of that a share like the one mentioned above would not be considered in 2005: Despite its price of $10 back then, in the data adjusted for future splits it will be listed at $1. So, your LDL2 strategy might be even more effective than backtesting shows.
profile picture

Eugene

#7
You're welcome.

2. "LDL2 (Rev.B)" has already been fixed. On how to get it please see the WL User Guide (Help menu) > Reference > Dialogs > Strategy Explorer > Download...
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).