I have a strategy that needs to calculate entries on each tick but exit once the bar closes. I have added a secondary data series and have tried to send my orders to that tick data series, but the entry is still a bar late. Please review the code below:
else if (State == State.Configure)
{
SetStopLoss("", CalculationMode.Currency, 200, false);
AddDataSeries(Data.BarsPeriodType.Tick, 1);
}
}
protected override void OnBarUpdate()
{
if (BarsInProgress != 0)
return;
if (CurrentBars[0] < 3)
return;
// Set 1
if (Low[2] < Low[3])
{
EnterLong(1, 1, "Long: 1tick");
}
if(Position.GetUnrealizedProfitLoss(PerformanceUni t.Points, Close[0]) > 0)
{
ExitLong(Convert.ToInt32(DefaultQuantity), "", "");
}

Comment