The afi stochastic indicator keeps things plain. iStochastic supplies both lines at `KPeriod` `14`, `DPeriod` `3` and `Slowing` `3`. The pane adds three reference levels and a set of alert switches on top.
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 | 2: %K, %D |
| Alerts | popup, push notification, email, sound |
| Inputs | 11 |
What the AFI Stochastic Indicator draws on the chart
A lime `%K` line and a red `%D` line share one pane.
The scale is fixed between 0 and 100.
References sit at 20, 50 and 80.
The pane holds two line plots and no others.
- %K: line, lime, width 2
- %D: line, red, width 1

How the AFI Stochastic Indicator calculates its values
The terminal does the maths
iStochastic returns the main and signal buffers directly. This file passes `KPeriod` `14`, `DPeriod` `3` and `Slowing` `3` straight through with simple averaging.
What the reading means
A stochastic asks where the close sits inside the recent high to low span. Near the top the reading approaches a hundred. Near the bottom it approaches zero.
The AFI part is a name
Nothing in the file adds a second formula behind the label. What ships is a standard oscillator with levels and alerts. Worth knowing before you compare it against something more elaborate.
How to read the signals
`OverBought` `80` and `OverSold` `20` mark the two ends.
The 50 reference splits the scale and gets crossed often.
A crossing of the two lines is the event the alerts watch.
A reading pinned at one end usually means a strong move, not an ending one.
Alert channels in this build: popup, push notification, email and sound, one message per closed bar.
`EnableAlerts` gates four routes and starts true. `EnablePopup` is the partner that also ships on. `EnablePushNotify` reaches the mobile app, `EnableEmail` sends mail and `EnableSound` plays `SoundFile`. Those three wait until you switch them.
Every AFI Stochastic Indicator input
Core settings
| Setting | What it does | Default |
|---|---|---|
KPeriod |
Bars behind the main line, default `14`. | 14 |
DPeriod |
Bars behind the signal buffer, default `3`. | 3 |
Slowing |
Smoothing the terminal applies, default `3`. | 3 |
OverBought |
Top reference drawn in the pane, default `80`. | 80 |
OverSold |
Bottom reference drawn in the pane, default `20`. | 20 |
Alert settings
| Setting | What it does | Default |
|---|---|---|
EnableAlerts |
Master toggle for the crossing alerts, default `true`. | on |
EnablePopup |
Alert box on screen, default `true`. | on |
EnablePushNotify |
Notification pushed to mobile, default `false`. | off |
EnableEmail |
Mail through the terminal, default `false`. | off |
EnableSound |
Plays a sound clip, default `false`. | off |
SoundFile |
(see inputs panel) | alert.wav |

Settings that fit your chart
The screenshot note calls H1 the cleanest chart for crossings. EURUSD H1 is the reference chart, where `KPeriod` `14` spans over half a day. On M5 the pair crosses constantly. H4 gives a handful of crossings a week.
When the AFI Stochastic Indicator fails
A bounded reading pins at an end during a strong trend and stays there.
Crossings near the 50 line carry little information.
Nothing here beats a plain stochastic, since that is what it calls.
Copy the compiled AFI 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.
Download the AFI Stochastic Indicator for MT4 and MT5
The zip holds the compiled AFI 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.
FAQ
What does KPeriod 14 span?
The high to low range the close gets measured against. Fourteen bars is the MetaTrader default. Shorten it for a jumpier reading that reaches both ends often, or lengthen it for something far calmer.
Does the AFI name add a formula?
Not in this build. The file calls the terminal stochastic and plots what comes back. If you expected an extra calculation behind the label, this is worth knowing before you set it up on a chart.
What does the 50 level mean for %K?
It marks the midpoint of the high to low span. Above fifty the close sat in the upper half of recent range. Below it the close sat in the lower half. Many crossings happen right around it.
Does OverBought 80 trigger a plot?
No. This build carries two line plots and nothing more, so the levels are drawn references only. Any rule about reaching eighty or twenty has to come from you, or from the alert settings.
Are results guaranteed?
No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the AFI Stochastic Indicator as one input. Always backtest before trading live.
Category: this is part of our Oscillators collection. Also, hence, truly, browse more Oscillators for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.
External references
- The core method is documented in istochastic (STOCHASTIC) at the MQL5 Documentation.
- Additional market context is at Chaikin Oscillator at StockCharts ChartSchool.
