Flat Trend SMC Indicator: Break of Structure With a Flat State

Written by Dominic Walsh · Published · Last updated

Most structure tools force a binary choice: up or down. The flat trend smc indicator adds a third state. It tracks swing highs and lows, arrows the closes that break them, and then holds a trend read that can drop back to flat when price retraces far enough from the anchor. Sitting out is a position too.

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: SMC Bull Trend, SMC Bear Trend, SMC BOS Buy, SMC BOS Sell
Alerts popup, push notification, email, sound
Inputs 15

What the Flat Trend Smc Indicator draws on the chart

SMC Bull Trend plots a dodger blue line along the closes while the state reads bullish.

SMC Bear Trend plots a crimson line during a bearish state.

SMC BOS Buy and SMC BOS Sell mark the breaks with wide lime and red arrows.

Horizontal line objects mark each broken swing level, with text labels alongside them.

  • SMC Bull Trend: line, dodger blue, width 2
  • SMC Bear Trend: line, crimson, width 2
  • SMC BOS Buy: arrow, lime, width 3, arrow code 233
  • SMC BOS Sell: arrow, red, width 3, arrow code 234
Flat trend SMC indicator on EURUSD H1 with BOS arrows and broken swing levels
Flat trend SMC indicator on EURUSD H1 with BOS arrows and broken swing levels

How the Flat Trend Smc Indicator calculates its values

Keeping a rolling list of swings

center takes i + N, and iHighest and iLowest run over 2 * N + 1 bars to confirm the pivot at that centre. Each confirmed swing goes into g_SwingHighPrice or g_SwingLowPrice with its timestamp. When the list reaches `MaxSwingsToTrack` the code shifts every entry down and appends the new one, so it always holds the most recent sixty.

Refusing duplicates

Before it stores a swing the code walks the list comparing timestamps. When g_SwingHighTime[q] already matches time[center], dup turns true and the code skips that entry. Without the check, a repeated pass over the same bars would fill the list with copies of one pivot and crowd out genuine structure.

Breaking structure and losing the trend

cprice takes close[i], then FindBrokenSwingHigh looks for a stored level that close has cleared. A hit writes BuyArrowBuf and sets the state bullish with anchor_price at that close. The flat rule follows: while local_state reads plus 1, a close below anchor_price minus 30 points resets it to 0. That is what gives the tool its neutral state instead of holding a stale direction.

How to read the signals

A coloured line means the tool holds a directional read. No line means it has gone flat.

Arrows mark the break that started a state, and the horizontal levels show which swings price took out.

The flat reset uses a fixed 30 point retracement, so it triggers sooner on a quiet pair than a volatile one.

Sixty tracked swings covers a lot of history, so old levels stay eligible to be broken.

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

Four channels sit beneath `EnableAlerts`: popup, push notification, email and sound, with `SoundFile` naming the clip. Popup ships enabled. The guard permits one message per closed bar, and the break test reads a completed close.

Every Flat Trend Smc Indicator input

Core settings

Setting What it does Default
SwingLookback Swing lookback N (bars each side). Bars either side of a pivot, default `2`, giving a five-bar swing. 2
MaxSwingsToTrack Max swing highs/lows to remember. How many swing highs and lows stay in memory, default `60`. 60
MaxBosLevels Cap of BOS level lines on chart. Cap on the horizontal level lines drawn, default `30`, which keeps the chart readable. 30

Display settings

Setting What it does Default
ArrowOffsetPoints Arrow distance from bar high/low (points). Distance between candle and arrow, default `20.0` points. 20.0
DrawBosLevels Draw HLINE at broken swing levels. Set it `false` to keep the arrows and drop the horizontal lines. on
BosLevelBull (see inputs panel) dodger blue
BosLevelBear (see inputs panel) crimson
BosLevelWidth (see inputs panel) 1
BosLevelStyle Line style for the level lines, shipping as `STYLE_DOT` so they sit behind price visually. STYLE_DOT

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
Flat trend SMC indicator inputs: SwingLookback, MaxSwingsToTrack and MaxBosLevels
Flat trend SMC indicator inputs: SwingLookback, MaxSwingsToTrack and MaxBosLevels

Settings that fit your chart

Structure work suits instruments that move in clean legs. EURUSD H1 is the reference chart, where a five-bar swing catches intraday turns. On M1 those swings appear constantly and the sixty-swing list turns over within hours. Note the flat reset is a fixed point distance rather than an ATR multiple, so it behaves differently on gold than on a major pair.

When the Flat Trend Smc Indicator fails

The flat reset uses 30 points hard-coded rather than an input, so you cannot tune it to the instrument.

A five-bar swing is shallow, and in a range the tool breaks structure in both directions within a few bars.

The list keeps sixty swings, so very old levels stay in play, and a break of one from weeks ago may carry little meaning today.

Copy the compiled Flat Trend Smc 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.

Related on forexmt4systems.com: Trend Pullback Strategy.

Background reading on the method behind the Flat Trend Smc Indicator: Non-deliverable forward on Wikipedia, Market Indicator Dictionary at StockCharts ChartSchool.

Download the Flat Trend Smc Indicator for MT4 and MT5

The zip holds the compiled Flat Trend Smc 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 sends the trend state back to flat?

A retracement from the anchor. When a break sets the state bullish, anchor_price records that closing price. A later close below anchor_price minus 30 points returns local_state to 0, and the coloured line stops. The bearish side mirrors it. That third state is what separates this from a tool that always holds a direction.

Can I change the 30 point flat reset?

Not from the inputs panel. The code hard-codes that distance rather than exposing it, which is a real limitation: 30 points means something quite different on EURUSD than on gold or an index. If you trade instruments with very different tick sizes, expect the flat behaviour to differ between them.

What is MaxSwingsToTrack holding?

Up to sixty swing highs and sixty swing lows, each with its price and timestamp. When the list fills, the code shifts every entry down and appends the newest, so the oldest drops off. Any stored level can still trigger a break, which is why quite old structure sometimes produces an arrow.

Why does MaxSwingsToTrack need a duplicate check?

To keep copies out of the list. A recalculation can pass over the same bars more than once, and without the check the code would store the same pivot repeatedly. It compares g_SwingHighTime against time[center] and skips a match, so the sixty slots hold sixty distinct swings.

Are results guaranteed?

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