| Overall Statistics |
|
Total Trades 0 Average Win 0% Average Loss 0% Compounding Annual Return 14.295% Drawdown 5.600% Expectancy 0 Net Profit 0.587% Sharpe Ratio -0.439 Probabilistic Sharpe Ratio 35.580% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha -0.075 Beta 0.319 Annual Standard Deviation 0.183 Annual Variance 0.033 Information Ratio -0.168 Tracking Error 0.381 Treynor Ratio -0.252 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset |
from System.Drawing import Color
class TestAlgorithm(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2021,9,1)
self.SetEndDate(2021,9,16)
self.SetCash("BTC", 1)
self.btc = self.AddCrypto("BTCUSD", Resolution.Minute).Symbol #, fillDataForward = False)
self.Consolidate("BTCUSD", timedelta(minutes=15), self.FifteenMinuteBarHandler)
self.SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash)
self.SetWarmUp(25)
self.smafast = self.SMA("BTCUSD", 1, Resolution.Daily)
self.smaslow = self.SMA("BTCUSD", 3, Resolution.Daily)
self.aroon = self.AROON("BTCUSD", 25, 25)
#self.consolidator = QuoteBarConsolidator(self.TimeFrame)
#self.consolidator.DataConsolidated += self.CustomHandler
#self.SubscriptionManager.AddConsolidator(self.btc, self.consolidator)
#self.Consolidate(btc.Symbol, timedelta(minutes=15), self.OnDataConsolidated)
#self.Consolidate("BTCUSD", timedelta(minutes=30), self.ThirtyMinuteBarHandler)
# create the 15-minutes data consolidator
fifteenMinuteConsolidator = TradeBarConsolidator(timedelta(minutes=15))
self.SubscriptionManager.AddConsolidator("BTCUSD", fifteenMinuteConsolidator)
# register the 15-minute consolidated bar data to automatically update the indicator
self.RegisterIndicator("BTCUSD", self.aroon, fifteenMinuteConsolidator)
stockPlot = Chart("Trade Plot")
stockPlot.AddSeries(Series('Price', SeriesType.Line, 0))
stockPlot.AddSeries(Series('smafast', SeriesType.Line, 0))
stockPlot.AddSeries(Series('smaslow', SeriesType.Line, 0))
stockPlot.AddSeries(Series('aroonup', SeriesType.Line, 1))
stockPlot.AddSeries(Series('aroondown', SeriesType.Line, 1))
self.AddChart(stockPlot)
def FifteenMinuteBarHandler(self, consolidated):
#self.Log(f"{consolidated.EndTime} >> fifteenMinuteBarHandler >> {consolidated.Close}")
if self.IsWarmingUp: return
price = self.Securities["BTCUSD"].Price
self.Plot("Trade Plot", "Price", price)
self.Plot("Trade Plot", "smafast", self.smafast.Current.Value)
self.Plot("Trade Plot", "smaslow", self.smaslow.Current.Value)
self.Plot("Trade Plot", "aroonup", self.aroon.AroonUp.Current.Value)
self.Plot("Trade Plot", "aroondown", self.aroon.AroonDown.Current.Value)
# def OnData(self, data): ...
#