Remember, this all depends on the chart. If the Time becomes 1005 within a bar, it's unlikely to do... For example, if the Bar chart is based on even numbered charts( 2, 4, 6, 8, 10... ). I thought any thing that is in need of control structure (if-then, for, while, etc.) is triggered at the end of each bar... I haven't checked the thing under within the bar with Tick resolution, though... and I won't... so why not try that... Few ways are to write the thing in a lower timeframe, like 1 or a 5-min. chart and re-code it so that your logic works under it...