Almost every day at 14.30 CET European indices and futures change substantial because data from the US become available. Also when US markets open at 16.00 CET European markets react again and keep following US markets afterwards.
I noticed that around these times quite a number of losing trades occur while backtesting because no indicator can really predict what happens at those times. I would like to test a strategy that would close open positions a few minutes before those events occur in order not to 'gamble' on those two (and maybe other ??) events and look if this makes a difference.
So on a 1 minute timeframe I would like to close positions at 14.28 and at 15.58. Of course I would like to make this general instead of hardcoding the times. How can I check if a bars time is X minutes before a (user) specified time?