PROTECTED SOURCE SCRIPT

Five MAs Multi-Moving Average Pack (SMA/EMA/WMA/RMA/HMA/VWMA)

34
Display up to 5 MAs in one script. Per-line type/length/color/width/show, optional band fill, and built-in price×MA cross alerts.

Overview

This indicator draws up to five moving averages in one script.
Each line has independent controls for type (SMA/EMA/WMA/RMA/HMA/VWMA), length, color, width, and visibility. It also includes alert conditions when price crosses each MA, helping you track trend, pullbacks, and breakouts without cluttering the chart.

Key Features

Manage 5 MAs from a single indicator

Per-line MA type selection: SMA, EMA, WMA, RMA, HMA, VWMA

Independent length/color/width/show for each line

Optional band fill between MA1 and MA5

Price vs MA cross alert conditions included

Selectable input source (e.g., close, hlc3)

Inputs

Source: price source used for calculations (default: close)

MA1–MA5

Type: SMA / EMA / WMA / RMA / HMA / VWMA

Length: period (e.g., 5, 20, 50, 100, 200)

Color: line color

Width: line width

Show: visibility toggle

Fill between MA1 and MA5: draw a subtle band between MA1 and MA5

Enable price-cross alerts: expose alertconditions for price crossing each MA

Alerts (Price × MA)

Price crosses UP MA#: close crosses above MA#

Price crosses DOWN MA#: close crosses below MA#
Create alerts via the chart’s Alerts panel and choose the desired condition from this indicator.

Note: alertcondition() is declared in the global scope. On/off is controlled by an input flag.

How to Use

Paste the code into the Pine Editor → Save → Add to chart.

Configure Type / Length / Color / Width / Show for each MA.

Turn on Fill between MA1 and MA5 if you want a band.

Enable price-cross alerts and set them up in the Alerts panel.

Suggested Defaults

MA1: EMA 5

MA2: SMA 20

MA3: SMA 50

MA4: SMA 100

MA5: SMA 200
Good all-round set for intraday to swing and higher timeframes.

Best Practices

Check the same params across multiple timeframes to assess trend consistency.

The MA1–MA5 band helps visualize trend strength and volatility expansion/contracting.

Picking a type:

EMA: faster response, good for short-term signals

SMA: standard smoothing

HMA: smooth yet responsive

VWMA: volume-weighted perspective

FAQ / Troubleshooting

“Syntax error at input 'end of line without line continuation'”
Wrap multi-line ternaries in parentheses or use a switch. The script uses switch to avoid this.

“Cannot use 'fill' in local scope”
fill() must be in the global scope. Here it’s always called globally; on/off is done with a transparent color.

Performance
Hide unused lines and keep widths modest if your chart feels heavy.

Disclaimer

This script is for educational and informational purposes only and is not financial advice. Use at your own risk.


Five MAs|5本移動平均パック(SMA/EMA/WMA/RMA/HMA/VWMA)

1つのインジで最大5本の移動平均線を表示。種類・期間・色・太さ・表示ON/OFFを個別設定。価格が各MAを上下クロスするアラート内蔵。

概要

このインジケーターは、**1つのスクリプトで5本の移動平均(MA)**を同時表示します。
各ラインは 種類(SMA/EMA/WMA/RMA/HMA/VWMA)、期間、色、太さ、表示を個別に調整できます。さらに、価格が各MAをクロスした際のアラート条件を標準搭載。短期〜長期のトレンド判定、押し目/戻り目の把握、クロス監視などに活用できます。

主な機能

5本のMAを1つのインジで管理(チャートをすっきり)

MAの種類を個別に選択(SMA/EMA/WMA/RMA/HMA/VWMA)

期間・色・線幅・表示/非表示を個別設定

**MA1とMA5の帯(フィル)**の任意描画(ON/OFF)

価格×各MAのクロスをアラート条件として登録可能

入力ソース切替(close / hlc3 など)

入力パラメータ

Source:計算に使う価格(既定:close)

MA1〜MA5

Type:SMA / EMA / WMA / RMA / HMA / VWMA

Length:期間(例:5, 20, 50, 100, 200 など)

Color:ライン色

Width:ライン太さ

Show:表示/非表示

Fill between MA1 and MA5:MA1とMA5の間を塗りつぶす(薄い帯)

Enable price-cross alerts:価格が各MAを上下クロスした際のアラート条件を有効化

アラート(価格×MA)

Price crosses UP MA#:close が MA# を上抜け

Price crosses DOWN MA#:close が MA# を下抜け
アラート作成:チャート右上「アラート」→「条件」から本インジの該当項目を選択。

注:alertcondition() はグローバルスコープで宣言しています。ON/OFFは入力フラグで制御しています。

使い方(手順)

Pineエディタにコードを貼り付け → 保存 → チャートへ追加。

設定で各MAの Type / Length / Color / Width / Show を調整。

帯を使う場合は Fill between MA1 and MA5 をON。

クロス通知を使う場合は Enable price-cross alerts をONにし、アラート画面で該当条件を選択して作成。

推奨の初期構成(例)

MA1:EMA 5

MA2:SMA 20

MA3:SMA 50

MA4:SMA 100

MA5:SMA 200
短期〜長期のバランスが良く、デイトレ〜スイング〜中長期まで幅広く確認可能。

ベストプラクティス

時間軸をまたいで同じパラメータを見ると、トレンドの一貫性を評価しやすいです。

帯(MA1–MA5)はトレンド強度やボラの広がり/収縮の視覚化に有効です。

種類の選択:

EMA:反応が速く短期向き

SMA:ノイズを均しやすい標準

HMA:滑らか&速い応答

VWMA:出来高加重で指値の厚みを反映

よくある質問・トラブルシュート

「Syntax error at input 'end of line without line continuation'」
三項演算子を改行で繋ぐときは全体を括弧で包むか、switch 構文を使ってください。最新版では switch を採用しています。

「Cannot use 'fill' in local scope」
fill() は ローカルスコープ不可。本スクリプトでは常時グローバルで呼び、ON/OFFは透明色で制御しています。

表示が重い
必要なMAのみ表示(Show)にしたり、線幅を細くすることで軽くなります。

免責

本スクリプトは情報提供のみを目的としており、投資助言ではありません。利用による損失について作者は責任を負いません。

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.