SAR Trading System

SAR Trading System
Download ALL MT5 experts (1734)
YouTube Video Thumbnail



Similar MetaTrader Tools

SAR Trading System

Info

The SAR Trading System is a Expert Advisor for MetaTrader 5 that the sar trading system demonstrates the functionality of the stop and reversal (sar) indicator, originally designed by welles wilder. This expert advisor monitors open positions and dynamically adjusts the stop loss using parabolic acceleration, as defined by the parameters of the parabolic system.

Usage

This tool is typically used for automated trading on major forex pairs and gold.

Platform

This Expert Advisor works exclusively on MetaTrader 5 (both build 600+ and newer versions).

Setup

Place the downloaded file in MQL5/Experts folder via File ? Open Data Folder in MetaTrader 5.


How to Install and Use SAR Trading System

1. Installation: Open the "File" menu, select "Open Data Folder," navigate to MQL/Experts, paste your file, and restart the terminal.

2. Activation: Drag the EA from the Navigator onto a chart, ensure "Allow live trading" is checked in the Common tab, and verify the AutoTrading button is green.

3. Optimization: Right-click your chart, choose "Expert List," click "Properties" to adjust inputs, and save your preferred setup as a set file for future use.

4. Maintenance: Regularly check the "Experts" tab in the terminal window to monitor trade logs and potential execution errors.

Frequently Asked Questions

Q: Why is my EA not opening trades? A: Check the "AutoTrading" button, ensure "Allow live trading" is enabled, and verify your broker allows automated trading on your account type.

Q: Can I run multiple EAs on one chart? A: No, each chart can only host one active EA; however, you can open multiple charts for different currency pairs to run several EAs.

Q: What does the "smiley face" icon mean? A: A smiley face in the top-right corner of the chart indicates the EA is successfully running; a frowny face means it is disabled.

What this tool does

The SAR Trading System demonstrates the functionality of the Stop and Reversal (SAR) indicator, originally designed by Welles Wilder.

Typical Use Case

This Expert Advisor excels in automated trading and technical analysis on MetaTrader 5.

Compatible Platform & Setup

This Expert Advisor works on MetaTrader 5. Place the file in the MQL5/Experts folder and restart the terminal.

Description & Settings

Related: Tick Scalper Helper: Tick Chart and One-Click Trading Panel for MT5 - another powerful expert for MetaTrader 5 traders.

The SAR Trading System demonstrates the functionality of the Stop and Reversal (SAR) indicator, originally designed by Welles Wilder. This expert advisor monitors open positions and dynamically adjusts the stop loss using parabolic acceleration, as defined by the parameters of the parabolic system.

Also recommended: Basket Pair Closer: Efficiently Close Trading Positions - similar expert with strong performance on MetaTrader 5.


With each new bar, the EA adjusts the stop loss based on the parabolic calculation. The acceleration factor ensures that the stop loss adjustment increases progressively, resulting in a noticeable acceleration of the stop loss movement.

While Wilder intended the SAR for position reversal when the parabolic touches the current price, this system utilizes the SAR as a sophisticated trailing stop.

To illustrate the stop loss trailing mechanism, the EA includes an option to open random buy or sell positions. When the 'Random Trade Toggle' is set to 'true', the EA initiates random trades; otherwise, it refrains from opening positions if set to 'false'.

Notably, the parabolic system remains active even when the EA is not opening positions, allowing it to trail positions opened manually or by other experts.

Additionally, the EA incorporates a delay feature, enabling users to postpone the opening of new positions for a specified duration, controlled by the timer.


External Parameters:

- Initial Stop-Loss (points): Sets the initial stop loss value before the parabolic trailing begins.

- SAR Acceleration Factor Increment Step: Determines the increment of the parabolic acceleration factor.

- SAR Acceleration Factor Max. Value: Specifies the maximum value of the parabolic acceleration factor.

- Random Trade Toggle: Enables or disables random position opening. 'True' allows manual trading, while 'False' prevents the EA from opening positions.

- Timer Frequency (sec): Sets the delay before opening a new trade.

The system calculates a new stop loss value with each new bar. For long positions, the calculation is:
SAR(n+1) = SAR(n) + AF x [EP - SAR(n)]

And for short positions:
SAR(n+1) = SAR(n) - AF x [SAR(n) - EP]

Where:

- SAR(n+1): Stop loss level at the new (n+1) bar.

- SAR(n): Stop loss level at the previous (n) bar.

- EP (Extremum Point): New maximum (long position) or minimum (short position) price recorded since the trailing stop initiation.

- AF (Acceleration Factor): Coefficient that increases by a constant step (increment of the acceleration factor) with each new bar where the price reaches a new extremum. The acceleration factor continues to increase until it reaches its maximum value.

You may also like: CME Equity Index Futures Holiday Calendar and Trading Halt Automation - excellent alternative for expert users on MetaTrader 5.

Source Code

#property copyright "robotfx"
#property link "https://robotfx.org"
#property version    "1.00"
input int            timertime=300;        // timer frequency (sec)
input int            stoploss = 10;       // initial stop-loss (points)
input double         afstep = 0.02;       // sar acceleration factor increment step
input double         afcap = 0.2;         // sar acceleration factor max. value
input bool           randomtrade = true;  // random trade toggle
int                  tradevalue;
long                 stoplevel;

.......

Leave your opinion, ask a question, share some knowledge

⚠ Limitations & Risk Warning

  • This tool is provided for educational and testing purposes only.
  • Past performance does not guarantee future results.
  • Trading involves substantial risk of loss. Use on a demo account first.
  • Results may vary depending on market conditions, broker, and settings.
  • We recommend thorough backtesting and forward testing before using with real funds.
© ROBOTFX Free educational tools by RobotFX. Use entirely at your own risk; we are not liable for any financial losses incurred.