Gnomon Diurnal Cone
- Indicators
-
Syarief Azman Bin Rosli
Hello and welcome to my official MQL5 profile!
I am Syarief Azman Bin Rosli, an algorithmic trading systems developer and quantitative software engineer with over a decade of specialized experience creating robust automated trading solutions for MetaTrader 5 and MetaTrader 4. - Version: 1.0
- Activations: 5
Overview
Gnomon Diurnal Cone shows how far price normally travels from the day open by each time of day. For every intraday slot it takes the last N complete days and draws the median excursion above and below the open (core cone) and a chosen percentile (outer cone). Today's cone is fixed at the day open from completed days only, so it never repaints, and it is projected to the end of the day. A range budget compares today's range with the median full-day range, and two closed-bar signals flag unusual expansion and exhaustion. It is an indicator: it never opens, modifies or closes trades.
Quick Start
- Attach the indicator to an M15 chart (M1, M5, M15, M30 and H1 are supported).
- Keep the defaults first: Lookback Days 20, Outer Cone Percentile 80, Day Start Hour 0 (server midnight).
- The card badge must read READY and the gold core and blue outer lines must fan out from today's open. If it reads COLLECTING, scroll the chart back to load more history.
- Look at the last 30 days on the chart (Days to Display) to see how price behaved against its cone and where the arrows appeared.
- Enable Push Notification on Signal (MetaQuotes ID in Tools > Options > Notifications) or Popup Alert on Signal to be told when a signal closes.
How the cone is built
- A day runs from Day Start Hour (server time) to the same hour the next day. A slot is the bar's minutes since the day start divided by the timeframe.
- For each complete day the indicator records, at the end of every slot, the largest excursion above and below the day open reached so far. Slots without bars keep the last value.
- Valid days: of the last 2 x Lookback completed days, days with fewer than 50 % of the median bar count (Sunday sessions, holidays) are dropped, and the most recent Lookback Days remain. With fewer valid days no cone is drawn.
- Core cone = median of the excursions at each slot; outer cone = the Outer Cone Percentile (linear interpolation).
- Expected day range = median of those days' full-day ranges. Typical range by now = median of the range they had reached by the current slot.
- The cone uses completed days and the day open only, so values on closed bars never change.
Chart elements
- Gold lines (Core Cone Upper / Lower) and blue lines (Outer Cone Upper / Lower). The lines break at each day start.
- Grey dotted line: the day open.
- Stepped shading: one block per hour between the core lines, behind the candles, for the last N days; today's blocks reach the end of the day.
- Dotted continuation (forward projection): today's core and outer cone from the forming bar to the end of the day.
- CEILING and FLOOR dashed lines with labels: today's low + expected range and today's high - expected range, where the day would end if it reached a normal full range from its current extreme. They disappear once today's range reaches the expected range.
- Arrows 0.5 x ATR beyond the bar: green up arrow EXPANSION UP, red down arrow EXPANSION DOWN, violet hollow up arrow EXHAUSTION LOW, violet hollow down arrow EXHAUSTION HIGH.
Signals
Checked when a bar closes, at most one of each kind per side per day. Arrows never repaint.
- EXPANSION UP / EXPANSION DOWN: the bar closes above the upper outer cone (below the lower one) and today's range is already at least Expansion Min Budget % of the expected day range. The day is travelling further than usual for this time.
- EXHAUSTION HIGH / EXHAUSTION LOW: today's range is at least Exhaustion Threshold % of the expected day range, the bar makes a new day high (low) and closes at least Rejection Close % of its own range away from that extreme. The normal budget is spent and the new extreme was rejected.
- Signal Types: Expansion and exhaustion, Expansion only or Exhaustion only.
- Signals describe where price stands statistically; they are not trade recommendations.
Telemetry card
- Header: status LED (green READY, orange COLLECTING, red TF TOO HIGH or NO DATA) and title GNOMON DIURNAL CONE. <> moves the card to the next corner; [-] collapses it into a pill showing GNOMON, the pace and its regime; [+] expands it. Corner and collapsed state return to the inputs when the indicator reloads or the timeframe changes.
- Sub line: symbol, timeframe, slot of the forming bar (for example slot 52/96) and the status badge.
- SUNDIAL CLOCK: Day open; Day elapsed (share of the day's slots passed, grey meter); Typical done (share of the expected day range normally reached by this time, gold meter).
- RANGE BUDGET: Today range in pts (points); Expected (median full-day range); Budget used = today range / expected, meter 0-150 % with a white tick at 100 % (teal below 75 %, orange from 75 %, red from the Exhaustion Threshold); Pace = today range / typical range by now, with regime QUIET (below 0.75x), NORMAL (0.75-1.25x), HOT (1.25-1.75x) or EXTREME (1.75x and above).
- CONE POSITION: badge for the current price: ABOVE OUTER, UPPER STRETCH (between core and outer cone above), INSIDE CORE, LOWER STRETCH, BELOW OUTER; Core and Outer price ranges at the current slot.
- PROJECTION: Ceiling and Floor prices with the distance from price. Once today's range reaches the expected range they read BUDGET SPENT and over by N pts.
- LAST SIGNAL: newest signal with time and close price, or NO SIGNAL YET.
- On H4 and above the card shows TIMEFRAME TOO HIGH and "Use M1, M5, M15, M30 or H1"; with too little history it shows COLLECTING HISTORY n/N DAYS.
Alerts
Popup Alert on Signal, Sound Alert on Signal (alert.wav), Push Notification on Signal and Email on Signal (email settings in Tools > Options > Email) fire once when a signal appears on the bar that has just closed, also when Show Signal Arrows is off. History rebuilt on attach never alerts. Text: "Gnomon Diurnal Cone EURUSD M15: EXPANSION UP at 1.16945 (close beyond the P80 cone)".
Buffers for iCustom
0 Outer Cone Upper, 1 Core Cone Upper, 2 Core Cone Lower, 3 Outer Cone Lower, 4 Day Open (0-4 are EMPTY_VALUE on the first bar of each day), 5 Expansion Up, 6 Expansion Down, 7 Exhaustion Low (buy), 8 Exhaustion High (sell) (arrow price or EMPTY_VALUE), 9 Pace (x typical), 10 Budget Used %, 11 Expected Day Range. Use shift 1 for closed-bar values.
double up = iCustom(NULL, 0, "Market\\Gnomon Diurnal Cone", 5, 1);
if(up != EMPTY_VALUE) Print("EXPANSION UP on the last closed bar"); Side effects
Chart objects with the prefix GDC_ (card, shading, projection, ceiling and floor), all removed with the indicator. No files, no terminal global variables, no DLLs, no trading.
Inputs
- Day Start Hour (server time, 0-23), default 0: hour at which each day starts.
- Lookback Days (5-100), default 20: complete days in the statistics.
- Outer Cone Percentile (55-99), default 80.
- Days to Display (1-200), default 30: days drawn with lines and arrows.
- Show Outer Cone, Show Day Open Line, Show Forward Projection, Show Range Ceiling and Floor, Show Signal Arrows: default true. Hidden plots keep their buffer values.
- Shade Core for Last N Days (0 = off, max 10), default 3.
- Signal Types: Expansion and exhaustion (default), Expansion only, Exhaustion only.
- Expansion Min Budget (% of expected day range, 0-100), default 30: filters the noisy first minutes of the day.
- Exhaustion Threshold (% of expected day range, 10-500), default 100.
- Rejection Close (% of bar range from the extreme, 0-100), default 50; 0 accepts any close.
- ATR Period (arrow spacing), default 14.
- Core Cone Color, Outer Cone Color, Core Shading Color, Ceiling and Floor Color.
- Popup Alert on Signal, Sound Alert on Signal, Push Notification on Signal, Email on Signal: default false.
- Show Telemetry Card, default true. Card Corner: Top left (default), Top right, Bottom right, Bottom left. Start Collapsed, default false.
- Panel Scale (0.5-2.5), default 1.0; the layout also follows the screen DPI.
Out-of-range values stop the indicator with a message in the Experts log.
Typical setups
- Intraday forex (EURUSD, GBPUSD) on M15: defaults.
- Gold on brokers whose session opens at 01:00 server time: Day Start Hour 1, Outer Cone Percentile 85.
- Fading spent days: Signal Types Exhaustion only, Exhaustion Threshold 90, Rejection Close 60, Popup Alert on Signal true.
- Momentum days: Signal Types Expansion only, Expansion Min Budget 40, Outer Cone Percentile 85, Push Notification on Signal true.
- H1 context: Lookback Days 60, Days to Display 60, Shade Core for Last N Days 5.
Notes and limitations
- M1 to H1 only. The cone needs Lookback Days valid days of history; the Strategy Tester preloads about 1000 bars, so on M15 the default cone appears after about 10 trading days of testing.
- Server time is used; around daylight-saving changes the slots shift by one hour for a few days.
- Values on closed bars never repaint; the forming bar, projection, ceiling and floor update with each tick.
- The indicator describes typical ranges from past data. Past ranges do not guarantee future ones; it does not predict direction and gives no profit guarantee. Trading involves risk of loss.
