Gold XAUUSD M1 and M5 Scalping Indicator: 3/8 EMA With ATR Slope

Written by Dominic Walsh · Published · Last updated

This gold xauusd m1 and m5 scalping indicator runs a very short EMA pair and adds a size test. Crossing a 3 period average over an 8 period one happens often on gold, so the code demands that the bar which crossed also moved further than a fraction of ATR. Small crosses inside a drifting range never make it onto the chart.

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

Platforms MT4 (.ex4) + MT5 (.ex5)
Chart window Main price chart
Plots 4: EMA Fast, EMA Slow, BUY, SELL
Alerts popup
Inputs 5

What the Gold Xauusd M1 And M5 Scalping Indicator draws on the chart

EMA Fast appears in aqua, EMA Slow in orange, both drawn thin enough to sit under fast candles.

BUY marks a lime arrow below the qualifying bar.

SELL marks a red arrow above it.

Arrow placement uses a fixed 20 point gap written into the code rather than an input.

  • EMA Fast: line, aqua, width 2
  • EMA Slow: line, orange, width 2
  • BUY: arrow, lime, width 2, arrow code 233
  • SELL: arrow, red, width 2, arrow code 234
Gold XAUUSD M1 and M5 scalping indicator on XAUUSD M5 with ATR-filtered cross arrows
Gold XAUUSD M1 and M5 scalping indicator on XAUUSD M5 with ATR-filtered cross arrows

How the Gold Xauusd M1 And M5 Scalping Indicator calculates its values

A deliberately short average pair

emaF comes from iMA over `InpFastPeriod`, which defaults to `3`, and emaS from `InpSlowPeriod` at `8`. Three bars is barely smoothing at all. On M1 gold that is intentional, because anything longer arrives after the move a scalper wanted. Both values are read again one bar back for the cross comparison.

Measuring the move against ATR

This is what separates the tool from a plain cross. slopeUp evaluates close[i] – close[i + 1] – `InpAtrMult` * atr, with atr taken over `InpAtrPeriod` bars. The expression only turns positive when the bar-to-bar move exceeds half an average range at the default `0.5`. slopeDown mirrors it. A cross without that push behind it produces nothing.

Combining the two tests

crossUp requires emaF_prev at or below emaS_prev, emaF now above emaS, and slopeUp above 0.0. All three sit in one condition, so failing any part means no arrow. warmup takes MathMax(InpSlowPeriod, InpAtrPeriod) + 2, which keeps the calculation clear of bars where the ATR has not settled.

How to read the signals

Every arrow carries a size floor: the bar that produced it moved more than half an ATR.

Quiet stretches produce no arrows even when the averages cross, which is the filter doing its job.

The two averages sit very close together, so read the arrows rather than trying to judge the cross by eye.

A cluster of arrows in one direction usually means the ATR baseline has not caught up with a new pace.

Alert channels in this build: popup, one message per closed bar.

A terminal popup covers notification, set by `InpEnableAlerts` which ships `true` and whose source comment names bar-close alerts specifically. Nothing fires while a candle is still forming, which matters on M1 where a bar can cross and uncross within seconds.

Every Gold Xauusd M1 And M5 Scalping Indicator input

Core settings

Setting What it does Default
InpFastPeriod Fast EMA period. Fast EMA length, default `3`. Raising it to 5 removes many marginal crosses. 3
InpSlowPeriod Slow EMA period. Slow EMA length, default `8`. 8
InpAtrPeriod ATR period. Bars in the volatility measure, default `7`. Short by design, so the filter tracks the current pace rather than the day’s. 7
InpAtrMult ATR multiplier for slope filter. How much of an ATR the bar must cover, default `0.5`. This is the main dial for signal frequency. 0.5

Alert settings

Setting What it does Default
InpEnableAlerts Enable bar-close alerts. on
Gold XAUUSD M1 and M5 scalping indicator inputs: InpFastPeriod, InpAtrPeriod, InpAtrMult
Gold XAUUSD M1 and M5 scalping indicator inputs: InpFastPeriod, InpAtrPeriod, InpAtrMult

Settings that fit your chart

The name says M1 and M5, and the reference capture uses XAUUSD on M5. A 3 and 8 pair on those timeframes suits gold’s habit of moving in short bursts. Applying the same settings to H1 leaves the averages too fast to mean much, and the ATR filter then passes almost everything. On a calm forex pair the filter blocks nearly every cross instead.

When the Gold Xauusd M1 And M5 Scalping Indicator fails

A 7-bar ATR adapts quickly, so after a burst of movement the baseline rises and the filter starts rejecting moves it would have accepted minutes earlier.

M1 gold carries a spread that can rival half an ATR, so a signal that passes the size test may still be unprofitable after costs.

Very short averages cross back and forth around a flat market. The filter suppresses most of that, though a single wide bar in a range still slips through.

Copy the compiled Gold Xauusd M1 And M5 Scalping 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.

Download the Gold Xauusd M1 And M5 Scalping Indicator for MT4 and MT5

The zip holds the compiled Gold Xauusd M1 And M5 Scalping 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 InpAtrMult at 0.5 require?

That the bar producing the cross moved more than half of the current average true range from the previous close. The code builds slopeUp as close[i] minus close[i + 1] minus `InpAtrMult` times atr, and only a positive result passes. Lower it to 0.3 for more signals, or raise it toward 1.0 to demand a genuinely large bar.

Why is InpAtrPeriod only 7 bars?

So the volatility baseline reflects the last few minutes rather than the whole session. On M1 and M5 gold the pace changes quickly, and a 14 or 20 bar ATR would still be describing conditions from half an hour ago. The short window keeps the size filter honest about what counts as a big move right now.

How does this differ from a plain 3 over 8 EMA cross?

The size test. A plain cross fires on every crossing, including ones inside a two pip drift. Here crossUp bundles three conditions together: the previous bar’s ordering, the current ordering, and slopeUp above zero. Failing the size test means no arrow, however clean the cross looks.

Can I run it on XAUUSD H1?

You can, but the tuning fights you. `InpFastPeriod` at `3` and `InpSlowPeriod` at `8` are built for M1 and M5, and on H1 they cross constantly relative to the timeframe’s own rhythm. The ATR filter also loosens, since most H1 gold bars clear half an ATR. Lengthen both averages before trying it.

Are results guaranteed?

No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Gold Xauusd M1 And M5 Scalping Indicator as one input. Always backtest before trading live.

Category: this is part of our Signal and Forecast collection. Also, still, hence, plainly, truly, browse more Signal and Forecast 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