Color Trend Indicator: One Average, Two Colours Only

Written by Dominic Walsh · Published · Last updated

The color trend indicator does one thing well. It draws a single average and colours it by slope. Rising is lime green, falling is red, and the bar where that changes gets a mark. `MaKind` lets you pick between a simple and an exponential average.

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

What the Color trend Indicator draws on the chart

Trend Up is the lime green line drawn while the average rises.

Trend Down is the red line drawn while it falls.

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

Each mark sits two points from the candle, tight against the bar.

  • Trend Up: line, lime green, width 2
  • Trend Down: line, red, width 2
  • Buy Signal: arrow, lime, width 2, arrow code 233
  • Sell Signal: arrow, red, width 2, arrow code 234
Color trend indicator on EURUSD H1 with the two-colour average and slope marks
Color trend indicator on EURUSD H1 with the two-colour average and slope marks

How the Color trend Indicator calculates its values

Reading the average

iMA supplies the value at `MaPeriod` `50` using the method behind `MaKind` and the source in `AppliedPrice`. The code fetches three bars in all: the current one, the previous one, and the one before that.

Comparing two slopes

curr_rising compares the current value with the previous one. prev_rising compares the previous with the one before. A mark needs the two to disagree, which is exactly what a change of slope means.

Stitching the colours

Each buffer writes the previous bar value as well as the current one. Without that step the lime and red segments would leave a one-bar gap wherever the colour changed.

How to read the signals

Colour is the entire signal, and the mark just points at the change.

A 50-bar average changes slope far less often than price does.

Marks cluster when the average flattens, which is a range warning.

Switch `MaKind` to simple for a calmer line and fewer marks.

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

`EnableAlerts` starts on and `EnablePopup` carries the text. `EnablePushNotify`, `EnableEmail` and `EnableSound` begin false. `SoundFile` picks the clip. The slope test reads three completed bars, and the guard allows one message per bar.

Every Color trend Indicator input

Core settings

Setting What it does Default
MaPeriod MA period (length). Average length, default `50`. 50
MaKind MA method (SMA or EMA). Averaging method, exponential by default. Simple is the other choice. MA_KIND_EMA
AppliedPrice Applied price. Price the average reads, default PRICE_CLOSE. PRICE_CLOSE

Alert settings

Setting What it does Default
EnableAlerts Master switch for the colour flip alerts, default `true`. on
EnablePopup Terminal dialog on a colour flip, default `true`. on
EnablePushNotify Phone push on a colour flip, default `false`. off
EnableEmail Mail delivery on a colour flip, default `false`. off
EnableSound Sound playback on a colour flip, default `false`. off
SoundFile Wav clip for the colour alert, default `alert.wav`. alert.wav
Color trend indicator inputs: MaPeriod, MaKind, AppliedPrice
Color trend indicator inputs: MaPeriod, MaKind, AppliedPrice

Settings that fit your chart

A slope reading on a slow average suits swing timeframes. EURUSD H1 is the reference chart, where `MaPeriod` at `50` covers two days. On M5 the slope flips several times a session and the marks lose meaning. On H4 a colour stretch can last a fortnight.

When the Color trend Indicator fails

A 50-bar average turns long after price does, whichever method you pick.

In a flat market the slope crosses zero repeatedly and marks arrive in pairs.

Colour reports slope only. It says nothing about where price sits relative to the line.

Copy the compiled Color 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 Color trend Indicator: Chiang Mai Initiative on Wikipedia, Elliottwavetheory at Investopedia.

Download the Color trend Indicator for MT4 and MT5

The zip holds the compiled Color 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 does MaKind change about the line?

The weighting. An exponential setting gives the newest close the most influence and turns sooner. A simple setting weights every bar in the window equally, which gives a calmer line and noticeably fewer slope changes at the same `MaPeriod`.

Why does MaPeriod need three bars read?

Because a change of slope needs two slopes to compare. The current value against the previous gives one. The previous against the one before gives the other. A mark appears only when those two point different ways.

When does the Trend Up plot hand over?

Only the slope sign. Both plots carry the same average value, and the code writes it into the lime green buffer while rising and the red one while falling. It also backfills one bar so the segments join without a gap.

Should AppliedPrice stay on the close?

It is a sensible default and matches what most traders expect. Switching to a median or typical price brings the wicks in, which smooths the line a little. That usually cuts the mark count, since fewer small slope changes survive.

Are results guaranteed?

No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Color trend 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

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