OPEN-SOURCE SCRIPT

Dynamic SMA

已更新
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
快照

ATR (close / atr(len)
快照

Stoch
快照

MFI
快照

%R
快照

"show regular SMA" will show the "SMA" with the same length (with default lighter color)
版本注释
Updated to v5
Due to evolution in Pine Script™, an error occurred,
should be fixed now.
版本注释
Update, bugfix (max len 5000 allowed)
版本注释
Further Bugfix, sorry guys!
ATRdynamicMFIMoving AveragesOscillatorsRelative Strength Index (RSI)

开源脚本

本着真正的TradingView精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受网站规则约束。 您可以收藏它以在图表上使用。

想在图表上使用此脚本?


LuxAlgo Dev: luxalgo.com
PineCoder: pinecoders.com

- We cannot control our emotions,
but we can control our keyboard -
更多:

免责声明