OPEN-SOURCE SCRIPT
更新済

TF: Price-MA Deviation (PMAD)

314
TradingFlow: Price-MA Deviation (PMAD)

TradingFlow: Price-MA Deviation (PMAD) is a mean-reversion indicator that measures how far price has deviated from its moving average, normalized to a 0–100 scale based on recent historical range. Raw percentage deviation varies widely across assets and timeframes, so PMAD takes a different approach. It answers a simple question: where does the current deviation sit relative to recent history? This makes PMAD comparable across different symbols, timeframes, and market conditions. A reading of 85 on Bitcoin means the same thing as a reading of 85 on a stock. Price is stretched to the upper end of its recent deviation range.

Key Features:

Normalized Deviation (0–100)
The core line oscillates between 0 and 100. At 50, price is at its moving average. Above 50, price is above the MA. Below 50, price is below. The value shows where the current deviation falls within the highest and lowest deviations over the normalization lookback period.

Adaptive Timeframe Scaling
PMAD automatically adjusts its MA and normalization periods based on the chart timeframe. On intraday charts, shorter periods keep the indicator responsive. On daily and higher timeframes, the full user-specified periods produce a smoother macro view. Intraday scaling can be fine-tuned with exposed base period and normalization multiplier inputs.

Auto Market-Hour Detection
PMAD detects the asset type and sets trading hours automatically. Crypto and forex get 24 hours, futures get 23 hours, and equities get 6.5 hours. A manual override is available for non-standard sessions.

Overbought and Oversold Zones
Dotted reference lines at 85 and 15 mark potential overbought and oversold conditions. The area above 85 is shaded red; the area below 15 is shaded green. These levels are configurable.

Signal Line
An optional smoothed line (SMA or EMA) of the deviation can be displayed. Crossovers between the deviation line and the signal line can help identify shifts in momentum. The signal line period is set in bars and works across all timeframes.

Alerts
Six built-in alert conditions are available: overbought cross, oversold cross, signal bullish cross, signal bearish cross, bullish regime (above 50), and bearish regime (below 50).

How to Read the Chart

A reading above 50 means price is trading above its moving average. A reading below 50 means price is below. The further from 50, the more extended the deviation.

Overbought (above 85) means price has deviated to the upper end of its recent range. Oversold (below 15) means price has deviated to the lower end. These zones suggest potential mean-reversion conditions, but should not be treated as automatic entry or exit signals.

When the deviation line crosses above the signal line, short-term momentum is increasing. When it crosses below, momentum is decreasing.

Flexible Configuration
PMAD supports SMA and EMA moving-average types, adjustable MA and normalization periods, configurable thresholds, and per-asset trading hour settings. Intraday base period and normalization multiplier can be fine-tuned for different markets or trading styles.

Practical Use
PMAD can identify extended price conditions, monitor mean-reversion opportunities, filter entries against the broader deviation context, and compare relative strength across multiple symbols. It works best alongside price action, support and resistance, volume, volatility analysis, and disciplined risk management.

PMAD does not predict future price movement and should not be used as a standalone entry or exit system.

---

TradingFlow: Price-MA Deviation (PMAD)

TradingFlow: Price-MA Deviation (PMAD) 是一個均值回歸指標,衡量價格偏離移動平均線的程度,並根據近期歷史範圍歸一化至 0–100 的刻度。不同商品和時間週期之間的百分比偏離差異很大,PMAD 不顯示原始偏離值,而是回答一個簡單的問題:目前的偏離程度,在近期歷史中處於什麼位置?這讓 PMAD 可以在不同標的、時間週期和市場條件之間進行比較。Bitcoin 上的 85 讀數與股票上的 85 讀數含義相同。價格已偏離至其近期偏離範圍的上端。

核心功能:

歸一化偏離值(0–100)
核心線在 0 到 100 之間震盪。位於 50 時,價格正好在移動平均線上。高於50,價格在均線上方;低於50,價格在均線下方。該數值代表目前偏離值在歸一化回看期內最高和最低偏離值之間的位置。

自適應時間週期縮放
PMAD 會根據圖表時間週期自動調整 MA 和歸一化的期間。在日內圖表上使用較短的週期以保持靈敏度;在日線及以上圖表上使用完整的使用者設定週期,以獲得更平滑的宏觀視角。日內縮放可透過基礎期間和歸一化倍數進行微調。

自動市場時數偵測
PMAD 會偵測資產類型並自動設定交易時數。加密貨幣和外匯為24小時,期貨為23小時,股票為6.5小時。也提供手動覆蓋選項,適用於非標準交易時段。

超買和超賣區域
85 和15 的虛線參考標記潛在的超買和超賣狀態。85 以上區域以紅色陰影標示;15 以下區域以綠色陰影標示。這些水平可自行調整。

訊號線
可選擇顯示偏離值的平滑線(SMA 或 EMA)。偏離線與訊號線之間的交叉,有助於識別動能的轉變。訊號線期間以 K 棒數設定,適用於所有時間週期。

警報
內建六種警報條件:超買突破、超賣跌破、訊號線多頭交叉、訊號線空頭交叉、多頭狀態(50 以上)及空頭狀態(50 以下)。

如何閱讀圖表

當偏離線高於50時,價格交易在移動平均線上方;低於50時,價格在均線下方。距離50越遠,偏離越極端。

當線條進入超買區域(高於85),價格已偏離至近期範圍的上端;進入超賣區域(低於15),價格已偏離至下端。這些區域暗示可能的均值回歸條件,但不應視為自動的進場或出場訊號。

當偏離線向上穿越訊號線,短期動能正在增強;向下穿越則代表動能減弱。

彈性設定
PMAD 支援 SMA 和 EMA 移動平均類型、可調整的 MA 和歸一化期間、可設定的閾值,以及每種資產的交易時數設定。日內基礎期間和歸一化倍數可針對不同市場或交易風格進行微調。

實際使用方式
PMAD 可用於辨識極端價格條件、觀察均值回歸機會、根據偏離背景過濾交易,以及比較多個標的的相對強弱。它適合搭配價格行為、支撐阻力、成交量、波動率分析與風險管理一起使用。

PMAD 無法預測未來價格走勢,也不應單獨用作進場或出場系統。

---

TradingFlow: Price-MA Deviation (PMAD)

TradingFlow: Price-MA Deviation (PMAD) は、価格が移動平均線からどれだけ乖離しているかを測定し、直近の歴史的なレンジに基づいて 0〜100 に正規化する平均回帰型インジケーターです。生の乖離率は銘柄や時間足によって大きく異なるため、PMAD は異なるアプローチを採用しています。シンプルな問いかけに答えます。現在の乖離は、直近の歴史の中でどの位置にあるか。これにより、異なる銘柄、時間足、市場条件間で比較が可能になります。Bitcoin で 85 という読み値は、株式で 85 と同じ意味を持ちます。価格が直近の乖離レンジの上限にまで引き伸ばされている状態です。

主な機能:

正規化乖離値(0〜100)
コアとなるラインは 0 から 100 の間で推移します。50 は価格が移動平均線上にある状態を示します。50 以上なら価格は MA を上回り、50 以下なら下回ります。この値は、正規化のルックバック期間における最高乖離値と最低乖離値のレンジの中で、現在の乖離がどの位置にあるかを示しています。

アダプティブタイムフレームスケーリング
PMAD はチャートの時間足に応じて、MA と正規化の期間を自動調整します。日中足では短い期間を採用し、インジケーターの応答性を維持します。日足以上の時間足では、ユーザーが指定した期間をそのまま使用し、より滑らかなマクロ視点を実現します。日中のスケーリングは、ベース期間と正規化倍数の入力パラメーターで微調整可能です。

マーケット時間の自動検出
PMAD はアセットの種類を検出し、取引時間を自動設定します。暗号通貨と FX は 24 時間、先物は 23 時間、株式は 6.5 時間が適用されます。非標準の取引セッションにも対応できる手動設定が用意されています。

買われすぎ・売られすぎゾーン
85 と 15 の破線は、買われすぎ・売られすぎの目安を示します。85 以上の領域は赤で塗りつぶされ、15 以下の領域は緑で塗りつぶされます。これらの水準は変更可能です。

シグナルライン
乖離値を平滑化した線(SMA または EMA)をオプションで表示できます。乖離線とシグナルラインのクロスは、勢いの変化を捉えるのに役立ちます。シグナルラインの期間はバー数で指定し、すべての時間足で動作します。

アラート
6 種類のアラート条件を標準装備しています。買われすぎ突破、売られすぎ下抜け、シグナルラインの買いクロス、シグナルラインの売りクロス、強気レジーム(50 以上のクロス)、弱気レジーム(50 以下のクロス)です。

チャートの読み方

乖離値が 50 を上回れば、価格は移動平均線の上で推移しています。50 を下回れば、下で推移しています。50 から離れるほど、乖離は極端になります。

買われすぎ(85 以上)は、価格が直近レンジの上限に達していることを示します。売られすぎ(15 以下)は、下限に達していることを示します。これらのゾーンは平均回帰の可能性を示唆しますが、自動的な売買シグナルとして扱うべきではありません。

乖離線がシグナルラインを上抜けた場合は短期の勢いが増し、下抜けた場合は勢いが衰減しています。

柔軟な設定
PMAD は SMA と EMA の移動平均タイプ、MA と正規化の期間調整、閾値の設定、アセット別の取引時間設定に対応しています。日中のベース期間と正規化倍数は、市場やトレードスタイルに合わせて微調整可能です。

実際の使い方
PMAD は、価格の過熱状態の把握、平均回帰の機会の監視、乖離のコンテキストに基づくエントリーのフィルタリング、複数銘柄間の相対ストレングスの比較に活用できます。価格アクション、サポート・レジスタンス、出来高、ボラティリティ分析、そして規律あるリスク管理と組み合わせて使用することが推奨されます。

PMAD は将来の価格動向を予測するものではなく、単独での売買システムとして使用すべきではありません。
リリースノート
Improved visual presentation.
リリースノート
Fine-tuned configs and improved visuals.
リリースノート
- Signal smoothing uses one fixed bar count on every timeframe (SMA or EMA, adjustable via Signal Period).
- Daily+ scaling respects multi-unit timeframes (2D, 2W, 3M). Trading-day targets convert to bars using the timeframe multiplier.
- Trading calendar setting: Auto, 5-day week, or 7-day week. Auto uses 7 days for crypto and 5 otherwise. Holidays are not modeled.
- MA length floor is 2 bars, so the indicator cannot collapse to a flat 50.
- Optional bar-close alert confirmation (on by default). Plots and colors still update live.
- Midpoint alerts and documentation: 50 is the midpoint of the rolling deviation range, not price at the MA.

- 訊號線在所有時間週期統一使用單一固定長度 (SMA 或 EMA,可透過訊號期間調整)。
- 日線以上支援多單位時間週期 (2D、2W、3M) 的換算。交易日目標會依圖表的時間倍數換算為 K 棒根數。
- 交易日曆設定:Auto、5 日制、7 日制。Auto 模式下,加密貨幣採用七日制,其餘採用五日制。不考慮假日。
- MA 長度下限為 2 根,避免指標停在 50 不動。
- 收盤確認警報為可選設定 (預設啟用)。線條與顏色仍即時更新。
- 中點警報與說明:50 是偏離區間的中點,不是價格在 MA 上。

- シグナルをすべての時間足で共通の固定バー数に統一 (SMA または EMA、Signal Period で調整)。
- 日足以上の換算が複数単位に対応 (2D、2W、3M)。取引日数を時間足の倍率でバー数に換算します。
- 取引カレンダー設定を追加 (Auto、週5日、週7日)。Auto は暗号資産に週7日、その他に週5日を適用。祝日は考慮しません。
- MA長の下限を2本にし、50に固定されてしまう問題を防ぎます。
- バー確定後のアラート確認は任意設定 (デフォルトで有効)。線と色はリアルタイムで更新します。
- 中点の名称と説明を修正。50は乖離レンジの中点であり、価格がMAと一致することではありません。

免責事項

これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。