Normalizing: from moving average to oscillator

 

Let's say you have a moving average 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, ...).

Now my question is: does anyone know how to do this?

there are multiple applications for this problem and sharing this solution could help your fellow trader (me :-) without giving up your competitive edge I think.

cheers.

 

Uh... how about like rsi, and stochastic (macd has no limits).

Search out how those are calculated and you might find your answer.

 
won't work because the true oscillators work in a different way than a normalized moving average.
 
well maybe this could work: divide the change of price by the maximum range of prices for the day
 

Oscillators display the current value as a "percent" of a prior range, so depending on what you want to see, that can work.

Reason: