Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Elder Impulse Algo (sort of)

The algo is based on the Elder Impulse system from one of Elder’s classic tradings books. I added touches of my own here and there.

The main idea I used from the system is that bull signals occur when

13-period EMA > previous 13-period EMA and
MACD-Histogram > previous period's MACD-Histogram

... and vise-versa for bear signals.

The algo definitely doesn’t work the way I want it to, especially in the area of def before_trading_start(context, data):
(which returns different results in stock selection compared to when that code is run in Pipeline)

Any recommendations or pointers would be nice as this is one my first algos.

2 responses

Thank you for the indicator code. But just want to point out the Elder Impulse System (EIS) does not quite suit the Zscore sorting strategy. As you know the EIS combines the EMA (trend) with the MACD (momentum). It is best used for an entry/exit identification strategy. Because EMA is a time-weighted (recent weights more) indicator and MACD is also generated through EMA calculation, A high Zscore of EMA and MACD in general means a huge jump bar in very recent days.

Stocks in your filter > $5.25 close price can have very high volatility and have frequent jumps (up/down) causing high Zscore of EMA and MACD. These jumps may move those stocks into your trade list, but may not generate profit for you.

Hey, thanks for the input.
I remember when I was working on this, the rationale behind the zscore code was indeed to search for increased volatility or significant green/red days on stocks. I know that ideally the Elder Impulse strategy also involves how a longer timeframe is doing, such as weekly price action.
...But nevertheless, a problem occurs when there is whipsaw action, like EMA & MACD might be positive one day and negative the next. This is not what I wanted the algo to trade as it creates high turnover... so to avoid this problem I predicted that it would be better to only enter where there is a significant change is those two factors (maybe a big reversal of trend or breakout from lows or a gap up, etc).