| 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 Estimated Strategy Capacity $0 |
class Example(QCAlgorithm):
def Initialize(self):
self.SetCash(100000)
self.SetStartDate(2021, 3, 20)
# self.SetEndDate(2021, 2, 21)
self.SetTimeZone("America/New_York")
self.symbol = "ETHUSD"
self.AddCrypto(self.symbol, Resolution.Minute, Market.GDAX)
self.SetBrokerageModel(BrokerageName.Bitfinex);
self.SetBenchmark(self.symbol)
self.period = 15
# Consolidate minute data into X minute blocks
Consolidated = TradeBarConsolidator(timedelta(minutes=self.period))
Consolidated.DataConsolidated += self.onDataConsolidated
self.SubscriptionManager.AddConsolidator(self.symbol, Consolidated)
# technicals
self.HA = HeikinAshi()
self.ema10 = IndicatorExtensions.Of(ExponentialMovingAverage(10), self.HA)
self.ema50 = IndicatorExtensions.Of(ExponentialMovingAverage(50), self.HA)
self.sma25 = IndicatorExtensions.Of(SimpleMovingAverage(25), self.HA)
self.macd = IndicatorExtensions.Of(MovingAverageConvergenceDivergence(12, 26, 9), self.HA)
self.RegisterIndicator(self.symbol, self.HA, Consolidated)
self.RegisterIndicator(self.symbol, self.ema10, Consolidated)
self.RegisterIndicator(self.symbol, self.sma25, Consolidated)
self.RegisterIndicator(self.symbol, self.ema50, Consolidated)
self.RegisterIndicator(self.symbol, self.macd, Consolidated)
self.window = RollingWindow[float](2)
self.SetWarmup(50)
def onData(self, data):
pass
def onDataConsolidated(self, sender, data):
# check if we are warming up
if self.IsWarmingUp:
return
# add our ema to a window
self.window.Add(self.ema10.Current.Value)
# wait for window to be ready
if not self.window.IsReady:
return
self.Debug(f"O: {self.HA.Open.Current.Value} H: {self.HA.High.Current.Value} L: {self.HA.Low.Current.Value} C: {self.HA.Close.Current.Value} @ {self.Time}")