- Strategy
- Buys when the Parabolic SAR flips below price while the close is above the 100 EMA, and sells when it flips above price while the close is below the EMA. The stop-loss is placed at the SAR and trails it.
- Risk model
- 1% of balance per trade (configurable), stop-loss on every order, one position at a time
What it does
The Parabolic SAR EA trades Welles Wilder's stop-and-reverse indicator. When the SAR dots move from above price to below it, the market may be turning up; the EA buys if the longer-term EMA agrees. The opposite flip triggers sells.
The SAR is also a natural trailing stop: it moves toward price faster as the trend extends. The EA uses it both for the initial stop-loss and for trailing.
How it works
On each new bar the EA reads MetaTrader's Parabolic SAR (0.02, 0.20) and a 100-period EMA.
- Direction: SAR below the close means up; SAR above the close means down.
- Buy: direction is up on the last closed bar and was down on the bar before, and that close is above the 100 EMA. Filtered flips are logged.
- Sell: the mirror image with the close below the EMA.
- Stop-loss: the SAR value of the signal bar (plus an optional buffer). Signals with a SAR more than 3 x ATR(14) away are skipped.
- Trailing: on every tick the stop moves to the last closed bar's SAR if that improves it.
- Exit: if the SAR flips against the position at a bar close, the position is closed. No fixed target by default.
How to use it
The Parabolic SAR is responsive, so this EA is best in markets that make clean directional runs, for example GBPUSD or gold on H1 and H4 during busy sessions. The EMA filter keeps it from buying every flip in a downtrend.
A smaller acceleration step gives the trade more room; a larger one trails tighter. See the stop-loss glossary entry for why a fixed invalidation point matters.
Settings
| Input | Default | What it changes |
|---|---|---|
| SAR acceleration step | 0.02 | How fast the SAR accelerates toward price. |
| SAR maximum acceleration | 0.20 | Upper limit of the acceleration factor. |
| Trend filter EMA period | 100 | Flips are taken only on the matching side of this EMA. |
| Take-profit (R multiple) | 0.0 | Optional target; 0 lets the SAR trail manage the exit. |
| Maximum stop (x ATR) | 3.0 | Skips the flip if the SAR is too far from price. |
| Use trailing stop | true | Moves the stop to the SAR on each closed bar. |
| Extra stop buffer (points) | 0 | Places the stop slightly beyond the SAR. |
| Exit on flip | true | Closes the trade when the SAR flips against it. |
| Risk per trade (% of balance) | 1.0 | Share of balance risked between entry and stop. |
| Fixed lots | 0 | Fixed volume instead of risk %; 0 = risk-based. |
| Maximum spread (points) | 20 | Skips signals when the spread is wider; 0 = off. |
| Trading start / end hour | 7 / 20 | Server-time window for new trades; equal values = 24 hours. |
| Move stop to break-even | true | Stop to entry + 20 points once profit reaches 1R. |
| Magic number | 2611009 | Identifies this EA's trades. |
Limitations
- In sideways markets the SAR flips constantly; the EMA filter helps but does not remove these losses.
- The SAR tightens quickly and can stop out a trend on a normal pullback.
- With no fixed target, profits depend on trends lasting long enough for the trail to lag behind them.
- A wide SAR after a fast move can push the stop beyond the ATR cap, so the trade is skipped.
Before you run it live
Test on a demo account and in the MetaTrader 5 Strategy Tester over several years first. No backtest results are published for this EA, and any test describes the past only.
- Match the spread limit and trading hours to your broker's spreads, stop level and session times, and include commission and swap in tests.
- Start with 1% risk or less and check the lot sizes in the Experts log; the Position Size Calculator is a useful cross-check.
- Use a different magic number on each chart, and keep the terminal (or a VPS) running so stops are managed.
Run the Strategy Tester with 'Every tick based on real ticks' if your broker provides it, since trailing behavior depends on tick data.

