I hava difficulties plotting a correct upper and lower band for the Bollinger Band indicator. The result from my code does show the same shape of the graph but does not match the upper and lower bands.

Bellow is the code, which should be plotting the Bollinger Bands

 self.bband = self.BB("EURUSD", 20, 2, MovingAverageType.Simple)  #, Resolution.Minute);
       
        self.RegisterIndicator("EURUSD", self.bband, Consolidator)
       
        self.SetWarmUp(100)

 self.Plot("BB", "UpperBand", self.bband.UpperBand.Current.Value)
        self.Plot("BB", "MiddleBand", self.bband.MiddleBand.Current.Value)
        self.Plot("BB", "LowerBand", self.bband.LowerBand.Current.Value)

Any idea where the calculations might be going wrong?

 

Author