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
Tracking Error
0
Treynor Ratio
0
Total Fees
$0.00
import datetime 
class DynamicTachyonThrustAssembly(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2020,5, 22)   # Set Start Date
        self.SetEndDate(2020,5,22)       # Set End Date
        self.SetCash(5000)             # Set Strategy Cash
        
        self.longStock = "SPXL"
        self.shortStock = "SPXS"
        self.AddEquity(self.longStock, Resolution.Minute)
        self.AddEquity(self.shortStock, Resolution.Minute)
        
        self.ema12 = ExponentialMovingAverage(12)
        self.ema26 = ExponentialMovingAverage(26)
        self.macd = MovingAverageConvergenceDivergence(12,26,9,MovingAverageType.Exponential)
        self.ha = self.HeikinAshi(self.longStock, Resolution.Minute)
        self.ha.Updated += self.haUpdate
        self.haWin = RollingWindow[TradeBar](5)
        
    def haUpdate(self, sender, updated):
        if self.ha.IsReady:
            self.ema12.Update(updated)
            self.ema26.Update(updated)
            self.macd.Update(updated)



    def OnData(self, data):
        if data["SPXL"] is None:
            return
        if self.Time.time() > datetime.datetime(2020,5,22,15,30,0).time() and self.Time.time() < datetime.datetime(2020,5,15,15,45,0).time():
            self.Debug("--------{}--------<br>".format(self.Time))
            self.Debug("macd : {}<br>".format(self.macd.Current.Value))
            self.Debug("calculated mamcd : {}<br>".format(self.ema12.Current.Value - self.ema26.Current.Value))