The Parabolic SAR, also known as PSAR, is a good indicator to follow a trend. This can also be used in some instances as an entry signal and/or trailing stop value. In this article you can see and download an Expert Advisor for MetaTrader4 that uses the PSAR to open trades and move the trailing stop.
You can download the source code for free from the following link
- Position Size, to define the position size
- Stop loss in pips, this is the initial stop loss price, will be replaced by the trailing stop
- Take profit in pips
- Slippage in pips
- Enable trade, to enable or disable the trading function
- PSAR Step, one of the parameters to calculate the PSAR, default is 0.2
- PSAR Max Step, the second parameter to calculate the PSAR, default is 0.02
- Magic Number, to assign a Magic Number to the orders of this EA
- ENTRY BUY: PSAR changes from above the previous bar to below the current bar
- ENTRY SELL: PSAR changes from below the previous bar to above the current bar
- EXIT: Take profit or trailing stop using PSAR
Result on EURUSD 1H Chart
Not a good result for EURUSD 1H chart and same for other timeframes and instruments.
Could perform well in ideal condition with clear and long trends.
Heavily affected by ranging and choppy periods.
As you can see from the Report the strategy is too simple and although it could perform well in ideal condition of trending market it cannot perform well in a real condition of market affected by ranging and choppy periods. We do not suggest to use this strategy alone however it could be useful integrated with better signals from other indicators or price action.
The Expert Advisor can be downloaded with the following link.
I remember when I first started to learn MQL coding, although I had some knowledge of coding many concept were still unclear. To speed up your learning process I would recommend to follow a quick MQL course that will give you the fundamentals you need to create functional Trading Robot.
You can check out the following two course, Udemy often has sales on to make the courses even more affordable, and if you subscribe to my newsletter (top and bottom of the page) I will let you know when this happens.
Please leave a comment if you have any feedback or doubt and remember to like us on Social Media! I would really appreciate also suggestion for improvements and reports of any bug found. Thank you!