The length of the "Dynamic SMA" - "dSMA" can be:
'RSI', 'Stoch', 'ATR', 'MFI' or '%R'
For example 'RSI' -> the length of the sSMA will be the itself
The biggest challenge was:
'Pine cannot determine the referencing length of a series. Try using max_bars_back' error
The writer of 'referencing length of a series' issue gave following solution:
bar_index == 0 ? 4999 : len
or in case of values which don't go above 100:
bar_index == 0 ? 100 : len
This assigns the necessary buffer to the function.
I'm most grateful for the given solution!
These dSMA's can give levels, also crossovers of different dSMA's can give extra information
ATR (close / atr( len )
"show regular SMA" will show the "SMA" with the same length (with default lighter color)
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.