I hope everything is well for you.
My question is about a indicator I have, this indicator print open price of first bar from MES03-23 cash time in Europe it is 15:30. the problem I have found today is that the price printed is 3852,50 but the chart I use show 3861.50. Can someone to help me to understand this behaivour???
My code:
protected override void OnBarUpdate()
{
if (ToDay(DateTime.Now )== ToDay(Time[0]) & ToTime(Time[0]) > ToTime(15, 30, 00) )
{
// Calculate the bars ago value
int barsAgo0 = CurrentBar - Bars.GetBar(new DateTime(2023, 01, 05, 15, 30, 0));
int barsAgo1 = CurrentBar - Bars.GetBar(new DateTime(2023, 01, 05, 15, 30, 1));
Print("The Open price on the 15:30:00 bar was: " + Open[barsAgo0].ToString());
Print("The Open price on the 15:30:01 AM bar was: " + Open[barsAgo1].ToString());
}
else
{
return;
}
}
screenshot of output:
screen shot chart TF 1s: Blue line in the top is over 3860, exactly 3861,5
Best Regards.

Comment