The gold scalper indicator asks two independent things to agree. An 8 period EMA has to cross a 21 period EMA, and the stochastic oscillator has to be leaving an extreme at the same time. Gold moves fast enough that either condition alone fires constantly, so pairing them cuts the noise down to something a scalper can actually watch.
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 | 8 |
What the Gold scalper Indicator draws on the chart
EMA Fast runs in dodger blue, EMA Slow in orange red, so the cross is visible without reading the arrows.
Buy places a wide lime arrow beneath the bar where both conditions hold.
Sell places the red counterpart above the bar.
Both arrows draw at width 3, which keeps them readable on a busy M5 gold chart.
- EMA Fast: line, dodger blue, width 2
- EMA Slow: line, orange red, width 2
- Buy: arrow, lime, width 3, arrow code 233
- Sell: arrow, red, width 3, arrow code 234

How the Gold scalper Indicator calculates its values
The moving average leg
Two iMA calls on the close supply emaFast over `InpFastPeriod` and emaSlow over `InpSlowPeriod`. The same pair is read one bar back as emaFastPrev and emaSlowPrev. emaCrossUp then requires the fast average to have been at or below the slow one and to have moved above it. That comparison across two bars is what makes it a cross rather than a state.
The stochastic leg
iStochastic supplies stochMain using `InpStochKPeriod`, `InpStochDPeriod` and `InpStochSlow`. stochCrossUp requires the previous reading at or below `InpStochLevel` with the current one above it, so the oscillator is leaving oversold rather than merely sitting there. The sell side tests against 100.0 minus that level, keeping one input for both ends.
Allowing the stochastic a one-bar head start
Two conditions landing on exactly the same candle is demanding. The code softens this on the sell side by reading sM2, the stochastic two bars back. When sM2 sat at or above the overbought line and stochMain has since dropped below it, stochDownRecent turns true even though the crossing happened a bar earlier. buySignal and sellSignal then need their EMA cross and their stochastic condition together.
How to read the signals
The arrow is the agreement. Either leg on its own leaves the chart quiet.
Watch the EMA separation after a signal. A cross that immediately narrows again rarely leads anywhere.
Because the stochastic gets a one-bar allowance on the sell side, some sell arrows follow a cross that already happened.
Arrows sit close to the candle at the default gap, so on a fast gold chart they read as part of the bar.
Alert channels in this build: popup, one message per closed bar.
Only a terminal popup is wired, under `InpEnableAlerts` which ships `true`. Its comment in the source is explicit that alerts fire on closed bars, so a cross that appears mid-candle and unwinds before the close stays silent.
Every Gold scalper Indicator input
Core settings
| Setting | What it does | Default |
|---|---|---|
InpFastPeriod |
EMA Fast Period. Fast EMA length, default `8`. | 8 |
InpSlowPeriod |
EMA Slow Period. Slow EMA length, default `21`. Widening the gap to 8 and 34 reduces the cross count noticeably. | 21 |
InpStochKPeriod |
Stochastic %K Period. Stochastic %K length, default `5`, with `InpStochDPeriod` at `3` and `InpStochSlow` at `3`. | 5 |
InpStochDPeriod |
Stochastic %D Period. | 3 |
InpStochSlow |
Stochastic Slowing. | 3 |
InpStochLevel |
Stochastic Oversold Level. The oversold line, default `20.0`. The overbought test uses 100 minus this value, so one input moves both. | 20.0 |
Display settings
| Setting | What it does | Default |
|---|---|---|
InpArrowGapPts |
Arrow Vertical Offset (points). Vertical gap between candle and arrow, default `8.0` points. | 8.0 |
Alert settings
| Setting | What it does | Default |
|---|---|---|
InpEnableAlerts |
Enable Alerts on closed bar. | on |

Settings that fit your chart
The screenshot note names XAUUSD on M5, which is what this build is tuned for. Gold on a five minute chart produces enough EMA crosses that the stochastic filter earns its place. On slower gold charts the signal count drops to a handful a week. The same settings transfer to volatile forex pairs, though on a calm pair the stochastic rarely reaches 20 and the tool falls silent.
When the Gold scalper Indicator fails
Gold gaps and spikes around news. An EMA cross driven by one violent candle passes every test here and then reverses.
The two conditions rarely align during a strong run, so the tool stays quiet through some of the cleanest gold trends.
Spread on gold widens sharply at the session change, and an M5 signal taken then can cost more in spread than the move it was chasing.
Copy the compiled Gold scalper 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: Gold Scalping Strategy.
Download the Gold scalper Indicator for MT4 and MT5
The zip holds the compiled Gold scalper 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.
FAQ
Why does InpStochLevel control both the oversold and overbought tests?
The code derives the upper line as 100.0 minus the input. With the default `20.0` the oversold test uses 20 and the overbought test uses 80. Keeping them symmetric means one setting to tune and no chance of the two ends drifting apart. Raise it to 25 and both lines move inward together.
Why does the code test InpStochLevel two bars back as well?
A one-bar allowance on the sell side. The code checks the stochastic two bars back and, if it sat at or above the overbought line while the current reading has dropped below, treats the condition as met. That way a stochastic exit that happened just before the EMA cross still counts, instead of both needing to land on the identical candle.
Is the gold scalper indicator gold specific?
The tuning is. `InpFastPeriod` at `8` and `InpSlowPeriod` at `21` on M5 suit how XAUUSD moves, and the reference screenshot uses that pairing. The code contains nothing gold specific, so it runs anywhere. On a calm forex pair the stochastic seldom reaches the 20 line and you will see very few arrows.
Should I widen InpFastPeriod and InpSlowPeriod?
Only if the default produces more signals than you can act on. Moving to 8 and 34 cuts the cross count and lengthens the average hold. Bringing them closer together does the opposite and, on M5 gold, quickly reaches a point where the stochastic filter is the only thing keeping the chart readable.
Are results guaranteed?
No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Gold scalper Indicator as one input. Always backtest before trading live.
Category: this is part of our Signal and Forecast collection. Also, still, hence, plainly, yet, browse more Signal and Forecast for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.
External references
- The core method is documented in London Gold Pool on Wikipedia.
- Additional market context is at Technical Overlays at StockCharts ChartSchool.
