Hey, working on trying to figure out the slope of an SMA line.  The way I did it on quantopian was to calculate the mean of the close of the last 225 minute bars and then calculate the mean of the close of the last 1-226 minute bars.  Then I would take the difference and that is the slope (direction and magnitude). I cant figure out how to do that on quant connect.  

Also, the reason I dont use indicators is because I cant figure out a way to determine the SMA value at a point in history, like the minute before the current minute.

Here is my lines of code in OnData:


svxy_hist = self.History("SVXY", 250, Resolution.Minute)  #this gives the close bar data for last 250 minute bars.
        svxy_SMA_325 = svxy_hist[-225].mean() #gives the SMA225 of the last 225 minute bars
        svxy_SMA_325_previous = svxy_hist[-226:-1].mean() #gives the SMA225 from the last minute 
        svxy_slope = svxy_SMA_325-svxy_SMA_325_previous #gives the slope magnitude and direction


builds fine but the backtest gets stuck on the "-225"

Thanks in advance!