Alpha Trend Spotter Indicator: Slope Over Three Bars

Written by Dominic Walsh · Published · Last updated

The alpha trend spotter indicator judges direction over a span rather than one bar. It compares a 50-bar exponential average against its own reading `InpSlopeLookback` bars earlier. That short span stops the colour flickering every time the average wobbles.

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 4: Spotter Up, Spotter Down, Buy, Sell
Alerts popup, push notification, email, sound
Inputs 9

What the Alpha Trend Spotter Indicator draws on the chart

Spotter Up is the aqua line, drawn while the slope points up.

Spotter Down is the magenta line for the other direction.

Buy and Sell mark the bar where the slope changed sign.

The code stitches one bar of the old segment, so the colours join.

  • Spotter Up: line, aqua, width 3
  • Spotter Down: line, magenta, width 3
  • Buy: arrow, aqua, width 3, arrow code 233
  • Sell: arrow, magenta, width 3, arrow code 234
Alpha trend spotter indicator on EURUSD H1 with the slope-coloured average and flip marks
Alpha trend spotter indicator on EURUSD H1 with the slope-coloured average and flip marks

How the Alpha Trend Spotter Indicator calculates its values

Reading the average twice

iMA supplies an exponential average at `InpMaPeriod` `50`. maPrev reads the same average `InpSlopeLookback` `3` bars back. Comparing across three bars smooths out the tiny changes a one-bar test would react to.

Carrying the direction

DirBuf holds the current direction. When the two readings sit level, the previous direction carries forward. That avoids a neutral state, which would leave gaps in the coloured line.

Marking the flip

pdir holds the previous bar direction. A mark appears only when dir and pdir disagree. off takes `InpArrowOffset` `40` times Point. That keeps the mark clear of the average line.

How to read the signals

Colour is the direction reading. The mark points at the change.

A three-bar slope span makes flips less frequent than a one-bar test.

Long single-colour stretches mean the average has been travelling steadily.

Raise `InpSlopeLookback` for an even calmer reading.

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

`EnableAlerts` arrives switched on and `EnablePopup` does the talking. `EnablePushNotify`, `EnableEmail` and `EnableSound` all begin false. `SoundFile` picks the clip. The flip test reads completed bars, one message per closed bar.

Every Alpha Trend Spotter Indicator input

Core settings

Setting What it does Default
InpMaPeriod EMA period. Average length, default `50`. 50
InpSlopeLookback Slope lookback (bars). Bars back the slope compares against, default `3`. 3

Display settings

Setting What it does Default
InpArrowOffset Arrow offset (points). Mark distance from the bar in points, default `40`. 40

Alert settings

Setting What it does Default
EnableAlerts Master switch for the direction flip alerts, default `true`. on
EnablePopup Terminal dialog on a direction flip, default `true`. on
EnablePushNotify Phone push on a direction flip, default `false`. off
EnableEmail Mail delivery on a direction flip, default `false`. off
EnableSound Sound playback on a direction flip, default `false`. off
SoundFile Wav clip for the flip alert, default `alert.wav`. alert.wav
Alpha trend spotter indicator inputs: InpMaPeriod, InpSlopeLookback, InpArrowOffset
Alpha trend spotter indicator inputs: InpMaPeriod, InpSlopeLookback, InpArrowOffset

Settings that fit your chart

A slow average with a multi-bar slope span suits swing timeframes. EURUSD H1 is the reference chart, where `InpMaPeriod` at `50` covers two days. On M5 the average still turns often, so flips cluster. On H4 a single colour can hold for weeks.

When the Alpha Trend Spotter Indicator fails

A 50-bar average turns long after price does. The slope span adds three more bars.

Carrying the old direction through a level reading means the line never admits doubt.

In a flat market the flips still arrive, just later than a one-bar test gives.

Copy the compiled Alpha Trend Spotter 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 Alpha Trend Spotter Indicator: Jensen’s alpha on Wikipedia, Moving Momentum at StockCharts ChartSchool.

Download the Alpha Trend Spotter Indicator for MT4 and MT5

The zip holds the compiled Alpha Trend Spotter 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 does InpSlopeLookback at 3 change?

The span the slope is measured over. Comparing the average against its reading three bars back ignores the tiny changes a one-bar comparison would react to. Raise it further for an even calmer reading and later flips.

Why does InpSlopeLookback never report neutral?

Because a neutral state would break the coloured line into fragments. DirBuf keeps the previous direction until the comparison actually reverses. The cost is that the line never shows doubt, even when there is some.

When does the Spotter Up line hand over?

The moment the slope turns down. Both plots carry the same average value, and the aqua buffer takes it while the slope points up. The code backfills one bar at each flip, so the two segments join cleanly.

Is InpArrowOffset at 40 too wide on EURUSD?

Four pips on a five-digit feed is generous, and that is on purpose. The average line often sits close to price. A tighter mark would overlap it. Lower it on a chart with nothing else drawn.

Are results guaranteed?

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

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