Skip to content

Instantly share code, notes, and snippets.

class MyMFIStrategy(bt.Strategy):
def __init__(self):
mfi = bt.MFI_Canonical(self.data)
class MFI_Canonical(bt.Indicator):
lines = ('mfi',)
params = dict(period=14)
def __init__(self):
psum = self.data.close + self.data.low + self.data.high
tprice = psum / 3.0
mfraw = tprice * self.data.volume
...