EA Builders / MQL / Trading

Building Your Expert Advisor

The 3 Metrics to Watch When You Build Your First Expert Advisor

When you start to design and build your first Expert Advisor – an EA that you plan on trading – it’s important to keep a close eye on these three metrics:

  1. Total Trades: The Expert Advisor should trade often enough so that you can quickly evaluate its performance.
  2. Entry and Exit Quality:  Evaluate the quality of your Trade Entries and Exits.
  3. Winning Percentage: The Expert Advisor should win more than it loses.

OK, I realize a bunch of you are shaking your heads and saying “uh, yeah – no kidding, of course it should win more than it loses!

But remember, there are plenty of good, profitable trading systems that lose more often than they win.  Generally, this kind of system will take a small loss if the trade does not move in the positive direction. But if the trade does move positive, this system will allow the trade to run and take a large profit.

So, you end up with a profitable system that closes more losing trades than winning trades.

This kind of system is not ideal for your first Expert Advisor.

Here is an excerpt from my book Automatic Alpha explaining why.

The Ideal First-Time Mechanical Trading System

A trading system should be defined such that (i) its mechanical implementation is straightforward and (ii) its ultimate behavior is easy to understand and tolerate.  A first-time trading system should meet both of these objectives – giving the trader that is developing their first mechanical trading system a good chance of success, both in developing and running the system.

 Two of the most important characteristics of a first-time mechanical trading system are:

(1)     A high winning percentage (greater than 70%), and

(2)     A high number of trades (about one to two trades per week). 

These characteristics are important because a system with a high winning percentage is easy to run.  It wins a lot.  Also, a system with a high number of trades provides a good deal of feedback.  This means a trader can quickly recognize if the system departs from its historical behavior, and make adjustments accordingly.

It’s hard to make adjustments to a system that does not trade often. One to two trades per week is a good number: high enough to provide efficient feedback, but not so high that the trading costs (commission, spread, etc.) become a significant factor.

There are a number of commercially available systems that may be generally profitable, but only trade and only win a small percentage of the time. Some of these systems do not trade often and do not win often, but when they win, they make a substantial profit.  This type of system can be valuable and can be an important part of a diversified trading strategy, but it is generally not a good model for the trader developing and running their first mechanical system.  These systems are difficult to run due to their prolonged losing streaks.  Most traders will be overcome by the urge to stop trading the system. Of course, soon after stopping, the system will often signal a trade for a substantial profit.  The best way to avoid this scenario is to start with a system with a high winning percentage.

As you become a more experience system trader, you may choose to develop and run systems that do not necessarily have a high winning percentage or a high number of trades. But for your first system – to help get started in the right direction and to build confidence – it is a good idea to choose a system with a high winning percentage and a high number of trades.

 

How to Increase Your Winning Percentage

Almost all Expert Advisors can be split into two logical parts.

    1. The Trade Entry
    2. The Trade Exit

The responsibility of your Entry is to get the trade started in the right direction.  That’s all.

The responsibility of your Exit is to get out of a bad trade quickly – or close your profitable trade.

The exit makes all of the money.

Known fact:  If you get the chance to talk with a successful trader, don’t ask her how she opens a trade, ask her how she closes a trade.   Again, your exit is responsible for making your profit.

Many traders, especially when they first start out, worry too much about their trade Entry and not enough about their trade Exit.

Use the Entry Test

If the logic of your EA can be split into its entry and exit, then you can test the Entry separate – without affecting the Exit.  This is a huge advantage.

The Entry Test is simple.  You remove your Exit logic completely, and just exit the trade after a certain period of time, for example 2 hours, or 1 day.  When you look at the results of this test, you ignore the total profit.  You only look at the number of winning trades.

The Entry Test shows you if your entry is getting your trade started in the right direction.  Best of all, you can make changes to your entry logic and use this test to see if the change increased your number of winning trades.

Your Exit

Remember, there are a lot of ways you can exit a trade that are not based solely on a Takeprofit or Stoploss value.   The exit could be based on an indicator, the time of day, etc.

Exits can be very creative. And they are usually worth the creativity.

I can’t say the same for entries.  They can be very creative, but there seems to be a point of diminishing returns as you add more sophisticated criteria to the entry logic.  (The Entry Test can prove this pretty quickly.)

Use the Exit Test

A great way to test the quality of your exit is to look at each closed trade, double how long the trade was open, and locate the highest profit point within the time range.  This would have been the best time to exit the trade.

For example, suppose you bought the EURUSD on Monday and closed the position early Wednesday – so the trade was open for about 2 days.  At the end of the week you would look at the EURUSD chart from Monday to early Friday (about 4 days) and note the highest trading point of the pair (highest because it was a long position, we’d use lowest for a short position).

Obviously, the point in time when the trade was at its highest profit value, within the 4 day period, would have been the best time to close the position.

This is only a rule-of-thumb test – you can vary the holding period – but this test gives you a quick look at how much profit you might have left on the table.  And more importantly, when you are reviewing the chart, you may see something that gives you an idea to improve your exit.

One last point: I’ve found that a trailing stop often leads to a higher winning percentage and a lower overall profit.  This does not sound like a good thing, but since you are trying to experience a high winning percentage with your first Expert Advisor, it might be something to consider.

I hope this information helps you in your quest to build your perfect Expert Advisor. Let me know!

  iExpertAdvisor - MetaTrader Expert Advisor Builders

One Comment

  1. Pingback: Trade Exit Quality - MetaTrader Expert Advisor Builders

Leave a Reply

Your email address will not be published. Required fields are marked *

*