***CREDIT TO TradingView's TA Library*** (tradingview.com/script/BICzyhq0-ta/), 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 step7:plot