Overall Statistics |
Total Trades 512 Average Win 0.20% Average Loss -0.22% Compounding Annual Return -6.512% Drawdown 7.700% Expectancy -0.116 Net Profit -6.512% Sharpe Ratio -1.257 Loss Rate 54% Win Rate 46% Profit-Loss Ratio 0.92 Alpha -0.046 Beta 0.009 Annual Standard Deviation 0.036 Annual Variance 0.001 Information Ratio -0.68 Tracking Error 0.129 Treynor Ratio -4.977 Total Fees $0.00 |
class TokyoBreakout(QCAlgorithm): openingBar = None check = True def Initialize(self): self.SetStartDate(2018,6, 1) self.SetEndDate(2019,6,1) self.SetCash(1000) self.AddForex("USDJPY", Resolution.Hour, Market.Oanda) self.SetBrokerageModel(BrokerageName.OandaBrokerage) self.Consolidate("USDJPY", timedelta(hours=1), self.OnDataConsolidated) self.Schedule.On(self.DateRules.EveryDay("USDJPY"), self.TimeRules.At(13, 0), self.ClosePositions) def OnData(self, data): if self.check == False or self.openingBar is None: return if data["USDJPY"].Close > self.openingBar.High: self.MarketOrder("USDJPY", 1000) self.check = False elif data["USDJPY"].Close < self.openingBar.Low: self.MarketOrder("USDJPY", -1000) self.check = False def OnDataConsolidated(self, bar): if bar.Time.hour == 0 and bar.Time.minute == 0: self.openingBar = bar def ClosePositions(self): self.openingBar = None self.Liquidate("USDJPY") self.check = True