Two Codes
protected override void OnBarUpdate()
{
if (BarsInProgress != 0)
return;
if (CurrentBars[0] < 1
|| CurrentBars[1] < 0)
return;
// Set 1
if ((Close[0] < EMA1[0])
&& (IndOnEachTick[0] > Limite))
{
if (IsFirstTickOfBar && Position.MarketPosition == MarketPosition.Flat)
EnterShortLimit(Convert.ToInt32(DefaultQuantity), (Close[1] + (Ticks_Lmt_Short * TickSize)) , @"ShortEntryStrong");
}
In this first case the order is launched in the bar where conditions are met.
protected override void OnBarUpdate()
{
if (BarsInProgress != 0)
return;
if (CurrentBars[0] < 1)
return;
// Set 1
if ((Close[1] < EMA1[1])
&& (IndOnEachTick[1] > Limite))
{
if (IsFirstTickOfBar && Position.MarketPosition == MarketPosition.Flat)
EnterShortLimit(Convert.ToInt32(DefaultQuantity), (Close[1] + (Ticks_Lmt_Short * TickSize)) , @"ShortEntryStrong");
}
In this second case the order is launched two bars later the conditions are met.
Any idea how can I solve this issue?
Comment