Blog for Building Expert Advisors for Metatrader 4

ELEMENTS OF A PROFITABLE EXPERT ADVISOR

 

 

Expert Advisors (Robots built through MQL4 Programming) use a predefined set of trading rules to generate objective buy and sell signals. While the variety of EAs (Expert Advisors) is almost limitless, most profitable EAs have certain elements in common. Whether you build your own EA or purchase one, EAs with these characteristics will maximize your chances of success. Most profitable EAs have the right level of complexity in their trading logic. These goldilocks strategies are not too simple and not too complex. The financial markets are certainly complex. An overly simple strategy is unlikely to respond adequately to the market's complexity. On the other hand, if the strategy is overly complex, it may be over-fit to the market. An over-fit strategy is one that doesn't generalize well to data other than that on which it was based. Complex strategies tend to be over-sensitive to changes in the market and need constant adjustment and modification.


A profitable EA needs to have realistic entries and exits. For example, it's easy to specify limit orders for a trade entry. In practice, a limit order may not be filled, depending on the liquidity of the market and how many traders have orders in front of yours. Similarly, it may be possible to specify a market-on-close exit, but if the order is placed exactly at the market's close, there will be no opportunity to fill it. The simulation results, on the other hand, may not take this into account.


Many traders focus more on trade entries than exits. However, in many cases, exits are more important. One essential element of strategy exit logic is that a profitable trading system should contain exits for both exiting at a loss and exiting at a profit. An example of exiting at a loss is a protective (money management) stop. A target exit, based on a limit order, is an example of exiting at a profit. Without the ability to exit a losing trade, the losses in a trading strategy are potentially unlimited. Similarly, without the ability to exit a profitable trade, it's likely to turn into a loss.


Although it sounds obvious, an important element of a profitable Expert Advisor is correct coding. Certainly, if you develop a system yourself, it's important to verify that the system code does what you intend. It's tempting to start testing a newly code strategy for profitability as soon as the code verifies or compiles, but it's important to check that the intended logic was properly coded first.


Another characteristic that's required for profitability is reasonable cost assumptions. Trading costs include commissions, fees, and slippage. The latter is defined as the difference between the order price and the price at which the order is filled. A realistic amount for slippage depends on the market and the type of order. In Forex markets, stop orders have less slippage than market orders, whereas limit orders have zero slippage (although they may not be filled).


In general, the most profitable EAs are the most consistent ones. Demonstrating consistent profitability over a long period of time means the system works well in a variety of market conditions. EAs that have extended flat or drawdown periods are clearly tailored to certain types of market conditions. If those conditions don't manifest in the future, there's no reason to expect the strategy to be profitable. Also, the historical performance results should be based on realistic assumptions for starting equity and risk. If the stated performance is based on a much higher starting account size than you'll have or the strategy requires taking on more risk than you can tolerate, the strategy may not be profitable for you.


Finally, profitable EAs have good real-time or out-of-sample results. EAs are typically developed using price data for one or more currencies or CFDs. The data over which the strategy is initially developed is referred to as the in-sample data set. Once a strategy is developed, it should always be tested on a second set of price data that was not used during development. This is called the out-of-sample data set. Only EAs that are profitable on out-of-sample data are likely to be profitable in the future. Once a strategy is deployed, it can be tracked live -- either simulated or with real money. Profitable real-time tracking results are the final arbiter of profitability.


For more information on elements of profitable Expert Advisors:


"Study book for successful foreign exchange dealing" by Royal Forex
"The artful trader" by Selwyin Michael Guishen
"Turtle Rules" by Richard Dennis and William Eckhardt


If you are the copyright owner of any of these articles and don't want us to share them, please, contact us in order to remove them.