OPEN-SOURCE SCRIPT
Telah dikemas kini

Dynamic SMA

3 528
This script uses dynamic length to create a different sma type.

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 RSI 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 Support/Resistance levels, also crossovers of different dSMA's can give extra information

Examples:


RSI
syot kilat

ATR (close / atr(len)
syot kilat

Stoch
syot kilat

MFI
syot kilat

%R
syot kilat

"show regular SMA" will show the "SMA" with the same length (with default lighter color)
Nota Keluaran
Updated to v5
Due to evolution in Pine Script™, an error occurred,
should be fixed now.
Nota Keluaran
Update, bugfix (max len 5000 allowed)
Nota Keluaran
Further Bugfix, sorry guys!

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.