I want to print the OHLC for the bar that is currently forming.
I'M in MARKET REPLAY
if i do this;:
if (State == State.SetDefaults)
{
Description = @"Enter the description for your new custom Strategy here.";
Name = "Working on it";
Calculate = Calculate.OnPriceChange;
EntriesPerDirection = 1;
EntryHandling = EntryHandling.AllEntries;
IsExitOnSessionCloseStrategy = true;
ExitOnSessionCloseSeconds = 30;
IsFillLimitOnTouch = false;
MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
OrderFillResolution = OrderFillResolution.Standard;
Slippage = 0;
StartBehavior = StartBehavior.ImmediatelySubmit;
TimeInForce = TimeInForce.Gtc;
TraceOrders = true;
RealtimeErrorHandling = RealtimeErrorHandling.IgnoreAllErrors;
StopTargetHandling = StopTargetHandling.PerEntryExecution;
BarsRequiredToTrade = 20;
}
else if (State == State.Configure)
{
AddDataSeries(Instrument.FullName, Data.BarsPeriodType.Tick, 1);
AddDataSeries(Instrument.FullName, Data.BarsPeriodType.Minute, 60);
AddHeikenAshi(Instrument.FullName, BarsPeriodType.Minute, 60, MarketDataType.Last);
}
protected override void OnMarketData(MarketDataEventArgs e)
{
if (e.MarketDataType == MarketDataType.Last && BarsInProgress == 1)
{
Print(Times[2][0] + " " + Closes[2][0]);
}
}
It prints always the closing price of the previous candle and not the one forming. I need to have the one that is currently forming in the OnMarketData for the 1h timeframe
Even in the OnBarUpdate() would be ok to have it.
it gives me the last bar close even for OnEachTick
thanks
Comment