FX Robot

6 April 2020

I have been using the Metatrader (MT4) trading platform for over 10 years. The charting package is advanced, customizable and allows traders to see everything they need. However, from an execution standpoint, MT4 is lacking so I prefer to place trades on different trading platforms.

One feature that I knew about for a long time but never explored is programming of auto trading robots (in MT4 called Expert Advisors). The platform also has the ability to backtest the robot's performance on past market data.

Towards the end of 2019 I had the time to delve into this issue. I researched and coded in MQL4 programming language a robot that trades within the MT4 platform. 

The robot is designed to trade EURUSD currency pair (because the bid/ask spread is the smallest) on 1 hour time frame. Position is split into two parts with different distance to profit target. Stop loss order is moved to lock in profits or to limit downside risk. The trading system also uses two additional filters that either allow or not allow a new trade to take place. In order to ensure ample margin, the maximum number of trades is limited to ten at one time.

The results from January 1 2019 to January 1 2020 are encouraging:

  • Trades executed: 4291
  • Start Balance: $10,000
  • Total profit: $3,735.20
  • Profit percent: 37.5%
  • Max. Drawdown: 10.87%


Report generated with equity curve:


The complete report with a full list of trades can be viewed here:


The performance is very much encouraging. The equity curve is fairly flat with reasonably small drawdowns. Let's see how the robot does over longer time frame:

Report from January 1 2017 to April 1 2020:

Over the past 40 months, the system would place over 15 thousand trades and the profit gained is over 85%.

Details:
  • Trades executed: 15126
  • Start Balance: $10,000
  • Total profit: $8500.95
  • Profit percent: 85%
  • Max. Drawdown: 21.36%

I am extremely satisfied with the results. The only negative is 21% drawdown which would make lots of investors nervous. However, the drawdown was quickly recovered and the equity curve continued to rise ever since.


The complete report with a full list of trades can be viewed here:

Backtesting a large number of trades was a great experience as it proved the importance of properly set profit targets and stop loss orders. Somewhat surprisingly, the often mentioned risk reward ratio proved to be a vexing concept to work with because tight stops inevitably lead to a greater number of trades that end up losing money.

I was never a fan of automated trading as I am convinced that trading experience is as important to success and perhaps even more so than statistical approach. However, having tested multiple versions of my robot with various settings showed that automated trading definitely is a viable way to profitably trade the financial markets.

No comments:

Post a Comment