How to get Prev Day OHLC values in 5 min chart frame?

I was trying to get previous day’s OHLC values in 5 min candlestick to perform custom calculations.

Attached test example for reference. (Trying to get BajajFinsrv value of 6-Aug-2021)

However, neither MTF nor PrevN is giving correct output, whereas, when the candlestick is changed to 1Day, it gives proper output.

Why is this so? I thought MTF calculates values based on the provided candle duration. Am I missing something here?

Thanks.

@Streak

This is because there will be a slight price difference between the Close price observed for the last candle in the 3 or 5 or 15 min timeframe and the Close price of the 1 day candle. You can verify this from the chart as well

The close price on 5 min is 14003.70 as compared to 14005.65.

You can refer to this thread to understand

@Krishnendu : But I thought, the purpose of MTF is to calculate value on the mentioned/different timeframe candle (than what is mentioned in the scanner).

i.e. Even on 5 min Candle Scanner, if MTF is placed with day as the argument, then it would perform the calculation based on day’s candle.
image

Otherwise, MTF is just collating the 5min data for the entire day and is not actually a multi-timeframe.

Please confirm.

Thanks.

When you use MTF Daily with a 5min timeframe, the 5min data is used to calculate the Daily values, so if the Close of last candle in 5 min timeframe is 14003.70, the Daily candle is computed by MTF will have Close as 14003.70. MTF does not use another timeframe data.

Using a Daily timeframe data with a 5min timeframe will create look-ahead bias because if I run a scan saying
Nth Candle(Close, 72,5 min) higher than MTF(Day, Close(0))
The Nth Candle(Close, 72,5 min) will form at 3:20 PM but Close(0) for daily timeframe will form at 3:30 PM since that is when the market closes and we see a Close of the daily candle.

Hope this helps.

Now if the Close of the last 5 min is the same as the Close of the Daily candle, the result will match.