Oscillating Length Moving Averages

***CREDIT TO TradingView's TA Library*** (, Attempted to use "import TradingView/ta/4" to import the library, but for whatever reason
some of the functions failed to work, while others had no issue, so I opted to just copy paste what I wanted to use.

This moving average uses an oscillator to influence the length used during calculation. Extremely customizable/tunable with ability to change Max and Min length values, length multiplier, length multiple,4 different settings ,( <Incline, >Decline , <>Peak, ><Trough), many of the moving averages seen in the library above,+ linear regression curve and the standard ta.wma.

Step1:Get Inputs
Steo3:Select Oscillator to use for Length Oscillation
step4Get the Difference of highest and lowest, Divide the source by the difference
step5: Logic Selection, for Length Values <Incline, >Decline , <>Peak, ><Trough
step6:Select Final Filtering method
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.


The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?