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 |
import numpy as np from datetime import datetime, timedelta class BasicTemplateAlgorithm(QCAlgorithm): def Initialize(self): self.SetStartDate(2018,1,1) #Set Start Date self.SetEndDate(2018,2,1) #Set End Date self.SetCash(20000) #Set Strategy Cash self.AddForex("EURGBP", Resolution.Minute, Market.Oanda, leverage=30) # Consolidate minute price to daily price daily_consolidator = QuoteBarConsolidator(timedelta(hours=24)) daily_consolidator.DataConsolidated += self.OnDataConsolidated self.SubscriptionManager.AddConsolidator("EURGBP", daily_consolidator) # Set up Bollinger Band self.bb_20 = BollingerBands(10, 2, MovingAverageType.Simple) self.RegisterIndicator("EURGBP", self.bb_20, daily_consolidator) self.test_ema = ExponentialMovingAverage(100) self.RegisterIndicator("EURGBP", self.test_ema, daily_consolidator) # Receive daily data def OnDataConsolidated(self, sender, bar): if not self.bb_20.IsReady: self.Log("bb is not ready") self.Quit() else: self.Debug("{}".format(self.bb_20.MiddleBand)) # Receive minute data def OnData(self, data): pass