I moved eL1 of my order entry code to OnMarketData (from OnBarUpdate) for a more controlled entry.
All entry conditions stay in OnBarUpdate and are then passed to OnMarketData via 'touch_price' to initiate the entry.
On the first instance of use, after the eL1 is working, the 'touch_price' continues to initiate entrys (that are ignored due to the 1 entry /direction) but after the eL1 is stopped out, the next trigger bar event conditions do not show a new 'touch_price' generated by the OnBarUpdate being detected by the OnMarketData.

The other entrys still in OnBarUpdate continue to function as normally expected.

#region Region_OnMarketData
//
protected override void OnMarketData(MarketDataEventArgs e)
{
//Update bid / ask / spread variables
UpdateBidAskSpread(out cAsk, out cBid, out cSpread);
if ( e.Price == touch_price )
{ Print("Last = "+e.Price);
if ((iOrderL1 == null || Historical) && iQuantity1 != 0)
{ iOrderL1 = EnterLongLimit(0, true, iQuantity1, Closes[0][0] + 1*TickSize, sENTRY1L);
LL_EntryBar0_OMD_L1 = CurrentBars[0];
Print("Entered LL_Order from OnMarketData PreviousBar#= "+CurrentBars[0]+", Time of bar= "+Times[0][0]+", bar closed "+Closes[0][0]+", BarHI= "+Highs[0][0]+", BarLO= "+Lows[0][0]);
}
}
}
#endregion
Thanks,
Jon

Comment