Overall Statistics |
Total Trades 17 Average Win 0.20% Average Loss -0.35% Compounding Annual Return -58.819% Drawdown 37.000% Expectancy -0.102 Net Profit -28.671% Sharpe Ratio -2.035 Probabilistic Sharpe Ratio 0.302% Loss Rate 43% Win Rate 57% Profit-Loss Ratio 0.57 Alpha -0.474 Beta -0.091 Annual Standard Deviation 0.245 Annual Variance 0.06 Information Ratio -2.785 Tracking Error 0.277 Treynor Ratio 5.459 Total Fees $0.00 Estimated Strategy Capacity $110000.00 |
# Forex ATR class EmotionalGreenCormorant(QCAlgorithm): def Initialize(self): self.SetStartDate(2014, 10, 10) self.SetEndDate(2015, 2, 25) self.SetCash(100000) self.audusd = self.AddForex("AUDUSD", Resolution.Hour) self.SetWarmup(600) self.atr = self.ATR("AUDUSD", 14, MovingAverageType.Simple, Resolution.Hour) self.sma_atr = IndicatorExtensions.Of(SimpleMovingAverage(10), self.atr) self.alma_fast = self.ALMA("AUDUSD", 48, Resolution.Hour) self.alma_slow = self.ALMA("AUDUSD", 74, Resolution.Hour) self.baseline = self.ALMA("AUDUSD", 598, Resolution.Hour) self.ordersize = 100000 def OnData(self, data): if not self.baseline.IsReady: return self.blim = self.audusd.Close + self.atr.Current.Value self.slim = self.audusd.Close - self.atr.Current.Value self.bstop = self.audusd.Close - self.atr.Current.Value * 1.5 self.sstop = self.audusd.Close + self.atr.Current.Value * 1.5 self.Plot("ATR", "atr", self.atr.Current.Value) self.Plot("ATR", "SMA", self.sma_atr.Current.Value) self.Plot("Custom", "alma_fast", self.alma_fast.Current.Value) self.Plot("Custom", "alma_slow", self.alma_slow.Current.Value) self.Plot("Custom", "baseline", self.baseline.Current.Value) if not self.Portfolio.Invested: if self.atr.Current.Value > self.sma_atr.Current.Value and self.alma_fast.Current.Value > self.alma_slow.Current.Value and self.audusd.Close > self.alma_fast.Current.Value and self.audusd.Close > self.alma_slow.Current.Value and self.audusd.Close > self.baseline.Current.Value: self.Buy("AUDUSD", 100000) self.LimitOrder("AUDUSD", 100000, self.blim) self.StopMarketOrder("AUDUSD", 100000, self.bstop) if not self.Portfolio.Invested: if self.atr.Current.Value > self.sma_atr.Current.Value and self.alma_fast.Current.Value < self.alma_slow.Current.Value and self.audusd.Close < self.alma_fast.Current.Value and self.audusd.Close < self.alma_slow.Current.Value and self.audusd.Close < self.baseline.Current.Value: self.Sell("AUDUSD", 100000) self.LimitOrder("AUDUSD", 100000, self.slim) self.StopMarketOrder("AUDUSD", 100000, self.sstop) def OnOrderEvent(self, orderEvent): order = self.Transactions.GetOrderById(orderEvent.OrderId) if order.Status == OrderStatus.Filled: if order.Type == OrderType.Limit or order.Type == OrderType.StopMarket: self.Transactions.CancelOpenOrders(order.Symbol)