Overall Statistics |
Total Trades 257 Average Win 0.00% Average Loss 0.00% Compounding Annual Return -7.082% Drawdown 0.100% Expectancy -0.252 Net Profit -0.054% Sharpe Ratio -5.555 Loss Rate 79% Win Rate 21% Profit-Loss Ratio 2.55 Alpha -0.111 Beta 7.125 Annual Standard Deviation 0.008 Annual Variance 0 Information Ratio -6.843 Tracking Error 0.008 Treynor Ratio -0.006 Total Fees $0.00 |
import numpy as np class BasicTemplateAldgorithm(QCAlgorithm): def Initialize(self): # Set the cash we'd like to use for our backtest # This is ignored in live trading self.SetCash(1000) # Start and end dates for the backtest. # These are ignored in live trading. self.SetStartDate(2016,6,1) self.SetEndDate(2016,6,3) # Set Brokerage model to load OANDA fee structure. self.SetBrokerageModel(BrokerageName.OandaBrokerage) self.SetWarmUp(20) # Add assets you'd like to see self.eurusd = self.AddForex("EURUSD", Resolution.Minute) self.usdcad = self.AddForex("USDCAD", Resolution.Minute) self.eurusd_bb = self.BB("EURUSD", 16, 2.0, MovingAverageType.Simple, Resolution.Minute) self.usdcad_bb = self.BB("USDCAD", 16, 2.0, MovingAverageType.Simple, Resolution.Minute) def OnData(self, data): # Simple buy and hold template if self.IsWarmingUp: return self.eurusd_holding = self.Portfolio['EURUSD'].Quantity self.usdcad_holding = self.Portfolio['USDCAD'].Quantity if(data["EURUSD"].Ask.Open > self.eurusd_bb.UpperBand.Current.Value): #self.percent = .05 self.SetHoldings('EURUSD', .05, True) elif(data["EURUSD"].Ask.Open <= self.eurusd_bb.MiddleBand.Current.Value): self.SetHoldings('EURUSD', 0, True)