There are already some Adaptive Stochastic scripts out there, but i didn't see the concept of using different periods highest/lowest for their calculations. What we want
for such oscillator is to be active when price is trending and silent during range periods. Like that the information we will see will be clear and easy to use.
Switching between a long term highest/lowest during range periods and a short term highest/lowest during trending periods is what will create the adaptive .
The switching is made thanks to the Efficiency Ratio, the period of the efficiency ratio is determined by the length parameter.
The period of the highest and lowest will depend on the slow and fast parameters, if our efficiency ratio is close to one (trending market) then the indicator will use highest and lowest of period fast, making the indicator more reactive, if our efficiency ratio is low (ranging market) then the indicator will use highest and lowest of period slow, making the indicator less reactive.
The source of the indicator is a running line (lsma) of period slow-fast.
it is also possible to switch the parameters values, making the indicator reactive during ranging market and less reactive during trending ones.
Hope you enjoy
For any questions/demands feel free to pm me, i would be happy to help you