Bollinger bands in a seperate window with steady size

 

Let's say you have a moving average (or a bollinger band, which is a moving average + and - 2 standard deviations) on a chart, and you want to get that into a seperate window at the bottom of the screen, you would think that by just changing #property indicator_chart_window into #property indicator_separate_window and done is done. But the problem here is that the price oscillations will make your moving average -which is now in a seperate window- change the minimum and maximum of the window. Now you probably think, this is easy, just change the minimum and maximum of the window and you're done, but the problem here it's practically not doable because you don't know the maximum of the price action. Hence, you have to normalize: you have to change the value the moving average has calculated into a value between 0 and 100 to make your moving average a true oscillator (like rsi, macd, stochs,...). Because if you look at the picture, you see that by scrolling the chart more to the right, the shape of the bands changes. I want to prevent this by normalizing it (give it a value between 0 & 100).

Now my question is: Does anyone know how to divide the change of price by the maximum range of prices for the day? Or a way to prevent the bollinger from changing shape? I've attached the code.

 

Dynamic Zone RSI

Try the Dynamic Zone RSI

https://www.mql5.com/en/forum/173787

It has Bollinger Band, EMA, and RSI. It's possible to re-program to turn off the RSI if you don't need it.

 

Maybe this thread could help you https://www.mql5.com/en/forum/175961

 

Try this summarized thread https://www.mql5.com/en/forum to find something.

We are having such threads for RSI indicator https://www.mql5.com/en/forum , Momentum indicator https://www.mql5.com/en/forum/176430 , Parabolic SAR https://www.mql5.com/en/forum/177358 , Stochastic https://www.mql5.com/en/forum/177239 , NRTR https://www.mql5.com/en/forum/173170 , about divergence https://www.mql5.com/en/forum/175886 and Support/resistance https://www.mql5.com/en/forum/177227 and some more.

 

thanks a lot for the answers guys, but I think I have expressed myself in the wrong way, let me restate the problem:

let's say you have a 20 period moving average in your chart window, and you want to convert this into an oscillator in your seperate window: you want divide the change of price by the maximum range of n periods (20), which essentially gives you an oscillator. Any idea how to do this?

Files:
ma20.mq4  6 kb
 

Easy: (MA-MA(x)/MA(x))

Also knowns as Price Oscillator.