protected override void OnBarUpdate()
{
if(State == State.Historical)
{
return;
}
if (CurrentBar < BarsRequiredToTrade)
return;
//Add your custom strategy logic here.
if(setPrice == false)
{
LimitPrice = Close[0] + (8 * TickSize);
AddLimitPrice = Close[0] - (8 * TickSize);
setPrice = true;
}
if(Position.MarketPosition == MarketPosition.Flat && firstEntry == false)
{
if(Position.MarketPosition == MarketPosition.Flat)
{
EnterLong(1,"long entry");
}
if(Position.MarketPosition == MarketPosition.Long)
{
EnterShortStopMarket(0,true,2,AddLimitPrice," First short limit entry");
}
firstEntry = true;
}
The EnterLong(1,"long entry"); gets executed but that is it. On my orders tab i cannot see EnterShortStopMarket(0,true,2,AddLimitPrice," First short limit entry"); and nothing happens if the price gets to the point when entershortstopmarket should trigger.
Everything works fine in playback.
Comment