OPEN-SOURCE SCRIPT

SNL Popular Moving Averages MTF

アップデート済
SNL△ Popular Moving Averages MTF
Short title: PopMAs

These are popular moving averages used by various traders and they are multi-timeframe, i.e. you can see
the 200 day SMA on a 15 minute chart.
Four moving averages are also included for the current timeframe (20, 50, 100 and 200 EMA).
Not all moving averages are enabled by default. You can turn individual moving averges on or off in the
"Style" tab of the indicator's settings.

The way I see moving averages is that they do not represent a magic mathematical truth, but are simply the
result of many people agreeing on the same parameters. I guess the origin were five working days in a week
and therefore a month would be four times five, i.e. a 20 day SMA. 200 days are probably an estimate of
the work days in a year and the 50 day SMA represents a quarter year.

There are many indicators on TradingView that offer various adjustable moving averages, including
combinations and multi-timeframe. But my interest was to have an indicator with the most popular moving
averages and it should be multi-timeframe capable. By design I did not want to make the periods adjustable,
but you could add this easily if you like.

Here are some examples of poplular moving averages:

20 unit EMA : support on 4h BTC chart, Carl the Moon
20, 50, 100, 200 day SMA : classic trading all charts, Benjamin Cowen, Tone Vays
20, 50, 100, 200 week SMA: Benjamin Cowen
21 week EMA: well known BTC support, Benjamin Cowen
800 hour EMA: Traders Reality -> not possible in TradingView, represented as 33 day EMA

Known problems:
- I have not found a way to turn off floating labels according to a plot's state chosen in the "Style"
tab. So you will still see the label floating around even if you have turned off the moving average's
line. But you can always turn of all the floating labels in the settings.
- I have observed unexpected differences on multi-timeframe values: For example, looking at the true 20
week SMA on a weekly BTC chart showed a present time value of 43821 USD, but the value was 43908 USD
for the result of this call used in this script: security(syminfo.tickerid, "W", sma(close, 20))
The difference went away when switching my chart to weekly and back to 15 minutes.

Please comment if you know of other moving averages that are often and successfully used or if you find
that one of the included moving averages is irrelevant and should be removed from this script.
And I would very much appreciate any input regarding the mentioned known problems.
リリースノート
removed unused variable, no functional change
Exponential Moving Average (EMA)Moving AveragesSimple Moving Average (SMA)

オープンソーススクリプト

TradingViewの精神に則り、このスクリプトの作者は、トレーダーが理解し検証できるようにオープンソースで公開しています。作者に敬意を表します!無料で使用することができますが、このコードを投稿で再利用するには、ハウスルールに準拠する必要があります。 お気に入りに登録してチャート上でご利用頂けます。

チャートでこのスクリプトを利用したいですか?

免責事項