To develop momentum strategies, its relevant to understand is the trend is strong or a mean reversion is coming. Tipically, Hurst Exponent claims to work, but unfortunally I dont see value on this indicator with my data (latinamerican mutual funds).
Finally I found the MMI as an alternative with better results to implement in my strategies. You can get the explanation and several backtestings on https://financial-hacker.com/the-market-meanness-index/ (ps: you can read there with 55 is important)
This is my implementation on backtrader, pls your feedback is welcome
class MMI(bt.Indicator): lines = ('mmi',) plotinfo = dict(plothlines=) params = dict(period=100,) def __init__(self): self.m = Average(self.data.close, period = self.p.period) #replace with median def next(self): nl = 0 nh = 0 for j in range(self.p.period-1): if j < 1: continue i=j * -1 if (self.data.close[i] > self.m) and (self.data.close[i] > self.data.close[i-1]) : nl += 1 if (self.data.close[i] < self.m) and (self.data.close[i] < self.data.close[i-1]) : nh += 1 self.l.mmi = 100.0 * (nl+nh)/(self.p.period - 1)