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.979
Tracking Error
0.174
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
# Plot PRICE, LSMA, PSAR of LSMA

# ---------------------------
STOCK = "QQQ"; PERIOD = 21; 
# ---------------------------

class HmaPsarExtension(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2022, 1, 1)  
        self.SetEndDate(2022, 4, 14)
        res = Resolution.Daily
        self.stock  = self.AddEquity(STOCK, res).Symbol 
        self.SetWarmUp(2*PERIOD, res)
        self.lsma = self.LSMA(self.stock, PERIOD, res)
        self.lsma.Updated += self.parabolic_handler
        self.Parabolic_lsma = ParabolicStopAndReverse(0.02, 0.02, 0.2)
        
        
    def parabolic_handler(self, sender, bar):
        if self.lsma.IsReady:
            lsma = self.lsma.Current.Value
            trade_bar = TradeBar(bar.EndTime, self.stock, lsma, lsma, lsma, lsma, 0)
            self.Parabolic_lsma.Update(trade_bar)
            
        
    def OnData(self, data):
        if self.IsWarmingUp or not self.Parabolic_lsma: return 

        price = self.Securities[self.stock].Price 
            
        self.Plot(self.stock, "Price", price)
        self.Plot(self.stock, "LSMA", self.lsma.Current.Value)
        self.Plot(self.stock, "Parabolic of LSMA", self.Parabolic_lsma.Current.Value)