Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
First Algo, would appreciate citique.

Was meant to be simple EMA Trend-based algo. Needed method of bolstering returns during downtrend, found interesting phenomenon that occurs involving W%R.

3 responses

It's an interesting algo, thank you for sharing it.

You had a different set of custom variables in your code,and I ran a version looking at them. I think they point out the tricky part of your algo. It only does 2 trades in the first 7 years - it ends up being mostly a buy-and-hold strategy. It sits out the market twice. It's a pretty good algo if that is repeatable, but I have a hard time knowing if it's discerning something valuable, or it basically got lucky twice. Great programming example, but I'm not personally ready to put money on it!

Disclaimer

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 Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian 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.

Dan,

Thank you, it was meant to be a buy and hold with a mechanism that kicked in to stimulate returns until the market re-stabilizes. What I found incredible is that the mechanism works contrary to our understanding of W%R. Instead of buying when W%R is low and selling when its high over the entire W%R field, it buys high and sells low near the very top of the W%R field. Use the dormant code in there and narrow the viewing window (not the trading window) to the period of time where 157d EMA, 20d EMA, 500d EMA to see just what happens.

As far as reproducing results, I think a random data generator would be ideal. One where we can designate certain market characteristics on a virtual benchmark or stock (or both) and test our algo with that. With something like that, I would be able to design latent calibration devices that adjust my trading parameters according to developments in major market characteristics such as changes in volatility, interest rates, policy, etc. Bluesky thinking, but a random data generator would be a perfect addition to the site.

I wonder if anyone can modify this code to accommodate single securities or a basket of hand selected securities. For some reason, the 157/500 EMA crossover sell-trigger is not activated with anything other than SPY, not even DIA.

--Mike Sabeiha

W%R