I have a question on exiting the LDL2 strategy at a profit. I have found little discussion on the strategy. Using the trade history for JAZZ. As an example the default profit target is 3% but looking at the history, many profits were higher and some lower. What was used to establish targets? Thanks
Size:
Color:
A look at the code reveals the following simple logic: if the Close price is higher than the profit target, the position is sold with an AtMarket order next day (i.e. at open).
Size:
Color:
Thanks. I blank out when I read code but as soon as I saw your explanation and went back to the code I saw the answer. Thanks again.
Size:
Color:
I know the basic formula for the entry price (low+close)/2*.94. I cannot arrive at the correct entry using that formula.
After reading on the subject, I have come across a disclaimer that the formula is based on whole numbers only. That still does not give me the correct entry.
If I use WealthLab toi calculate the entry, I can only duplicate that price to the penny if I use the multiplier .96 not .94.
If we use VRUS for today the low was 71.93, the close 74.08. That would compute to 68.63, yet Wealth Lab is showing 70.04. If I use .96 I can arrive at 70.08 (within pennies).
What am I doing wrong?
Thanks
Size:
Color:
You're not doing anything wrong but the saved parameter makes it confusing. The LDL2 strategy has a saved Parameter value for the Limit Multiplier of 0.96. This is what you can see at the bottom of the screen.
If a parameter value has been altered by Save Parameters once (and in fact it was - the Limit Multiplier was overridden to be 0.96), then Reset will honor that change and ignore the default value in Strategy code. (You're not alone, I was also confused by the design here.)
To fix, make "Limit Multiplier" a 0.94, click "Save Parameters". Then the strategy will be executing with its true default multiplier (0.94) when re-opened.
P.S. I think we need to upload a new revision of LDL2 to the website and/or fix that annoyance in the bundled strategy code itself.
Size:
Color:
I would like to understand why it is necessary to perform this "if" before buying:
CODE:
Please log in to see this code.
Thanks
Size:
Color:
To exclude penny stocks below $5.
Size:
Color:
I always cringe when I see price tested this way in a script because it's peeking! It's too bad that LDL2 had that rule, but whenever you test historical price values like this you need to
reverse the "future" splits. Here's the Execute method for LDL2 with a couple edits, showing how to come up with the reverse split Close series.
Run it on NKE, for example, and notice the "ds" prices before the 12/26/2012 split. This is the
actual price level that NKE traded. If you go back before 1995, split-adjusted NKE was trading below 5 and therefore would be incorrectly excluded from the backtest. In reality, NKE never closed below $10 since at least 1987!
CODE:
Please log in to see this code.
Size:
Color:
Good point Robert. I've just uploaded the revised LDL2 strategy.
Size:
Color:
Hello,
Is it possible to help me modify the code of the LDL2 strategy (or any similar dip buying / multiple limit strategy ) to only take the first 5 trades as they occurred in a day in backtesting (assuming 20%/5 pos sizing)?
Secondarily, would it be possible to optimize that code to look for hour blocks of time that would produce the best trade windows for those types of strategies? I have one modified version of ldl2 running and another multiple limit strategy with 80+ trades a day on average which has triggers typically all day.
Thank you
Eric
Size:
Color:
Eric,
No modification required. The
Position Options PosSizer from our
PosSizer library is an universal solution that doesn't require coding. Click the button to activate "Max pos. per day" and enter 5 in the input field on the right.
Your other question re: "optimize for hour blocks" looks beyond the scope of this topic (more general). Anyway we've been busy with WL7 launch so please forgive any latency.
Size:
Color:
Eugene,
Thanks for the response. What I am after is only the first 5 limit hits of the day (assuming more than 5 limits were hit that day), not just 5 trades in a day total.
I will open a new thread for the hour blocks, no rush.
Thanks,
Eric
Size:
Color:
If it's about sizing Alerts for live trading I don't think it can be approached due to a live bug (#62853 Candidate collection empty for Alert sizing). Otherwise I'm not seeing the difference.
Size:
Color:
Eugene,
I am wanting to look at this approach from a backtesting standpoint only, not live trading. Is that possible?
Thanks,
Eric
Size:
Color:
Eric, please clarify what is required from me? I believe you've got all the tooling.
Size:
Color:
Eugene,
When I backtest LDL2, for example, it will randomize the first 5 trades (assuming 20/5) taken on a given day in the backtest period. If I run this backtest over and over it will create a new list of trades on each day that hit the limit value. I want to be able to backtest to only take the first 5 trades as they actually happened on each day during the backtest and disregard all other limit trades that may have hit later in the day. Does that make sense?
Thanks,
Eric
Size:
Color:
Your question is not LDL2 specific. Alert randomization takes place when the captial is not insufficient to take all trades. You can turn it off by assigning a Position.Priority or opting for 'Worst-case Portfolio Simulation' in WL's Preferences > Backtest Settings.
Size:
Color:
There seems to be a problem with the LDL2 strategy:
When I run this strategy on the S&P500 dataset, I usually get very high results, no matter if I backtest a 5 years or a 20 years period.
However, when I have a closer look, I see that the profit in the last 5 years in the 20 years-backtest is significantly lower than in the 5 years-backtest. It cannot have happened by random, as I tried this out very many times and always have the same effect.
What can be the reason for that (Portfolio Simulation Mode / 33.33 position size)? Do you know about this problem?
Was it ever possible for somebody, to trade the LDL2 strategy in an automated fashion? I.e. creating your orders for the next day when the stock exchange closes?
Best regards
Werner
Size:
Color: