The buy sell indicator plots two EMA lines on the chart. It marks every cross with a Buy Signal or Sell Signal arrow. AtrPeriod scales how far each arrow sits from its candle, so the gap grows with volatility, not a fixed pixel gap.
This build ships as buy-sell-indicator-mt5-indicator-forexmt4systems.ex4 for MT4 and buy-sell-indicator-mt5-indicator-forexmt4systems.ex5 for MT5; the screenshots below come from EURUSD H1.
| Platforms | MT4 (.ex4) + MT5 (.ex5) |
|---|---|
| Chart window | Main price chart |
| Plots | 4: Fast EMA, Slow EMA, Buy Signal, Sell Signal |
| Alerts | popup, push notification, email, sound |
| Inputs | 10 |
What the Buy Sell Indicator draws on the chart
Fast EMA (spring green line) plots the FastPeriod average of closes.
Slow EMA (orange red line) plots the SlowPeriod average of closes.
Buy Signal (lime, code 233) sits below the low where Fast EMA crosses up.
Sell Signal (red, code 234) sits above the high where Fast EMA crosses down.
- Fast EMA: line, medium spring green, width 2
- Slow EMA: line, orange red, width 2
- Buy Signal: arrow, lime, width 3, arrow code 233
- Sell Signal: arrow, red, width 3, arrow code 234

How the Buy Sell Indicator calculates its values
Two lines and the cross test
FastPeriod and SlowPeriod each drive their own EMA. The code checks both at the current bar and again one bar back.
FastPeriod defaults to 9, and SlowPeriod defaults to 21, a classic pairing. A cross up needs the fast line at or below the slow one on the prior bar, then above it now. A cross down mirrors that.
ATR sets the arrow gap
AtrPeriod feeds an ATR reading at the signal bar. That value, times ArrowOffsetATR, sets the gap between the arrow and the candle.
AtrPeriod defaults to 14, and ArrowOffsetATR defaults to 0.5. The gap grows on a wild bar and shrinks on a quiet one. Neither arrow ever touches the candle itself.
Warm-up bars stay empty
The code works out a warm-up length from the larger of SlowPeriod and AtrPeriod, plus a couple of bars. Every buffer, both lines and both arrows, gets set to an empty value before that point.
That stops a Buy Signal or Sell Signal from printing on a bar where the slow EMA or the ATR reading was not fully built yet. Fast EMA and Slow EMA only start plotting once the warm-up clears too.
How to read the signals
A lime Buy Signal marks the exact bar of the up cross. Both EMA lines stay on the chart for context.
A red Sell Signal marks the mirrored down cross of the same two lines.
A wider gap around one arrow just means that bar was more volatile, not a stronger signal.
Neither EMA line nor either arrow can appear before the warm-up length passes. That length grows with whichever of SlowPeriod or AtrPeriod needs the most history.
Alert channels in this build: popup, push notification, email and sound, one message per closed bar.
Alerts cover popup, push, email and sound. They fire once per closed bar, right where the two lines cross.
Every Buy Sell Indicator input
Core settings
| Setting | What it does | Default |
|---|---|---|
FastPeriod |
Fast EMA period. FastPeriod sets the fast line’s length. It defaults to 9. | 9 |
SlowPeriod |
Slow EMA period. SlowPeriod sets the slow line the fast one crosses. It defaults to 21. Widening the gap between FastPeriod and SlowPeriod cuts down on false crosses inside a range, at the cost of a later signal. | 21 |
AtrPeriod |
ATR period for arrow placement. AtrPeriod sets the ATR window behind the arrow gap. It defaults to 14. | 14 |
Display settings
| Setting | What it does | Default |
|---|---|---|
ArrowOffsetATR |
Arrow vertical offset (x ATR). ArrowOffsetATR is a cosmetic multiplier, 0.5 by default, that scales that gap. | 0.5 |
Alert settings
| Setting | What it does | Default |
|---|---|---|
EnableAlerts |
(see inputs panel) | on |
EnablePopup |
(see inputs panel) | on |
EnablePushNotify |
(see inputs panel) | off |
EnableEmail |
(see inputs panel) | off |
EnableSound |
(see inputs panel) | off |
SoundFile |
(see inputs panel) | alert.wav |

Settings that fit your chart
The screenshot runs on EURUSD H1, a clean chart for the 9/21 cross. The same pairing works as a starting point on other majors and other timeframes. The ATR-based gap keeps arrows readable at any volatility level. Traders who want faster arrows can shorten AtrPeriod too, which tightens the gap between the arrow and the candle a little sooner.
When the Buy Sell Indicator fails
In a range, the two lines can cross back and forth with no real trend behind them. Arrows print close together with little follow-through.
A two-line cross always lags the turn. Both lines need fresh closes to shift, so the arrow prints after part of the move is gone.
Every bar re-evaluates both EMAs from scratch through separate calls, rather than carrying a running average forward, so a very long chart history takes longer on the first pass.
Copy buy-sell-indicator-mt5-indicator-forexmt4systems.ex4 into MQL4/Indicators and buy-sell-indicator-mt5-indicator-forexmt4systems.ex5 into MQL5/Indicators, then restart the terminal and drag the Buy Sell Indicator 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 Buy Sell Indicator: Buy side on Wikipedia, Margin at Investopedia.
Download the Buy Sell Indicator for MT4 and MT5
The zip buy-sell-indicator-mt5-indicator-forexmt4systems.zip holds buy-sell-indicator-mt5-indicator-forexmt4systems.ex4, buy-sell-indicator-mt5-indicator-forexmt4systems.ex5 and a short README, compiled files only. 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 the Buy Signal arrow sit a different distance from price on different bars?
The gap comes from AtrPeriod times ArrowOffsetATR, not a fixed point count. A volatile bar gives a bigger ATR reading, so the arrow sits further out. A quiet bar pulls it in close, just to clear the wick.
What happens if FastPeriod and SlowPeriod are set close together?
FastPeriod is 9 by default, and SlowPeriod is 21. Moving them closer makes the two lines cross more often. That means more arrows, but also more crosses inside a range with no real move behind them. A wider gap between the two periods also tends to cut down on false crosses inside a range, at the cost of a later signal.
Does a shorter AtrPeriod change the arrow position or the signal itself?
Only the position changes. AtrPeriod only feeds the gap that ArrowOffsetATR scales, nothing more. The cross test itself depends only on FastPeriod and SlowPeriod, so a shorter AtrPeriod never changes when an arrow fires.
When exactly does the alert fire relative to the Buy Signal arrow?
The check runs on the same closed bar as the cross, guarded to fire once per bar. The alert and the arrow always land on the same bar, never one apart. Both the EMA calls and the ATR call run fresh on every bar, rather than carrying a running total forward from the previous one.
Why do Fast EMA and Slow EMA stay blank on the earliest bars of a fresh chart?
The code works out a warm-up length from the larger of SlowPeriod and AtrPeriod, plus a small buffer. Every buffer, both EMA lines and both arrow buffers, stays at an empty value before that point. That is by design, not a bug: neither EMA is fully built yet on those early bars, so nothing trustworthy exists to plot.
Are results guaranteed?
No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Buy Sell Indicator as one input. Always backtest before trading live.
Category: this is part of our Signal and Forecast collection. Also, truly, 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 Buy side on Wikipedia.
- Additional market context is at Margin at Investopedia.
