Overall Statistics |
Total Trades 515 Average Win 0.24% Average Loss -0.24% Compounding Annual Return -3.011% Drawdown 6.100% Expectancy -0.056 Net Profit -3.011% Sharpe Ratio -0.343 Loss Rate 53% Win Rate 47% Profit-Loss Ratio 1.00 Alpha -0.019 Beta -0.002 Annual Standard Deviation 0.057 Annual Variance 0.003 Information Ratio -0.447 Tracking Error 0.138 Treynor Ratio 8.685 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(19, 0), self.ClosePositions) def OnData(self, data): if self.check == False or self.openingBar is None: return if data["USDJPY"].Price > self.openingBar.High: self.MarketOrder("USDJPY", 1000) self.check = False elif data["USDJPY"].Price < 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