The Instantaneous Trend Line Indicator ports the Ehlers ITrend recursion to MetaTrader. It smooths median price with a three-tap filter and a two-tap feedback term. A faster Trigger line then comes off that result. Crossings between the two print Buy and Sell arrows, which suits traders who dislike moving average lag.
This build ships as instantaneous-trend-line-indicator-indicator-forexmt4systems.ex4 for MT4 and instantaneous-trend-line-indicator-indicator-forexmt4systems.ex5 for MT5; the screenshots below come from EURUSD H1.
| Platforms | MT4 (.ex4) + MT5 (.ex5) |
|---|---|
| Chart window | Main price chart |
| Plots | 4: ITrend, Trigger, Buy, Sell |
| Alerts | popup, push notification, email, sound |
| Inputs | 9 |
What the Instantaneous Trend Line Indicator draws on the chart
Two lines and two arrow buffers make up the display. ITrend draws in dodger blue and holds the smoothed value. Trigger draws thinner in orange and sits ahead of it. Both run on the price chart, so you read them against the candles.
Buy prints a lime up arrow when Trigger crosses above ITrend on a bar. Sell prints a red down arrow on the opposite cross. Each marker sits twelve points away from the bar low or high, a distance ArrowOffsetPts controls.
Nothing else lands on the chart. The build creates no rectangles, labels or panels, which keeps a busy scalping screen readable.
- ITrend: line, dodger blue, width 2
- Trigger: line, orange, width 1
- Buy: arrow, lime, width 2, arrow code 233
- Sell: arrow, red, width 2, arrow code 234

How the Instantaneous Trend Line Indicator calculates its values
The Ehlers recursion
Alpha drives everything. From it the code derives five coefficients before the loop starts, so the per-bar cost stays tiny. Each new ITrend value mixes the last three median prices with the previous two ITrend values. The default Alpha of 0.05 gives the slower variant Ehlers describes.
Median price and the Trigger line
Price choice comes first. UseMedianPrice ships on, so each bar feeds the filter with the midpoint of its high and low. Turn it off and the filter reads closes instead.
Trigger then doubles the current ITrend value and subtracts the reading from two bars back. That shift pulls it ahead of the smoothed line. A cross between the pair marks the moment the slope changes hands.
Warmup and signal timing
The oldest bars get a short average instead. For the first seven bars of history the code seeds both buffers with a small mean, then hands over to the recursion. Arrows only appear once enough history exists behind the bar. The newest candle recalculates on every tick, so a fresh mark there can still vanish before that bar closes.
How to read the signals
Slope tells you the state. A rising ITrend line with price above it says buyers hold control. A falling line with price below says the opposite. Flat stretches mean the filter found no direction, and marks there tend to be noise.
Arrows mark the cross itself. Trigger above ITrend flags upward momentum, Trigger below flags downward. Many traders take the mark as a heads-up and wait for the next close to confirm.
Use the line as a trailing reference. Once a move runs, ITrend follows behind price and gives a level to lean on. A close through it often ends the leg.
Alert channels in this build: popup, push notification, email and sound, one message per closed bar.
EnableAlerts turns the messages on, and popup, push notification, email and sound sit behind separate switches. The dispatcher looks at the last closed bar and sends one message per bar, never on every tick.
Every Instantaneous Trend Line Indicator input
Core settings
| Setting | What it does | Default |
|---|---|---|
Alpha |
Ehlers ITrend smoothing constant. Sets the smoothing constant at 0.05, the slower Ehlers variant; larger values react faster and whipsaw more. | 0.05 |
UseMedianPrice |
true = (H+L)/2, false = close. Feeds the filter the midpoint of high and low when on, or the close when off. | on |
Display settings
| Setting | What it does | Default |
|---|---|---|
ArrowOffsetPts |
arrow offset in points. Moves each marker twelve points clear of the bar so the candle stays readable. | 12 |
Alert settings
| Setting | What it does | Default |
|---|---|---|
EnableAlerts |
(see inputs panel) | on |
EnablePopup |
(see inputs panel) | on |
EnablePushNotify |
(see inputs panel) | off |
EnableEmail |
(see inputs panel) | off |
EnableSound |
(see inputs panel) | off |
SoundFile |
(see inputs panel) | alert.wav |

Settings that fit your chart
Smoothed trend filters suit instruments that trend in clean legs. The screenshots come from EURUSD H1, a chart where the slow setting has room to work. Majors and gold behave well, while thin crosses with wide spreads do not. On M1 and M5 the line still tracks price, yet the cross count rises sharply. H4 and D1 give the calmest read, at the cost of few signals per month.
When the Instantaneous Trend Line Indicator fails
Ranges punish crossover logic. Trigger and ITrend sit almost on top of each other in a flat market, so Buy and Sell marks alternate bar after bar.
The rightmost candle stays live. Values there recalculate on every tick, and a mark can appear then disappear before the close. Let the bar finish, or lean on the alert, which reads the last closed bar only.
Smoothing costs time. A three-tap filter with feedback still lags a sharp reversal, and gap opens leave the line behind price for several bars.
One tool, one view. The build carries no filter of its own beyond the line, so pairing it with structure or a higher chart read helps.
Copy instantaneous-trend-line-indicator-indicator-forexmt4systems.ex4 into MQL4/Indicators and instantaneous-trend-line-indicator-indicator-forexmt4systems.ex5 into MQL5/Indicators, then restart the terminal and drag the Instantaneous Trend Line Indicator onto a chart. The step-by-step guide with screenshots is at how to install MT4 and MT5 indicators.
Download the Instantaneous Trend Line Indicator for MT4 and MT5
The zip instantaneous-trend-line-indicator-indicator-forexmt4systems.zip holds instantaneous-trend-line-indicator-indicator-forexmt4systems.ex4, instantaneous-trend-line-indicator-indicator-forexmt4systems.ex5 and a short README, compiled files only. Enter your email below and the download link arrives in your inbox.
Download this indicator free
Enter your email and the file is yours. You also get the full MT4 and MT5 library.
FAQ
What does the Alpha setting change on the ITrend line?
Alpha acts as the smoothing constant inside the Ehlers recursion. At the shipped value the line moves slowly and ignores most single-bar noise. Push it higher and the filter tracks price more closely, which brings the crosses forward but adds false ones. Most traders leave it alone and change the chart period instead.
Does a Buy arrow stay put once the candle closes?
Yes for closed candles. The tool recomputes the newest bar on every tick, so a mark on the rightmost candle can still disappear. Once that bar closes the value freezes and the marker holds. Alerts read the last closed bar, which is why they never fire twice for one cross.
Why does UseMedianPrice default to the high-low midpoint?
Ehlers applied the recursion to median price in his original write-up, and this port keeps that choice. The midpoint smooths intrabar noise before the filter even starts. Switching it off feeds closes instead, which reacts a touch faster on gappy instruments. Both settings share the same coefficients.
How does the Trigger line get ahead of ITrend?
Trigger doubles the current ITrend value, then subtracts the value from two bars back. That projection extends the recent slope forward by one step. The result leads the smoothed line during a move and cuts through it when the slope turns. Nothing about it looks into future bars.
Are results guaranteed?
No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Instantaneous Trend Line Indicator as one input. Always backtest before trading live.
Category: this is part of our Trend collection. Also, truly, browse more Trend for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.
External references
- For background on this concept, see Advance Decline Line at StockCharts ChartSchool.
- For broader market context, see Debt buyer on Wikipedia.
