Overall Statistics |
Total Trades 10 Average Win 6.22% Average Loss -1.16% Compounding Annual Return 28.603% Drawdown 3.100% Expectancy 1.538 Net Profit 8.850% Sharpe Ratio 1.552 Loss Rate 60% Win Rate 40% Profit-Loss Ratio 5.35 Alpha 0 Beta 13.075 Annual Standard Deviation 0.115 Annual Variance 0.013 Information Ratio 1.433 Tracking Error 0.115 Treynor Ratio 0.014 Total Fees $4.00 |
class ForexIndicator(QCAlgorithm): def Initialize(self): self.SetStartDate(2017, 6, 1) self.SetEndDate(2017, 10, 1) self.SetCash(5000) self.forex = self.AddForex("EURUSD", Resolution.Daily, Market.FXCM) self.SetBrokerageModel(BrokerageName.FxcmBrokerage) self.psar = self.PSAR(self.forex.Symbol, 0.02, 0.02, 0.2, Resolution.Daily) IndicatorPlot = Chart("Trade Plot") IndicatorPlot.AddSeries(Series("PSAR", SeriesType.Scatter, 0)) IndicatorPlot.AddSeries(Series("Price", SeriesType.Line, 0)) IndicatorPlot.AddSeries(Series("Buy", SeriesType.Scatter, 0)) IndicatorPlot.AddSeries(Series("Sell", SeriesType.Scatter, 0)) self.AddChart(IndicatorPlot) def OnData(self,data): if not self.psar.IsReady: return price = self.Securities['EURUSD'].Price self.Plot("Trade Plot", "PSAR", self.psar.Current.Value) self.Plot("Trade Plot", "Price", price) if not self.Portfolio.Invested and self.psar.Current.Value < price: self.MarketOrder(self.forex.Symbol,10000) self.Plot("Trade Plot", "Buy", price) elif self.Portfolio.Invested and self.psar.Current.Value > price: self.Liquidate() self.Plot("Trade Plot", "Sell", price)