Overall Statistics |
Total Trades 3 Average Win 0% Average Loss -1.45% Compounding Annual Return 0.894% Drawdown 13.500% Expectancy -1 Net Profit 4.554% Sharpe Ratio 0.134 Probabilistic Sharpe Ratio 1.488% Loss Rate 100% Win Rate 0% Profit-Loss Ratio 0 Alpha 0.01 Beta 0.001 Annual Standard Deviation 0.075 Annual Variance 0.006 Information Ratio -0.678 Tracking Error 0.185 Treynor Ratio 7.458 Total Fees $0.00 |
class OptimizedCalibratedAutosequencers(QCAlgorithm): def Initialize(self): ticker = 'GBPUSD' self.SetStartDate(2016, 1, 1) self.SetEndDate(2021,1,1) self.SetCash(100000) self.AddForex(ticker, Resolution.Daily) # INDICATOR CODE # ######################################################################## res = Resolution.Daily self.EnableAutomaticIndicatorWarmUp = True self.fast = self.SMA(ticker, 50, res) self.slow = self.SMA(ticker, 200, res) self.true_range = self.ATR(ticker, 14, res) self.ticket = None def OnData(self, data): ticker = 'GBPUSD' if not(data.ContainsKey(ticker) and data[ticker] is not None): return # EXECUTION CODE # ######################################################################## if not self.Portfolio[ticker].Invested: fast_cv = self.fast.Current.Value slow_cv = self.slow.Current.Value atr = self.true_range.Current.Value if fast_cv > slow_cv: quantity = self.CalculateOrderQuantity(ticker, 1) self.MarketOrder(ticker, quantity) self.ticket = self.StopMarketOrder(ticker, -quantity, data[ticker].Price - 3 * atr) elif fast_cv < slow_cv: quantity = self.CalculateOrderQuantity(ticker, -1) self.MarketOrder(ticker, quantity) self.ticket = self.StopMarketOrder(ticker, -quantity, data[ticker].Price + 3 * atr) if self.ticket is not None: self.Plot("SL", "LimitPrice", self.ticket.Get(OrderField.StopPrice)) self.Plot("SL", "SecurityPrice", data[ticker].Price) if self.Portfolio[ticker].IsLong: position = 1 elif self.Portfolio[ticker].IsShort: position = -1 else: position = 0 self.Plot("Position", "Val", position)