I am trying to code a strategy I am using on MT-4 so I can do back testing etc.

One of the conditions is pretty easy to set up on a chart, but I don't have a clue how to code this. On a chart I add the stochastic indicator then add the Bollinger bands to the same window and apply the BB's to the previous indicator's data (the stoch). The condition I am looking for is when the stoch travels outside the BB.

These PICs should explain it if this doesn't make sense:

http://i.imgur.com/DbtuxPy.jpg

http://i.imgur.com/mCZPXvh.jpg

How do I apply one indicator to another like this?

Thanks