Watch how to download trading robots for free
Find us on Twitter!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Indicators

Premium Discount OTE Zones - indicator for MetaTrader 5

Cristhian Alexander Gaibor Cuasquer
Cristhian Alexander Gaibor Cuasquer
  • Founder & Systems Engineer at  Xander Pro
  • Ecuador
  • 8543
4.7 (44)
Trader and MQL5 member since 2017.
Views:
20
Published:
MQL5 Freelance Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

Buying in the expensive half of a move is where a lot of Gold (XAUUSD) trades go wrong. This indicator takes the last confirmed swing high and swing low as the dealing range, splits it at 50 percent and shades the top half as premium and the bottom half as discount, the way ICT traders read it.

On top it marks the OTE band, 62 to 79 percent of the last leg. If the swing low came first the leg is up and the band sits in discount for buys. If the swing high came first it sits in premium for sells. A swing counts only when 5 bars on each side confirm it, so nothing moves on the forming candle. A second mode uses the highest high and lowest low of the last 100 closed bars.

It only marks where price sits inside the range. It does not say buy or sell. Use it as a filter next to your own entry, for example longs only from discount in an uptrend.

Premium Discount OTE Zones with the premium and discount boxes, the equilibrium line and the OTE band on a XAUUSD M15 chart in MetaTrader 5

Settings

  • How the range is found: last confirmed swing high and swing low (default) or highest and lowest of the last N closed bars.
  • Swing strength: bars on each side that confirm a swing. Default 5, allowed 1 to 50.
  • Closed bars for the lookback mode: default 100.
  • Bars the zones extend to the right: default 15.
  • Show the OTE band (on), OTE band start and end in percent of the leg (62 and 79), and its colour.
  • Show the 25 and 75 percent lines, Show text labels and Fill the boxes: all on by default. Premium, discount and equilibrium colours can be changed.
  • Alerts: popup, push and sound, all off by default. They fire once when a closed candle ends in the other half of the range than the candle before it.

What it needs

Any symbol and any timeframe. It draws with standard chart objects (rectangles, trend lines and text) and never trades. On the first run and on every new bar it recalculates from the history on the chart. Push notifications need your MetaQuotes ID in the terminal options. Wrong inputs stop it with a message in the log.

Make it yours

Run it on XAUUSD, XAGUSD, EURUSD, GBPUSD, US30 or NAS100 and compare M15, H1 and H4, and swing strength 3, 5 and 10. From an EA you can read it with iCustom: buffer 0 is the range high, buffer 1 the range low, buffer 2 the equilibrium and buffer 3 the zone of each bar (1 premium, -1 discount), buffers 4 and 5 the top and bottom of the OTE band. It fits next to Smart Money Concepts structure, order blocks or fair value gaps: take the setups that form in discount for buys and in premium for sells. XP_IsSwingHigh, XP_IsSwingLow and the drawing helpers are small functions you can lift into your own code.

About this code

Open source. Use it as it is, adapt it, build your own version on top of it. New versions and new tools are announced first on my MQL5 channel: https://www.mql5.com/en/channels/xander. Questions, suggestions and your own backtests are welcome in the Xander Lab group: https://www.mql5.com/en/messages/02eec85e4364dd01. More tools on my profile: https://www.mql5.com/en/users/09151993a. Provided as is, use at your own risk.

Related: Smart Money Concepts BOS CHoCH, Order Blocks Zones SMC, Fair Value Gap Zones Tracker, Liquidity Sweep Equal Highs Lows.

Changelog

v1.0 (2026-11-20): initial release.

Opening Range Breakout EA Gold Opening Range Breakout EA Gold

Opening range breakout EA for MT5 on Gold (XAUUSD), forex and indices: trades the first candle that closes outside the opening range, stop at the range, target in multiples of the stop, lot by risk, end of day close. Open source code.

Spectar Prop Challenge Dashboard Spectar Prop Challenge Dashboard

Read-only panel with the numbers a prop-style challenge is judged on: today's result from server midnight (closed plus floating), room to your daily loss limit, static or trailing overall floor, profit target and trading days.

Daily Loss and Profit Lock Daily Loss and Profit Lock

Daily loss limit EA for MT5 on prop firm and funded accounts, Gold (XAUUSD), forex and indices: closes every position at the daily loss or profit limit, deletes pending orders and locks trading until the next day. Open source code.

PDH PDL Sweep Levels PDH PDL Sweep Levels

Previous day high and low indicator for MT5 on Gold (XAUUSD), forex and indices: PDH, PDL, previous week high and low, day and week open, and an arrow when a closed candle sweeps a level and closes back inside. Open source code.