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
-22.451
Tracking Error
0.183
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
# First 30 minutes Highest High and Lowest Low

# -------------------------
STOCK = "SPY"; PERIOD = 30;
# -------------------------

class OpeningRangeBreakout(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2021, 12, 6)  
        self.SetEndDate(2021, 12, 10) 
        self.SetCash(1000)  
        self.stock = self.AddEquity(STOCK, Resolution.Minute).Symbol
        self.max = self.MAX(self.stock, PERIOD, Resolution.Minute, Field.High)
        self.min = self.MIN(self.stock, PERIOD, Resolution.Minute, Field.Low)
        self.SetWarmUp(PERIOD, Resolution.Minute)
        

    def OnData(self, data):
        if self.IsWarmingUp: return
        if not (self.max.IsReady or self.mi.IsReady): return
        if self.Time.hour < 10 or self.Time.hour > 10 or self.Time.minute != 31: return

        first_30_min_HH = self.max.Current.Value
        first_30_min_LL = self.min.Current.Value

        self.Log(f"first 30 min Highest High: {first_30_min_HH}")
        self.Log(f"first 30 min Lowest Low: {first_30_min_LL}")
        
        self.Plot(STOCK, 'first_30_min_HH', first_30_min_HH)
        self.Plot(STOCK, 'first_30_min_LL', first_30_min_LL)