ความผันผวน VolatilityFilterRegime มีใน Builder

Standard Deviation

Standard Deviation measures how widely price is scattered around its own moving average — the raw dispersion figure that Bollinger Bands are built from. On its own it is the cleanest way to ask whether a market is expanding or contracting, with no direction attached.

Template period
20
Direction
None
Units
Price
OverboughtOversoldCentreline 50Divergence

ภาพประกอบ — ข้อมูลสังเคราะห์ ไม่ใช่ราคาจริง

What Standard Deviation tells you

Standard Deviation answers how far, on average, price has been sitting from its own recent average. A rising value means the market is spreading out; a falling one means it is compressing. Like ATR it carries no direction — but unlike ATR it measures dispersion around a mean rather than distance travelled per bar.

  • Rising: price is spreading away from its mean
  • Falling: the market is compressing toward it
  • Zero direction — expansion looks identical up or down
  1. 1 Average the applied price over N bars
  2. 2 Measure each bar's distance from that average
  3. 3 Take the root mean square of those distances
แสดงสูตรและรายละเอียดการคำนวณ

Standard Deviation is the textbook dispersion statistic, computed on a rolling window:

  1. Compute a moving average of the applied price over the period, using the chosen method.
  2. For each bar in the window, take the difference between its price and that average, and square it.
  3. Average the squared differences and take the square root: σ = √( Σ(Pᵢ − MA)² / N ).

Squaring in step 2 is what makes the result directionless — a price 10 points above the average and one 10 points below contribute identically. It also means large excursions dominate: doubling a single bar’s distance quadruples its contribution, so the reading responds sharply to one outsized bar and then decays as that bar leaves the window.

The output shares the instrument’s price units, which is both useful and limiting. Useful, because the number is directly comparable to a distance on the same chart. Limiting, because a threshold written for one symbol means nothing on another — which is why rules are almost always written as one deviation against another rather than against a fixed number.

In MQL5 the call is iStdDev(symbol, period, ma_period, ma_shift, ma_method, applied_price) and it returns a handle to a single buffer. Both ma_method and applied_price are real arguments, so the average the dispersion is measured around is as configurable as a standalone moving average.

สัญญาณ

สัญญาณที่ backtest ได้ของ StdDev — และสภาวะตลาดที่เหมาะสมกับแต่ละสัญญาณ

Contraction

พร้อมใช้ใน Builder
เงื่อนไข
A short-window deviation falls below a longer one
สภาวะที่ดีที่สุด
Ranging / pre-breakout
การใช้งานทั่วไป
Permit mean-reversion, or wait for expansion

Expansion

พร้อมใช้ใน Builder
เงื่อนไข
A short-window deviation rises above a longer one
สภาวะที่ดีที่สุด
Breakouts
การใช้งานทั่วไป
Confirm a move is spreading rather than drifting

Regime Comparison

ตรรกะขั้นสูง
เงื่อนไข
Current deviation against its own recent range
สภาวะที่ดีที่สุด
Any
การใช้งานทั่วไป
Switch strategy behaviour between calm and violent regimes

Band Width Proxy

พร้อมใช้ใน Builder
เงื่อนไข
Deviation used in place of a Bollinger width calculation
สภาวะที่ดีที่สุด
Any
การใช้งานทั่วไป
Express a squeeze rule that iBands cannot supply directly

การทำงานจริงใน MT5

สิ่งที่ MetaTrader 5 คำนวณและวาดจริง — เกณฑ์อ้างอิงของทุกกฎในหน้านี้

บัฟเฟอร์

ดัชนี บัฟเฟอร์ MT5 วาดเป็น เก็บค่าอะไร
0 MAIN_LINE Line The standard deviation of the applied price around its own moving average, in price units. Always positive; it has no zero line and no upper bound.

ข้อสังเกตของแพลตฟอร์ม

ทำงานได้ดีที่สุด / ใช้อย่างระมัดระวัง

ไม่มีอินดิเคเตอร์ใดที่ได้เปรียบในทุกสภาวะ นี่คือจุดที่ StdDev ช่วยได้ — และจุดที่มันทำให้เข้าใจผิด

ทำงานได้ดีที่สุด

  • As a volatility filter
  • Expressing squeeze rules
  • Comparing regimes on one instrument
  • Alongside a directional signal

ใช้อย่างระมัดระวัง

  • As a directional signal
  • Comparing raw values across instruments
  • Fixed price thresholds
  • Very short periods on low timeframes

สร้างกลยุทธ์ StdDev

เชื่อมสัญญาณเข้ากับกฎการเปิดและปิดออเดอร์ จากนั้นส่งออก EA MT5 ที่คอมไพล์ได้ — ไม่ต้องเขียนโค้ด

  1. Fast StdDev (10)
  2. Slow StdDev (40)
  3. Fast below slow — a quiet market
  4. MFI below 20 in a quiet market → Open Buy · SL 40 / TP 80
  5. MFI above 80 in a quiet market → Open Sell

