Overall Statistics
Total Trades
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Net Profit
0%
Sharpe Ratio
0
Probabilistic Sharpe Ratio
0%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
0.173
Tracking Error
0.126
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
# Rolling Window Bar Data, talib compatible

import numpy as np
import talib

class RollingWindowBarData(QCAlgorithm):
    
    def Initialize(self):
        self.SetStartDate(2021, 4, 20) 
        self.SetEndDate(2021, 5, 20)
        self.SetCash(10000)  # Set Strategy Cash
        self.SetWarmUp(15)
        self.sym = self.AddEquity('AMD', Resolution.Daily).Symbol
        self.rollingWindow = RollingWindow[TradeBar](15)
        self.Consolidate(self.sym, Resolution.Daily, self.CustomBarHandler)
        
        
    def CustomBarHandler(self, bar):
        self.rollingWindow.Add(bar)     
        
        
    def OnData(self, data):
        if not self.rollingWindow.IsReady: return

        O = np.array([self.rollingWindow[i].Open for i in range(15)])
        H = np.array([self.rollingWindow[i].High for i in range(15)])
        L = np.array([self.rollingWindow[i].Low for i in range(15)])
        C = np.array([self.rollingWindow[i].Close for i in range(15)])

        self.Plot("Gaps", "gap", float(O[-1] - C[-2]))
        self.Plot("Gaps", "zero", 0.0)