How to create range for custom oscillator?

 
 

Hi. Just use the 'High[iHighest(...' and 'Low[iLowest...' combo to find the highest/lowest values then 'normalize' using equation :- Value = (High-Actual)/(High-Low). This will give a value between 0 -> 1. Then multiply by 100.

 
omelette:
Hi. Just use the 'High[iHighest(...' and 'Low[iLowest...' combo to find the highest/lowest values then 'normalize' using equation :- Value = (High-Actual)/(High-Low). This will give a value between 0 -> 1. Then multiply by 100.

Hello Omelette,

Thanks for your quick reply to my question. The way I understand it, the High predefined variable relates to the highest price over a given series of periods. What I need is a way to take the Delta(diff) between the moving average line (kijun sen) and price, find the largest Delta for the last 'N' periods and then use that High value to define the "100" level. This way, this indicator will dynamically assign the largest Delta value to the 100 (overbought) level in order to accurately represent that currency pair's overbought/oversold status vis-a-vis the kijun sen.

Thus, if I find that the largest positive Delta for the past 1000 periods is +364pips (Price High Close - Kijun Sen value) and the largest negative Delta for the past 1000 periods is -245 pips (Price Low Close - Kijun Sen value), then I set the value of 364 equal to the "100" upper range boundary and set -245 pips equal to the "0" lower range boundary.

I've added a chart showing the custom oscillator and its relationship to price and the kijun sen just to make it more clear. In Ichimoku, the kijun sen and price's relationship to it can often be used to determine overbought/oversold levels. I am trying to refine the oscillator below so that it automatically takes the largest Delta it finds between price and the kijun sen and assigns that to the 100% level. This way, I can gauge how overbought/oversold the underlying currency is in relation to this measure.

Please let me know if I've misinterpreted what you've said.

Best,

Ian

 
 

You are a real bud to do this for me, Omelette.

It looks like you nailed it. It looked a bit weird at first, but that was fixed by me increasing the lookback period to 1000 periods. Nice job!!!

Thanks so much for your generous help on this!

Ian

 

well, can u share the ichihistogram?

 

hello iboersma! can you share the ichihistogram?

 
Kelch Monteiro:
hello iboersma! can you share the ichihistogram?

Kelch Monteiro, I copied the code from here https://www.mql5.com/en/forum/176408 seems with a longer look back period get smoother results.

Files:
 

thanks man!

Reason: