Overall Statistics
Total Trades
3278
Average Win
0.04%
Average Loss
-0.06%
Compounding Annual Return
-100%
Drawdown
64.900%
Expectancy
-0.990
Net Profit
-64.916%
Sharpe Ratio
-0.633
Probabilistic Sharpe Ratio
0%
Loss Rate
99%
Win Rate
1%
Profit-Loss Ratio
0.62
Alpha
-4.834
Beta
7.208
Annual Standard Deviation
1.581
Annual Variance
2.499
Information Ratio
-0.994
Tracking Error
1.541
Treynor Ratio
-0.139
Total Fees
$3278.00
class heikinAshiExample(QCAlgorithm):
    
    
    def Initialize(self):
        self.SetStartDate(2020, 1, 1)
        self.SetEndDate(2020, 1, 10)
        self.SetCash(5000)
        self.heikinAshi = {}
        
        tickers = ["GOOG", "TSLA", "AAPL"]
        
        for ticker in tickers:
            symbol = self.AddEquity(ticker, Resolution.Minute).Symbol
            self.heikinAshi[symbol] = SymbolData(self, symbol)
        
        
    def OnData(self,data):
        
        # Iterate through symbols in our dictionary
        for symbol in self.heikinAshi:
            # Long position if Heikin Ashi Close Bar > Heikin Ashi Open Bar
            if self.heikinAshi[symbol].High > self.heikinAshi[symbol].Close and self.heikinAshi[symbol].Close < self.heikinAshi[symbol].Open:
                self.SetHoldings(symbol, 1/3)
            else:
                self.Liquidate()
   
    

                
                
class SymbolData:
    
    def __init__(self, algorithm, symbol):
        self.symbol = symbol
        self.algorithm = algorithm
        self.heikinAshi = HeikinAshi()
        self.consolidator = TradeBarConsolidator(timedelta(minutes=30))
        algorithm.RegisterIndicator(symbol, self.heikinAshi, self.consolidator)
        self.heikinAshi.Updated += self.OnHeikinAshi
    
    @property
    def Open(self):
        return self.heikinAshi.Open
    @property
    def High(self):
        return self.heikinAshi.High
    @property
    def Close(self):
        return self.heikinAshi.Close
        
    def OnHeikinAshi(self, sender, updated):
        self.algorithm.Debug(f"Heikin Ashi for {self.symbol} @ {self.algorithm.Time}")