รวม StdDev กับอินดิเคเตอร์อื่น

อินดิเคเตอร์เดี่ยวแทบไม่เพียงพอ การจับคู่เหล่านี้ครอบคลุมจุดบอดของ StdDev

StdDev + MFI

  1. Fast StdDev below slow
  2. MFI below 20
  3. Buy
เหตุผล
Let dispersion decide whether mean reversion is allowed, and let the flow oscillator decide the direction of the fade
สภาวะที่ดีที่สุด
Ranging
สร้างกลยุทธ์นี้ →

StdDev + Bollinger Bands

  1. StdDev at a local low
  2. Price at a band
  3. Wait for expansion
เหตุผล
Supply the band-width reading iBands does not publish, so a squeeze rule can be written without computing upper minus lower
สภาวะที่ดีที่สุด
Pre-breakout

No single-flow template pairs Standard Deviation with Bollinger Bands. Start from Bollinger Bounce and add StdDev nodes with a Compare between a fast and a slow period.

เปิด Builder →

StdDev + Moving Average

  1. Fast StdDev above slow
  2. Fast MA crosses slow
  3. Buy
เหตุผล
Take direction from the trend and permission from dispersion, so a crossover only fires when the market is actually moving
สภาวะที่ดีที่สุด
Trending

No single-flow template pairs Standard Deviation with a moving average. Start from MA Crossover and add StdDev nodes with a Compare.

เปิด Builder →

พารามิเตอร์

ค่าเริ่มต้นสำหรับตรวจสอบบนคู่และกรอบเวลาของคุณเอง — ไม่ใช่การตั้งค่าที่รับประกัน

พารามิเตอร์ ค่าเริ่มต้น ช่วงที่แนะนำให้ทดสอบ หน้าที่
Period 20 10–50 Window for both the moving average and the dispersion measured around it. The template uses 10 and 40 as a fast/slow pair rather than a single value.
Method SMA SMA / EMA / SMMA / LWMA How the underlying average is weighted. Changing it changes what the deviation is measured around, so it changes the output even at the same period.
Applied price Close Close / Open / High / Low / Median / Typical / Weighted Price series the dispersion is computed on. iStdDev accepts any ENUM_APPLIED_PRICE value.
Shift 0 0–3 Which bar back the value is read from. Shift 1 compares against a fully closed bar.

ค่าตั้งต้นเริ่มต้น

Reactive 10 Responds within the session
Standard 20 Matches the Bollinger default window
Regime 40 Describes the week, not the bar

ตัวอย่างในตลาด

ที่ StdDev ทำงานได้ ที่มันล้มเหลว และตัวกรองเปลี่ยนผลลัพธ์อย่างไร

ทำงานได้

Contraction permits the fade

The short-window deviation falls under the long one, the market is genuinely quiet, and a mean-reversion entry works as intended.

ล้มเหลว

Fading into an expansion

The same oscillator extreme appears while dispersion is climbing. Price is spreading away from its mean, and the fade is standing in front of it.

ถูกกรอง

Dispersion filter suppresses the trade

The directional signal fires but the fast deviation sits above the slow one, so the entry is skipped and the move continues without you.

FAQ

Standard Deviation or ATR?
They are different measurements that often agree. ATR averages the distance price travelled per bar and includes gaps; Standard Deviation measures how scattered prices are around their own average and ignores gaps entirely. Use ATR when you care about how much room a trade needs, and Standard Deviation when you care about whether the market is spreading out or compressing.
Is this the same σ that Bollinger Bands use?
Yes. Bollinger's outer bands are the middle band plus and minus a multiple of exactly this quantity, computed over the same window on the same applied price. That is why Standard Deviation is the practical way to write a squeeze rule — iBands publishes the three lines but not the width between them.
Why is there no zero line?
Because dispersion cannot be negative — the calculation squares each distance before averaging. The indicator is always at or above zero and has no upper bound, so rules are written as comparisons between two deviations or against the indicator's own recent range, never against a fixed centre.
What period should I use?
20 matches the Bollinger default and is a sensible single-value starting point. In practice a fast/slow pair is more useful than any single number, because it removes the need for an instrument-specific threshold — the template uses 10 against 40 for exactly that reason.
Can I build a Standard Deviation EA without coding?
Yes, as a filter. The MFI + Standard Deviation template uses two StdDev nodes with different periods and a Compare between them to require a quiet market, with period, method and applied price exposed as EA inputs. Classifying volatility against its own long-run distribution is the exception and needs custom MQL5.
How should I validate settings before going live?
Backtest on quality tick data first, then run the EA on a demo account before risking money. When optimising, hold back data the search never saw and prefer settings that stay profitable across periods over the single in-sample peak — chasing that peak is overfitting the noise. No default or preset here is a performance promise; every value is a starting point to re-validate on your own pair and broker.