Pivot Trend Indicator for MT4 and MT5

Written by Dominic Walsh · Published · Last updated

The daily pivot says where price balanced yesterday; a 50-bar average says which way the trend leans. The pivot trend indicator draws both and calls a direction only when they agree: price above the pivot with a rising average, or below it with a falling one. A mark prints when the direction changes.

This build ships as a compiled .ex4 for MT4 and .ex5 for MT5; the screenshots below come from EURUSD H1.

Platforms MT4 (.ex4) + MT5 (.ex5)
Chart window Main price chart
Plots 5: PP, TrendEMA, TrendDir, BuyArrow, SellArrow
Alerts popup, push notification, email, sound
Inputs 9

Chart elements

Two lines and two marks on price.

`PP` steps in gold at width 2.

`TrendEMA` traces dodger blue at width 2.

`BuyArrow` prints lime at width 3.

`SellArrow` prints red at width 3.

`TrendDir` stores the state without drawing.

  • PP: line, gold, width 2
  • TrendEMA: line, dodger blue, width 2
  • TrendDir: hidden buffer
  • BuyArrow: arrow, lime, width 3, arrow code 233
  • SellArrow: arrow, red, width 3, arrow code 234
pivot trend indicator: Daily pivot and 50 EMA with direction marks, EURUSD H4.
Daily pivot and 50 EMA with direction marks, EURUSD H4.

How a value appears

Pivot

`InpPivotTF` `PERIOD_D1` supplies yesterday’s high, low and close. Their average is the gold PP line.

Trend line

`InpEmaPeriod` `50` gives the exponential average. `InpColorFlip` can two-colour it by direction.

Direction

Up needs the close above PP and a rising average. Down needs the close below PP and a falling average. A switch between them prints a mark.

How to read what it shows

Gold steps reset each day.

Price above gold with a rising line means up.

Price below gold with a falling line means down.

Mixed readings keep the last direction.

Marks show the change of direction.

Warm-up needs about fifty bars.

Alert channels in this build: popup, push notification, email and sound, one message per closed bar.

Direction changes report once per closed bar. `InpEnableAlerts` is the master switch; the popup and the sound playing `InpSoundFile` start on.

Every Pivot Trend Indicator input

Core settings

Setting What it does Default
InpEmaPeriod Trend EMA period. Trend average length, `50`. 50
InpPivotTF Pivot timeframe (D1 floor pivots). Pivot source timeframe, `PERIOD_D1`. PERIOD_D1

Display settings

Setting What it does Default
InpColorFlip Color-flip EMA on direction change. Two-colour the average, `true`. on

Alert settings

Setting What it does Default
InpEnableAlerts Master alerts switch. Master alert switch, `true`. on
InpEnablePopup Popup alert. Popup, `true`. on
InpEnablePush Push to mobile MetaTrader. Phone route, `false`. off
InpEnableEmail Email alert. Email route, `false`. off
InpEnableSound Sound alert. Sound, ships on, `true`. on
InpSoundFile Sound file. Sound clip, `”alert.wav”`. alert.wav
pivot trend indicator: Inputs panel, EMA length above the pivot source.
Inputs panel, EMA length above the pivot source.

Where it works best

Daily pivots with a 50-bar average suit hourly and four-hour charts; the screenshot shows EURUSD on H4. On H1 direction changes come every few days. On M15 switch the pivot source to D1 still.

When not to trust the output

Pivot and average can disagree for long spells.

Direction changes lag strong reversals.

Gaps at the daily open move the pivot abruptly.

The sound route ships on.

Copy the compiled Pivot Trend Indicator file into your MQL4/Indicators folder, and the MT5 build into MQL5/Indicators, then restart the terminal and drag it onto a chart. The step-by-step guide with screenshots is at how to install MT4 and MT5 indicators.

Background reading on the method behind the Pivot Trend Indicator: Pivot point (technical analysis) on Wikipedia, Exponential Moving Average at Investopedia.

Download the Pivot Trend Indicator for MT4 and MT5

The zip holds the compiled Pivot Trend Indicator build for MT4 and MT5, plus a short README. Compiled files only, no source. 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.

  • 1,380+ indicators
  • MT4 and MT5 files
  • No spam, unsubscribe any time

FAQ

What must agree for the pivot trend to turn up?

The close must sit above the daily pivot and the 50-bar average must be rising. Until both hold together, the previous direction stays in place and no new mark prints.

Why does the gold PP line step?

It is yesterday’s floor pivot, fixed for the whole day. When a new day starts, the line jumps to the new pivot and stays flat again.

What does InpColorFlip change?

It colours the 50-bar average by direction so you can read the current state at a glance. It does not change when the buy and sell marks appear.

Can InpPivotTF use weekly pivots?

Yes. Switch it to the weekly timeframe and the gold line comes from last week’s high, low and close. Direction then changes less often, which suits daily charts and longer swing trades.

Are results guaranteed?

No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Pivot Trend Indicator as one input. Always backtest before trading live.

Category: this is part of our Trend collection. Browse more Trend for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.

External references

Dominic Walsh - Forex trader and MT4/MT5 developer

About the author

Written by Dominic Walsh, a Forex trader and MT4/MT5 indicator, Expert Advisor and script developer. Every tool on forexmt4systems.com is tested on live charts before release and ships with ready-to-use compiled MT4 (.ex4) and MT5 (.ex5) files. Learn more about the trader and developer behind this site.

How we build, test and correct every tool: Editorial & Testing Policy. Trading carries risk; see the disclaimer.

Leave a Comment