Non Repaint Stochastic Indicator: Values Set On Close

Written by Dominic Walsh · Published · Last updated

The non repaint stochastic indicator builds its two lines from scratch. No call to the terminal stochastic appears anywhere. Once a bar closes its value is fixed, which is what the name is pointing at.

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

Reading the drawn elements

A dodger blue `%K` line and an orange red `%D` line share one pane.

The pane runs from 0 to 100 with references at 80, 50 and 20.

`Buy` uses arrow 233 in lime and `Sell` uses 234 in red.

Marks sit six points from the candle high or low.

  • %K: line, dodger blue, width 2
  • %D: line, orange red, width 1
  • Buy: arrow, lime, width 2, arrow code 233
  • Sell: arrow, red, width 2, arrow code 234
Non repaint stochastic indicator %K and %D lines with arrows on EURUSD H1.
Non repaint stochastic indicator %K and %D lines with arrows on EURUSD H1.

From price to plot

Raw %K first

The code finds the highest high and the lowest low across `KPeriod` `14` bars. Where the close sits inside that span, as a percentage, is the raw value. A flat span writes fifty instead of dividing by zero.

Slowing and signal

`Slowing` `3` averages the raw values into `%K`. `DPeriod` `3` then averages `%K` into `%D`. Both steps use plain arithmetic over completed bars.

What non repaint actually means

Every value comes from bars that already closed. Nothing shifts forward and nothing gets rewritten later. A standard stochastic behaves the same way, so the name describes correct behaviour rather than a special feature.

Making it useful

`OverboughtLevel` `80.0` and `OversoldLevel` `20.0` are drawn references.

The 50 line splits the range and often gets crossed mid move.

A crossing of the two lines is the event the marks report.

Both lines stay inside 0 and 100 by construction.

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

`EnableAlerts` opens the set and ships true, with `EnablePopup` giving the terminal dialog. The phone route `EnablePushNotify`, the mail route `EnableEmail` and the clip route `EnableSound` all start false. `SoundFile` picks the clip. One message per bar.

Every Non repaint stochastic Indicator input

Core settings

Setting What it does Default
KPeriod %K lookback. Window the close gets measured inside, default `14`. 14
DPeriod %D smoothing. Bars behind the signal line, default `3`. 3
Slowing %K slowing. Damping applied to the raw percentage, default `3`. 3
OverboughtLevel Overbought reference. Upper drawn reference, default `80.0`. 80.0
OversoldLevel Oversold reference. Lower drawn reference, default `20.0`. 20.0

Alert settings

Setting What it does Default
EnableAlerts Top switch for crossing alerts, default `true`. on
EnablePopup Terminal pop-up on a crossing, default `true`. on
EnablePushNotify Push message to MetaTrader mobile, default `false`. off
EnableEmail Mail sent from the terminal, default `false`. off
EnableSound Audio cue on a crossing, default `false`. off
SoundFile (see inputs panel) alert.wav
Non repaint stochastic indicator inputs panel with KPeriod, DPeriod and Slowing.
Non repaint stochastic indicator inputs panel with KPeriod, DPeriod and Slowing.

What to run it on

Fourteen bars behaves the same way on most charts. EURUSD H1 is the reference chart, where `KPeriod` `14` covers over half a day. On M5 both lines reach the references several times a session. Daily bars slow that right down.

When it will mislead you

A bounded reading can sit pinned at one end through a strong move.

Two averages in a row mean a crossing confirms several bars late.

The marks report a crossing wherever it happens, including mid range.

Copy the compiled Non repaint stochastic 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 Non repaint stochastic Indicator: Success trap on Wikipedia, Onbalancevolume at Investopedia.

Download the Non repaint stochastic Indicator for MT4 and MT5

The zip holds the compiled Non repaint stochastic 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

Does KPeriod 14 make this non repaint?

No. The window length has nothing to do with it. Values hold because every calculation reads bars that already closed and nothing shifts forward. A textbook stochastic works the same way, so the label describes normal behaviour.

What does Slowing 3 smooth?

The raw percentage, before it becomes the `%K` line you see. Three bars is the MetaTrader default and this build keeps it. Raise it and the line calms down, at the cost of confirming a turn later.

What happens when the KPeriod span is flat?

Because the highest high and the lowest low can match on a completely still bar. Dividing by that span would fail, so the code writes the midpoint instead. It happens rarely, mostly on illiquid instruments.

Does OverboughtLevel 80.0 trigger a plot?

No. `OverboughtLevel` and `OversoldLevel` only place the two reference lines in the pane. The marks come from the crossing of `%K` and `%D`, which can happen anywhere on the scale, including the middle.

Are results guaranteed?

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