Looks OK. Suggest, however, checking it out with other time frames and a variety of stocks with different volatilities. That maze should find any problems, if there are any. I have not looked at your code, but if you are concerned about stability between frames then just watch it for a while...