Loading…

Overnight Gap Risk Gauge

A stop-loss protects you from an intraday move. It does nothing for a gap that opens beyond it while the market was closed to you. This indicator quantifies how much of that unprotected risk exists for the current symbol by decomposing every trading day's total return into two pieces - the overnight gap (today's Open against yesterday's Close) and the intraday move (today's Close against today's Open) - and plotting the rolling standard deviation of each over InpLookbackDays, in the same percent units, side by side. The gauge always reads from PERIOD_D1 regardless of the chart it is attached to, because "overnight" is a daily-bar concept - measuring a gap on an M15 chart would just be comparing consecutive 15-minute bars, not the actual close-to-open jump that carries the real risk. Each chart bar's reading is looked up from the daily window ending at that bar's own trading day, so scrolling back through history shows the gauge exactly as it read at that point - not a value recomputed with hindsight. Only fully completed trading days feed the rolling window; the still-forming "today" bar is deliberately excluded so a given day's reading stays fixed all day rather than drifting as that day's own bar develops, which keeps the indicator non-repainting. Notes and limitations - Requires enough D1 history loaded for the symbol (roughly InpLookbackDays + 1 daily bars); on a freshly opened chart or a rarely- traded symbol the lines can stay blank until that history downloads. - Symbols with no real overnight session (continuously traded instruments such as some crypto CFDs) will still compute a number from the broker's own daily bar boundary, but that boundary may not correspond to any actual closed-market gap - read the result with that in mind. - This measures the split of historical volatility, not direction; it does not say whether recent gaps have been up or down, only how large they have been. - Does not place trades or stops. It is a risk-awareness reference only.

Indicator · MT5 · v1.0 · Free

About Overnight Gap Risk Gauge

Overnight Gap Risk Gauge is an indicator for MetaTrader 5. It has 1 setting, such as Lookback days. MQL source code included.

Files in the download: OvernightGapRiskGauge.ex5, OvernightGapRiskGauge.mq5, OvernightGapRiskGauge.txt.

Settings

SettingDefaultWhat it does
Lookback days30Fully completed trading days used to build each rolling reading

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Indicators.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the indicator from the Navigator onto a chart and adjust the settings.

Download the PDF guide

Tags: MT5 Indicator · MQL5 Source Code

MetaTrader 4 & 5 indicators · PolyMaria