I need a help please, my strategy does not let me enter on a price of previous candle using EnterLongStopMarket.
I honestly do not understand why, the entry order and price should be correct
entryOrder_1 = EnterLongStopMarket(0, false, 1,Open[1], "F1_entry" + a);
I have attached error message from output window and Log tab, bellow is my code.
CODE
protected override void OnBarUpdate() { if (CurrentBar < 20) return; if (High[0] > High[1] && High[1] > High[2] && Low[0] > Low[1] && Low[1] > Low[2] & Open[0] > Close[2] & Open[0] < Close[0] & Open[2] < Close[2] //&& Position.MarketPosition == MarketPosition.Flat //&& IsFirstTickOfBar //&& BarsInProgress == 0 ) { ++a; entryOrder_1 = EnterLongStopMarket(0, false, 1,Open[1], "F1_entry" + a); Draw.ArrowUp(this, "F1" + a, true, 0, Low[0] - TickSize, Brushes.Lime); barLong = CurrentBar; } }
protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"Sample Using OnOrderUpdate() and OnExecution() methods to submit protective orders"; Name = "audusdtest"; Calculate = Calculate.OnBarClose; // Calculate.OnEachTick; // Calculate.OnBarClose EntriesPerDirection = 100; EntryHandling = EntryHandling.AllEntries; IsExitOnSessionCloseStrategy = true; ExitOnSessionCloseSeconds = 30; IsFillLimitOnTouch = false; MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix; OrderFillResolution = OrderFillResolution.Standard; Slippage = 1; StartBehavior = StartBehavior.WaitUntilFlat; TimeInForce = TimeInForce.Gtc; TraceOrders = true; RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose; StopTargetHandling = StopTargetHandling.PerEntryExecution; BarsRequiredToTrade = 10; } else if (State == State.Configure) { } }
Thank you
Comment