Hello,
I've been working on a dip buying strategy that buys when: 1) the RSI is oversold, 2) the fast EMA is below the slow EMA, and 3) the fast EMA is turning up.
Then, the strategy will sell when: 1) the RSI is overbought 2) the fast EMA is above the slow 3) the fast EMA is turning down 4) the position is profitable
In backtesting I'm seeing that this strategy works best when the longer-term trend is neutral or upward.
My backtests are also showing that this strategy is prone to buying during downtrends. I would like to add a constraint -- or set of constraints -- that will ensure that buys are only made when the longer term trend is neutral or upward. All of the various conditions I've experimented with have failed. For example, I've added conditions to buy only when a 100 or 200 period EMA is trending up, but when I do this I wind up missing a lot of good dips in uptrends or neutral periods. 100 and 200 period EMAs are also thrown off by the peaks of the highest highs, so I think they're an unreliable indicator in this case.
I think the best solution would be to add a 150 EMA to the lowest lows, as shown in the attached image. (The bold red line is the EMA of the lowest lows I created by dragging indicators onto the chart.) By adding a condition to buy only when the price is above the EMA of the lowest lows, I would increase the probability of purchasing during a neutral or upward trend, and having a winning trade.
I'm able to figure out how to make the EMA of the lowest lows show up on the chart, but I can't figure out how to then use this line as a condition in the strategy. I'm new to Wealth Lab and I don't know how to code. I've been working just with the drag and drop functionality, and if possible I'm hoping to find a solution that doesn't involve directly coding.
Is there a way of using the existing drag and drop methods to create an EMA of lowest lows indicator that I can reference in my strategy? Or can you suggest another way of accomplishing my goal of only buying the dip during a longterm neutral or upward trend?
Thanks very much,
Joe
Size:
Color:
Hi Joe,
While I don't necessarily believe that the "EMA of lowest lows" has as much value as you think it has, I doubt it's currently possible to accomplish using Rules.
Although Lowest is a built-in indicator, there's no flexibility in the existing Rules for smoothed versions of indicators. For example, we have a "Smoothed Indicator crosses above (below) Value" condition in additional
Community.Rules library but that's all.
On the bright side, there shouldn't be much trouble for us to help you add it to your Strategy code. Design it with the Rule Wizard (Strategy from Rules) and once ready, convert it into code-based Strategy. This will give us something to work with.
P.S. Please avoid using JPG for screenshots, they look ugly. You should stick with PNG as JPG is truly suboptimal for screenshots. If you haven't seen this famous comics, it's perfect time :)
JPEG or PNG – Which Image Format Offers Better Quality?
Size:
Color:
Hi Eugene,
Thanks for your input. It's helpful to know that the "EMA of lowest lows" is unlikely to have much value. I am, admittedly, quite new to trading. Can you offer any suggestions for how I could accomplish the same goal, of only buying when the long-term trend has been neutral or upward?
And just for the sake of experimentation, could you also please tell me how I might go about adding the "EMA of higher lows" to the Strategy code so I can backtest it as a buying constraint?
And I wasn't that PNGs have higher quality. I'll use them instead of JPEGs going forward for screenshots.
Thanks,
Joe
Size:
Color:
...And more generally, as I'm working to come up with an intelligent dip-buying strategy, are there any particular posts on the Wealth Lab forum, or any external resources, that you'd suggest I read over?
Size:
Color:
QUOTE:
could you also please tell me how I might go about adding the "EMA of higher lows" to the Strategy code so I can backtest it as a buying constraint?
After you lay out the strategy using Rules, convert it into code-based Strategy by clicking "Open in new Strategy window". Copy and paste the generated code here. Then one of us technicians should help you add your "EMA of LL" condition to the code - if you describe the rule(s).
Size:
Color:
I've converted my strategy into code as you asked, and it's included below. I envisioned using the EMA of LL in one of two possible ways:
1) add a condition to buy only when the EMA of LL is trending up
OR, another possibility (that I would use in a separate strategy) would be to:
2) add a condition to buy only when the price is above the EMA of LL
- - -
CODE:
Please log in to see this code.
Size:
Color:
Here you go.
Notice the strategy parameter at the bottom left of the screen saying "Off / 1 / 2". By default it's off. If you drag the slider to the right to make it a "1", buys will only take place when the EMA of LL is trending up, and dragging it further to the right to the "2" dial will require the price to be above the EMA of LL.
CODE:
Please log in to see this code.
Size:
Color:
Thanks a lot, Eugene. I appreciate your help!
Size:
Color:
You're welcome, and hope you'll be interested in transition to Wealth-Lab Developer ;)
Size:
Color:
When I run this strategy in 1 mode (buying only when the EMA of LL is trending up) on the 60 minute chart, using the past three months data sets for the Dow, Nasdaq, S&P 100, it beats the market every time in terms of profit per bar. When I look at longer term time frames, though, the results aren't as good.
I guess the strategy is being helped by the fact that the market has had a general uptrend lately. I'm going to do some more research to try to find some other elements that could be built into the strategy to make it more robust.
Size:
Color:
I'd say that 3 months is not enough to test a strategy, especially considering it's such a specific market scenario. The bubble will not last forever.
Size:
Color: