OPEN-SOURCE SCRIPT

Price Deviation from SMA/EMA with % Threshold Highlight

512
Select between SMA or EMA.

Adjustable length (default is 20).

Visual deviation band from price.

Plot of absolute deviation on a separate line.

Adding a threshold input. The threshold input is in percentage (%), e.g., 2.5 means 2.5% deviation. The deviation is compared to ma * (thresholdPercent / 100).

Highlights bars where the absolute deviation exceeds the percentage of the MA value.
Highlighting bars where the absolute deviation from the moving average exceeds the threshold.

If thresholdPct = 2.0 and the EMA is 100, then the deviation threshold is 2.0, and bars with absolute deviation > 2.0 will be highlighted.

You can set the threshold manually as a parameter.

The bars will be highlighted (colored) when deviation is outside the threshold range.

The threshold lets you define a "normal" deviation range. Any bars outside of this range are potential outliers — and are now visually flagged.

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.