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 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 |
# SimpleMultiResolutionIndicators (Py) # Starting with a base resolution of 1 minute, # generate and plot EMAs at a resolutions of # 1 minute, 5 minutes and 1 hour with 2 hour windows from clr import AddReference AddReference("System") AddReference("QuantConnect.Algorithm") AddReference("QuantConnect.Indicators") AddReference("QuantConnect.Common") from System import * from QuantConnect import * from QuantConnect.Data import * from QuantConnect.Algorithm import * from QuantConnect.Indicators import * from QuantConnect.Data.Consolidators import * class SimpleMultiResolutionIndicators(QCAlgorithm): def Initialize(self): self.SetStartDate(2017,9,1) #Set Start Date self.SetEndDate(2017,9,2) #Set End Date self.SetCash(1000) #Set Strategy Cash # define crypto we want to trade on # ETHUSD or LTCUSD or BTCUSD self.target_crypto = "ETHUSD" # Set brokerage to GDAX for cryptos self.SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash) # Add crypto at minute resolution self.AddCrypto(self.target_crypto, Resolution.Minute) self.SetBenchmark(self.target_crypto) # create consolidator for 5 minute consFiveMin = TradeBarConsolidator(5) consFiveMin.DataConsolidated += self.OnFiveMinData self.SubscriptionManager.AddConsolidator(self.target_crypto, consFiveMin) # create consolidator for 1 hour consHour = TradeBarConsolidator(60) consHour.DataConsolidated += self.OnHourData self.SubscriptionManager.AddConsolidator(self.target_crypto, consHour) # Define exponential moving average at 1 min resolution with 2 hour window self.ema_very_fast_one_min = self.EMA(self.target_crypto, 120) # Define exponential moving average at 5 min resolution with 2 hour window self.ema_very_fast_five_min = ExponentialMovingAverage("5minEMA", 24) # Define exponential moving average at 1 hour resolution with 2 hour window self.ema_very_fast_hour = ExponentialMovingAverage("HourlyEMA", 2) def OnData(self, data): #self.ema_very_fast_one_min.Update(bar.EndTime, bar.Close) self.Debug(str(self.Time) + " > OnData executed") self.Plot("Indicators", self.ema_very_fast_one_min) def OnFiveMinData(self, sender, bar): self.ema_very_fast_five_min.Update(bar.EndTime, bar.Close) self.Debug(str(self.Time) + " > New 5 Min Bar!") self.Plot("Indicators", self.ema_very_fast_five_min) def OnHourData(self, sender, bar): self.ema_very_fast_hour.Update(bar.EndTime, bar.Close) self.Debug(str(self.Time) + " > New Hour Bar!") self.Plot("Indicators", self.ema_very_fast_hour)