Overall Statistics |
Total Trades 97 Average Win 2.02% Average Loss -3.47% Compounding Annual Return 25.134% Drawdown 24.800% Expectancy 0.088 Net Profit 13.906% Sharpe Ratio 0.723 Loss Rate 31% Win Rate 69% Profit-Loss Ratio 0.58 Alpha -0.439 Beta 41.787 Annual Standard Deviation 0.321 Annual Variance 0.103 Information Ratio 0.673 Tracking Error 0.321 Treynor Ratio 0.006 Total Fees $0.00 |
import numpy as np ### <summary> ### Basic template algorithm simply initializes the date range and cash. This is a skeleton ### framework you can use for designing an algorithm. ### </summary> class BasicTemplateAlgorithm(QCAlgorithm): '''Basic template algorithm simply initializes the date range and cash''' def Initialize(self): self.SetStartDate(2017,1, 1) #Set Start Date self.SetEndDate(2017,7,31) #Set End Date self.SetCash(5000) #Set Strategy Cash self.AddForex("EURGBP", Resolution.Hour, Market.Oanda) self.SetBrokerageModel(BrokerageName.OandaBrokerage) self.rsi = self.RSI("EURGBP", 14) def OnData(self, data): if not self.rsi.IsReady: return if self.rsi.Current.Value < 30 and self.Portfolio["EURGBP"].Invested <= 0: self.Debug("RSI is less then 30") self.MarketOrder("EURGBP", 25000) self.Debug("Market order was placed") if self.rsi.Current.Value > 70: self.Debug("RSI is greater then 70") self.Liquidate() def OnEndOfDay(self): self.Plot("Indicators","RSI", self.rsi.Current.Value)