Here is strategy code. Please help me where is error. Thank you
protected override void Initialize() { Add(PeriodType.Tick, TSLOW); Add(LicoSafeZone(TFAST_EMAFast,TFAST_EMASlow,0,true)); Add(LicoCCIBarStrategy(true, true, false, 0.6, TFAST_EMAFast, TFAST_CCIFast, TFAST_EMASlow, TFAST_CCISlow, false, 5)); Add(LicoCCI(TFAST_CCIFast, TFAST_CCISlow)); Add(LicoEMARibbon(TFAST_EMAFast, TFAST_EMASlow)); CalculateOnBarClose = false; ExitOnClose = false; EntriesPerDirection = 1; TraceOrders = true; } protected override void OnBarUpdate() { if (CurrentBars[0] <= BarsRequired || CurrentBars[1] <= BarsRequired) return; if (BarsInProgress == 0) { #region GoLong //Enter if (Position.MarketPosition == MarketPosition.Flat && CCI(TFAST_CCISlow)[0] > 0 && CCI(TFAST_CCIFast)[1] < -100 &&(ToTime(Time[0]) >= StartTime && ToTime(Time[0]) <= EndTime)) { EnterLongStop(DefaultQuantity, High[0] + 1 * TickSize, "LongEntry"); } //Exit if (Position.MarketPosition == MarketPosition.Long) { //Count of bars since open entry to actual bar int BarsFromEntryLong = BarsSinceEntry(0, "LongEntry", 0); //Number of highest LicoSafeZone.DnSafeZonePlot since open entry int MaxSZLong = HighestBar(LicoSafeZone(TFAST_EMASlow, TFAST_EMAFast,0,true).DnSafeZonePlot, BarsFromEntryLong); //Price of highest LicoSafeZone.DnSafeZonePlot since open entry double LongSL = LicoSafeZone(Close, TFAST_EMASlow, TFAST_EMAFast,0,true).DnSafeZonePlot[MaxSZLong] + -1 * TickSize; if (Low[0] <= LongSL) { ExitLongStop(LongSL, "LongExit", "LongEntry"); } } #endregion
Comment