protected override void OnCalculate() { //Set automated during configuration in input dialog at strategy escort in chart this.IsAutoConfirmOrder = this.Autopilot; //calculate data OrderDirection_Enum?resultdata = this._RunningWithTheWolves_Indicator.calculate(Closes[0], this.MA_Selected, this.MA_Fast, this.MA_Medium, this.MA_Slow); if (resultdata.HasValue) { switch (resultdata) { case OrderDirection_Enum.OpenLong: this.DoEnterLong(); break; case OrderDirection_Enum.OpenShort: //this.DoEnterShort(); break; case OrderDirection_Enum.CloseShort: // && this._orderentershort.IsOpened && !this._orderentershort.IsManuallyConfirmable if (this._orderentershort != null && this.IsAutoConfirmOrder) { CloseShortTrade(new StrategyOrderParameters { Type = OrderType.Market }); this._orderentershort = null; } break; case OrderDirection_Enum.CloseLong: // && this._orderenterlong.IsOpened && !this._orderenterlong.IsManuallyConfirmable if (this._orderenterlong != null && this.IsAutoConfirmOrder) { CloseLongTrade(new StrategyOrderParameters { Type = OrderType.Market }); this._orderenterlong = null; } break; default: //nothing to do break; } } //Create statistic if (this.StatisticBacktesting) { ////todo Create statistic only on bar close and not during the candle session //if (CalculateOnClosedBar == false) //{ _CsvExport.AddRow(); _CsvExport.AddRowBasicData(this, this.Instrument, this.TimeFrame, Bars[0], ProcessingBarIndex); //Order & Trade _CsvExport["OrderAction"] = resultdata; //Additional indicators _CsvExport["SMA-20"] = SMA(Closes[0], 20)[0]; _CsvExport["SMA-50"] = SMA(Closes[0], 50)[0]; _CsvExport["SMA-200"] = SMA(Closes[0], 200)[0]; _CsvExport["RSI-14-3"] = RSI(Closes[0], 14, 3)[0]; ////If there is a higher Time Frame configured and we are not on the same time frame. //if (Closes.Count == 2) //{ // _CsvExport["RSI-14-3_"+this.HigherTimeFrame.PeriodicityValue.ToString()+this.HigherTimeFrame.Periodicity.ToString()] = RSI(Closes[1], 14, 3)[0]; //} // todo columns for trades //TradeDirection;EntryReason;EntryDateTime;EntryPrice;EntryQuantity;EntryOrderType;ExitDateTime;ExitPrice;MinutesInMarket;ExitReason;ExitQuantity;ExitOrderType;PointsDiff;PointsDiffPerc;ProfitLoss;ProfitLossPercent;StopPrice;TargetPrice"; //} } }