Ahoora Trend is an oscillator that use moving average based of high or low values (depends of current candle position from this MA) instead of classic close value price in an RSI calculation. It results an overbought / oversold oscillator that spot price that has highly derivated from the mean. The oscillator is “reset” everytime price cross above or below the 2 different moving average, so oversold and overbought information gain in reliability.
// parameters
// Lookback = 25
hh = average[Lookback](high)
ll = average[Lookback](low)
if high>hh then
buffer = 1
elsif low<ll then
buffer = -1
endif
myATR = AverageTrueRange[Lookback](close)
if buffer < 0 then
value = hh-myATR
else
value = myATR+ll
endif
value2 = RSI[Lookback](value)
RETURN value2 as "Ahoora Trend", 80 as "80", 20 as "20"