Overall Statistics
Total Trades
26
Average Win
0.04%
Average Loss
0%
Compounding Annual Return
185.756%
Drawdown
3.100%
Expectancy
0
Net Profit
9.222%
Sharpe Ratio
5.697
Probabilistic Sharpe Ratio
85.363%
Loss Rate
0%
Win Rate
100%
Profit-Loss Ratio
0
Alpha
0.642
Beta
-0.963
Annual Standard Deviation
0.2
Annual Variance
0.04
Information Ratio
4.088
Tracking Error
0.405
Treynor Ratio
-1.183
Total Fees
$26.10
Estimated Strategy Capacity
$37000000.00
Lowest Capacity Asset
SPY R735QTJ8XC9X
# Breakup of the previous bar with volume confirmation

STOCK = 'SPY'; MA = 30; MULT = 1.2;

class BreakdownOfThePreviousBarWithVolumeConfirmation(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2022, 4, 2) 
        self.SetEndDate(2022, 5, 2) 
        self.SetCash(100000) 
        res = Resolution.Minute
        self.stock = self.AddEquity(STOCK, res).Symbol
        self.sma = self.SMA(self.stock, MA,  res, Field.Volume)
        self.PrevHighM = self.MAX(self.stock, 1, res, Field.High)
        self.PrevLowM = self.MIN(self.stock, 1, res, Field.Low)
        self.PrevHighD = self.MAX(self.stock, 1, Resolution.Daily, Field.High)
        self.PrevLowD = self.MIN(self.stock, 1, Resolution.Daily, Field.Low)
        self.SetWarmUp(MA, res)
        

    def OnData(self, data: Slice):
        if not self.stock in data.Bars: return
        if not self.sma.IsReady: return
 
        price = self.Securities[self.stock].Price
        vmar = self.Securities[self.stock].Volume/self.sma.Current.Value
        
        if price < self.PrevLowM.Current.Value:
            if self.PrevHighM.Current.Value < self.PrevHighD.Current.Value:
                if self.PrevLowM.Current.Value > self.PrevLowD.Current.Value:
                    if vmar > MULT:
                        self.SetHoldings(self.stock, 1.0)
                        
        if price >= self.PrevHighM.Current.Value:
            if self.PrevHighM.Current.Value < self.PrevHighD.Current.Value:
                if self.PrevLowM.Current.Value > self.PrevLowD.Current.Value:
                    if vmar > MULT:
                        self.SetHoldings(self.stock, -1.0)