Session Anchored Sigma Cone
A statistically sound "how far can price reasonably move by now" band has to widen with the square root of elapsed time, not linearly and not stay fixed - that is how a random walk's variance actually accumulates. Most "session range" indicators on this platform instead draw a static high/low box or a fixed-width channel, which is too tight in the first hour of a session and too loose by the close. This indicator re-anchors at the first bar of every session (configurable start hour, so it works for a UTC daily session, a specific market open, or any other recurring boundary), takes the anchor bar's open as the centre price, and estimates a per-bar volatility from the log returns of the bars immediately before the anchor - never from inside the session being forecast, which would be looking at the answer before drawing the question. The three band pairs then scale that per-bar sigma by the square root of bars elapsed since the anchor, so the cone visibly narrows near the open and widens through the session exactly the way a proper range forecast should. Every session in the visible history gets its own cone, computed independently, so a full chart shows the expected cascading fan pattern rather than one static box. Notes and limitations - The cone is a statistical range estimate from trailing volatility, not a prediction, support/resistance level, or trading signal on its own. - Session boundaries are detected by wall-clock hour crossing a day boundary shifted by InpSessionStartHour, which works cleanly on any chart period but assumes bars land in a normal sequence - a very large data gap (holiday, feed outage) can make one "session" span an unusual number of bars. - Volatility is estimated once per session at the anchor and held fixed for that session's whole cone; it does not adapt intra-session the way a rolling ATR band would. - The lognormal scaling (anchorPrice * exp(k*sigma*sqrt(n))) keeps both bands positive by construction, but on very high InpVolLookbackBars sigma or many elapsed bars the outer band can still widen further than is visually useful - shrink InpVolLookbackBars or the chart period if so.
Indicator · MT5 · v1.0 · Free
About Session Anchored Sigma Cone
Session Anchored Sigma Cone is an indicator for MetaTrader 5. It has 3 settings, such as Session start hour, Vol lookback bars and Min lookback bars. MQL source code included.
Files in the download: SessionSigmaCone.ex5, SessionSigmaCone.mq5, SessionSigmaCone.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Session start hour | 0 | Server-time hour (0-23) a new session anchors on |
| Vol lookback bars | 20 | Bars of log returns used to estimate per-bar sigma at each anchor |
| Min lookback bars | 5 | Minimum bars required before a session's cone is drawn at all |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Indicators.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the indicator from the Navigator onto a chart and adjust the settings.
Tags: Channels & Envelopes · Trading Sessions · MT5 Indicator · MQL5 Source Code