Overall Statistics
Total Trades
104
Average Win
0.03%
Average Loss
0.00%
Compounding Annual Return
184.851%
Drawdown
3.100%
Expectancy
10.041
Net Profit
9.193%
Sharpe Ratio
5.534
Probabilistic Sharpe Ratio
84.453%
Loss Rate
4%
Win Rate
96%
Profit-Loss Ratio
10.53
Alpha
0.623
Beta
-0.996
Annual Standard Deviation
0.205
Annual Variance
0.042
Information Ratio
4.02
Tracking Error
0.411
Treynor Ratio
-1.14
Total Fees
$104.10
Estimated Strategy Capacity
$23000000.00
Lowest Capacity Asset
SPY R735QTJ8XC9X
# Breakup of the previous bar with volume confirmation

STOCK = 'SPY'; MA = 30; 

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.YH = self.MAX(self.stock, 1, res, Field.High)
        self.YL = self.MIN(self.stock, 1, res, 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.YL.Current.Value:
            if vmar > 1.0:
                self.SetHoldings(self.stock, 1.0)
                
        elif price >= self.YH.Current.Value:
            if vmar > 1.0:
                self.SetHoldings(self.stock, -1.0)