Yes, with a trade function. But this is something for "advanced programmers". The simplest way is just not using a hourly bar period when you need a minutely exit.