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.