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
Size:
Color:
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.
Size:
Color:
CODE:
Please log in to see this code.
Size:
Color:
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
Size:
Color:
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.
Size:
Color:
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.
Size:
Color:
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...
Size:
Color: