Here is the Sine Wave indicator by John Ehlers.
Most technical analysis is quite simple but John Ehlers takes it one step further and incorporates fractals and sine waves into his analysis. The mathematics in his technical analysis indicators is really some of the most advanced that you can find. He releases most of his findings publicly on his website here. Some of his papers are really a must-read for those who want to take their technical analysis to the next level.
I wanted to backtest some of his strategies so I've converted his EasyLanguage code into C#.
In this share, I present to you the Sine Wave indicator. The Sine Wave (also called MESA) indicator is based on the assumption that markets move in cyclical patterns. He tries to quantify such cycles and then predict them (by making his indicator leading instead of lagging like most indicators). This works extremely well when the market is indeed moving in a cycle. When the market is trending, however, this system fails (and one should adjust for that). Here is an example where the indicator is working well and when it is not. Note that when the market is trending, you could recognise this and use it to your advantage (see his Empirical Mode Decomposition recognition algorithm).
So when the market is cyclical, you could use the Sine Wave Indicator. When the market is trending, you could use a moving average-based indicator. Right now, I haven't incorporated this yet. The algorithm (as is) should therefore be used on markets that are known to move in cyclical patterns. The S&P 500 (e.g. SPY) is one of such markets, but many believe that the FOREX markets are also quite cyclical. It's interesting to see that it performs quite well on SPY but fails miserably on, for example, AAPL.
I hope you like it. Happy coding.
James Smith
Jared Broad
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
JP B
James Smith
James Smith
JP B
Brian Dickens
I have a question related to this bit of code:
JayJayD
Please, develop your question a little further.
At first sight, only I can said that is '+1' will lose it impact as the period of the indicator increases.
Now, why do you think is an improvement to estimate the indicator with the '+1'? Have you tried both setups? What are the changes you note?
Brian Dickens
Thanks for responding, and sorry for my sloppy formatting in previous comment.
The eqaution is essentially COS(angle)*amplitude
where angle = i/MESA_length
Should the angle of the initial observation be zero (0/Mesa_length)) or 1/MESA_length?
JayJayD
The transformation should start in zero, if not the indicator will be out of phase. But again, the phase shift will be smaller as the indicator period increases.
Don’t just take my word, try with both setups with some arbitrary periods (say 5, 10, 30, 60 and 120) and check the results.
Good luck!
.ekz.
Great discussion. Note: here is the updated URL for Ehler's technical papers.
Hope we see more from @jp_b  some day.
JP B
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!