I have a strategy that runs with calculation mode OnEachTick however in a backtest environment data is only processed OnBarClose.

What I'm after is how to get an "OnBarClose" in a live OnEachTick call to OnBarUpdate.

The reason for this is that I have to have separate logic to determine at what point we are looking at price (or any) data series.

For example if I run Calculate.OnEachTick and I want to look for a simple thing such as the last candle closed UP I would have to do something like this:

Code:
  if(IsFirstTickOfBar && Close[1] > Open[1])
     Print("Up Candle");
This is fine and works the same in a back test BUT imagine we now want to take a trade :

Code:
  if(IsFirstTickOfBar && Close[1] > Open[1])
    EnterLong(...);
In a live environment this will immediately take the trade on the opening of the current candle. In a back test the trade won't get placed until the close of the current candle we are on. To fix this we need to move our logic to using Calculate.OnBarClose for a backtest which is also fine but then we have to do some silly stuff such as:

Code:
  ...in State.Configure
  IsBackTest = Account.Name == Account.BackTestAccountName;
  
  if(IsBackTest)
     Calculate = Calculate.OnBarClose();

  ...in OnBarUpdate
  if(IsBackTest && Close[0] > Open[0])
     EnterLong(...);
  else if(IsFirstTickOfBar && !IsBackTest && Close[1] > Open[1])
     EnterLong(...);
See where I'm going with this? I would like to keep processing utilizing the same data series index without having to do a bunch of extra logic throughout the code. Meaning can we still do Calculate.OnEachTick and know when the bar is actually closing to reference the current candle as index 0 vs index 1 that it would be for OnBarClose or during a backtest simply to keep our backtest entries in line with our live entries on the same bar?