I have an idea that might work for you
for example:
your strategy dictates not to stay longer than 30 minutes in a trade
use the ATR (average true range) to tell you the average range in the past 30 minutes
if you'r looking at a 5min set the period to 6
take what the ATR is telling you to...