View Single Post
  #1 (permalink)  
Old 09-22-2007, 04:57 PM
MrM MrM is offline
Member
 
Join Date: Jul 2007
Posts: 81
MrM is on a distinguished road
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.
Attached Images
File Type: jpg bollinger_seperate_window.JPG (46.1 KB, 445 views)
Attached Files
File Type: mq4 Bands_test.mq4 (2.4 KB, 35 views)
Reply With Quote