Need guidance how to implement intraday pair trading strategy

Hello,
May I ask for general guidance/examples how to implement intraday pair strategy working on 1minute data.
Idea is: Calculate ratio/std
 If on open (or first 5 minutes) ratio is outside std then trade.
 If any open trades close before EOD.
I'm bit struggling on how to calculate ratio/std on daily while backtesting time constraints on intraday data.
Can I have both Daily and Intraday dataframes at once and how to implement time conditions?Thank you

There are a few options.

You can use backtrader to actually resample the data (example here: https://www.backtrader.com/docu/datamultitimeframe/datamultitimeframe.html)

You can use a counter and resample every x amount of datapoints (ie. use the window of 5 min bars to get the ratio/std) https://backtestrookies.com/2017/12/06/backtraderdatareplay/

Can "cheat" by using formatting and backfilling daily information into a minute custom dataframe and then sampling this minute data. (pandas is best for this IMO)
Not sure what a "ratio/std" means but if you provided a bit more information I am sure you would get a little more information.


@monkk said in Need guidance how to implement intraday pair trading strategy:
I'm bit struggling on how to calculate ratio/std on daily while backtesting time constraints on intraday data.
If you are struggling you could actually show where you are struggling.
An educated guess is that you struggle where mostly everybody struggles:
 you want to calculate the daily ratio for the current day
 but this is only happening when the entire intraday stream has been seen.
You trap yourself into believing that calculating the daily ratio even whilst you are seeing the intraday data is not cheating, but it is.
The solution (assuming the above is right)
 The daily timeframe has to be replayed, i.e.: it will produce as many ticks as the underlying intraday data has, but it will be a daily bar, which will close at the end of the intraday stream (for perfect alignment you need a trading calendar or accurate end of session times)
The daily ratio will be calculated multiple times, but it will a real calculation.