Sum of absolute values of ( Close [today]  Close [yesterday] ) for n periods

class Vertical_Horizontal_Filter(bt.Indicator):
"""Determine the highest closing price (HCP) in n periods.
Determine the lowest closing price (LCP) in n periods.
Calculate the range of closing prices in n periods:
HCP  LCP
Next, calculate the movement in closing price for each period:
Closing price [today]  Closing price [yesterday]
Add up all price movements for n periods, disregarding whether they are up or down:
Sum of absolute values of ( Close [today]  Close [yesterday] ) for n periods
Divide:
VHF = (HCP  LCP) / (Sum of absolute values for n periods)
"""
lines = ('VHF', 'signal')
params = (('period', 280), ('lower_band', 0.2))
def init(self):self.addminperiod(self.p.period+3) bp = data.close[0]  data.close[1] self.sum_abs_diff = bt.indicators.SumN(abs(bp), period = self.p.period) def next(self): self.HCP = max(self.data.close.get(ago=1, size=self.params.period)) self.LCP = min(self.data.close.get(ago=1, size=self.params.period))
I want to draw an indicator, but the result is :
I want to calculate the Sum of absolute values of ( Close [today]  Close [yesterday] ) for n periods, but I don't know how, could anybody help me?