Stochastic With Alert Indicator for MT4 and MT5

Written by Dominic Walsh · Published · Last updated

Entering an extreme is not a signal; leaving it can be. The stochastic with alert indicator waits for the classic 14, 3, 3 reading to climb back above 20 or fall back below 80, marks that bar inside the pane, and reports it. You can switch the test to the slower signal line.

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 Separate window (levels 20 / 50 / 80)
Plots 4: %K, %D, Buy, Sell
Alerts popup, push notification, email, sound
Inputs 13

What you see once it loads

Two lines and two marks, in their own pane.

`%K` traces gold at width 2.

`%D` traces dodger blue at width 1.

`Buy` marks lime just below the line.

`Sell` marks red just above it.

Reference levels sit at 20, 50 and 80.

  • %K: line, gold, width 2
  • %D: line, dodger blue, width 1
  • Buy: arrow, lime, width 2, arrow code 233
  • Sell: arrow, red, width 2, arrow code 234
stochastic with alert indicator: Exits from both extremes marked in the pane, EURUSD H1.
Exits from both extremes marked in the pane, EURUSD H1.

What the code actually computes

The reading

`KPeriod` `14` places each close inside the fourteen-bar range. `Slowing` `3` averages that into the gold line, and `DPeriod` `3` averages it again into the blue one.

The exit test

A buy needs the line at or under `LowerLevel` `20.0` on one bar and above it on the next. A sell mirrors that at `UpperLevel` `80.0`.

Which line decides

`UseDLine` ships `false`, so the gold line decides. Switch it on and the slower blue line decides instead, trading speed for fewer marks.

What matters on screen

A mark means the reading just left an extreme.

Readings can sit in a zone for many bars.

The 50 line splits upper and lower halves.

`ArrowGap` `5.0` keeps marks off the line.

Marks stay inside the zero to hundred scale.

Warm-up needs about twenty bars.

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

An exit from either extreme is what reports, once per closed bar. `EnableAlerts` is the master control and a terminal dialog is on by default; phone, mail and the speaker route behind `SoundFile` start off.

Every Stochastic With Alert Indicator input

Core settings

Setting What it does Default
KPeriod %K lookback (raw stochastic). Bars in the range test, `14`. 14
Slowing %K slowing (SMA of raw %K). First smoothing pass, `3`. 3
DPeriod %D signal SMA period. Second pass for the signal line, `3`. 3
UpperLevel overbought reference. Upper exit level, `80.0`. 80.0
LowerLevel oversold reference. Lower exit level, `20.0`. 20.0
UseDLine signal on %D instead of %K. Test the signal line instead, `false`. off

Display settings

Setting What it does Default
ArrowGap arrow offset from the plotted value. Distance between mark and line, `5.0`. 5.0

Alert settings

Setting What it does Default
EnableAlerts Master control for exit messages, `true`. on
EnablePopup Dialog in the terminal, `true`. on
EnablePushNotify (see inputs panel) off
EnableEmail (see inputs panel) off
EnableSound (see inputs panel) off
SoundFile Speaker clip if enabled, `”alert.wav”`. alert.wav
stochastic with alert indicator: Inputs panel, periods above the two exit levels.
Inputs panel, periods above the two exit levels.

Fitting it to a chart

A 14, 3, 3 reading visits its extremes often on any liquid chart. EURUSD H1 is the reference chart, with an exit or two most days. On M5 exits come in bursts. On D1 each one marks a swing worth studying.

Honest weaknesses

An exit from 20 can fail and fall straight back.

Strong trends pin the reading at one end.

The signal-line option adds another bar of delay.

Nothing checks the wider trend.

Copy the compiled Stochastic With Alert 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 Stochastic With Alert Indicator: Stochastic Oscillator at Investopedia, Stochastic oscillator on Wikipedia.

Download the Stochastic With Alert Indicator for MT4 and MT5

The zip holds the compiled Stochastic With Alert 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

Why does a Buy mark wait until %K leaves 20?

Because entering the zone only says the close sits near the bottom of its range. Leaving it says buyers have started to lift it again, which is the moment most traders act on.

What changes if UseDLine is switched on?

The exit test runs on the slower `%D` line instead of `%K`. Marks arrive a bar or two later and less often, which suits anyone bothered by quick false exits.

Can I move LowerLevel 20.0 and UpperLevel 80.0?

Yes. Many traders use 30 and 70 on calmer pairs so the reading actually reaches its zones more often. Both levels feed the exit test directly, and the pane redraws at once.

Where does ArrowGap 5.0 place the marks?

Five points of the zero to hundred scale away from the line, clamped so a mark never leaves the pane. It is a drawing choice only.

Are results guaranteed?

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

Category: this is part of our Oscillators collection. Browse more Oscillators 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