If you are familiar with trading, you know about trends. A trend shows the direction of a price. It can be ascending, descending, or horizontal.
How To Create A Forex Mechanical Trading System
2022-05-19 • Updated
Information is not investment advice
Every trader is different. Still, it's possible to unite them into categories. In particular, it's possible to distinguish between system traders and discretionary traders. Discretionary traders rely on their judgment regarding the decision-making process. They can approach each trade differently. System traders, on the contrary, rely on mechanical trading systems for buy and sell signals and order execution in the market. This article will talk about system traders and present some of the pros and cons of trading systems.
What is a mechanical trading system?
To create a mechanical trading system, a trader has to program the rules of their trading strategy into the software mechanics. These rules should include entry execution, Stop Loss placement, trailing stop or Take Profit target, and risk management options. After a trader writes the code and tests it, the mechanical trading system will perform all the required trading tasks in real-time. In other words, it'll automatically trade the strategy.
Traders use mechanical trading systems to solve many routine tasks related to opening and managing a trading position. In addition, automated systems can increase a trader's productivity by running processes faster. Finally, if a trader follows the system, the mechanical system will take emotion out of trading.
MetaTrader is well suited for creating mechanical Forex trading systems. The software allows traders to automate their trading strategies using a programming language. However, that doesn't mean that you have to be an IT specialist to use this feature. You can add conditional statements to a setup and thus codify your trading method. The critical thing is that this method should have a clear set of rules that you can apply mathematically.
Is there an ideal trading system? A holy grail for traders? Notice that mechanical systems are based on historical data. As a result, they may not necessarily perform acceptably in the future as market conditions may change. Generally, don't force the system to fit past events and don't come up with special rules to accommodate history. A system based on sound general principles should give acceptable performance. You can use your system development and test software to get reliable and consistent results. You can also run the mechanical trading system on a demo account in real-time and then estimate its performance.
Types of mechanical trading systems
There are three types of mechanical trading systems depending on their time horizon. This includes the day trading timeframe, the swing trading timeframe, and the long-term position trading timeframe. Let's look at each type in detail.
Mechanical day trading system
Day trading systems are top-rated in the futures markets, especially stock indices such as the S&P 500, NASDAQ 100, and Dow Jones 30. Due to their vast daily volume and intraday volatility, these markets are an excellent place for mechanical trading methods. An automated intraday trading system tends to hold positions from a few minutes to the end of a trading session, which can last several hours or more. Major Forex pairs also make a good fit for day trading.
When choosing market viability for intraday trading purposes, it’s important to consider market volume, average daily range, and transaction costs, which come in the form of spreads between bid and ask prices and commissions. Optimal day trading markets will offer a high level of market participation and should have sufficient volatility for a trader to take advantage of intraday price swings. In addition, spreads should be very tight, preferably with a one tick spread in most cases. This will allow you to overcome the average friction associated with trading on smaller timeframes.
Mechanical swing trading system
Different traders understand the swing trading system differently. Traditionally the swing trading method refers to holding positions from a few days to a few weeks. Swing trading systems generally provide a much better ratio of the average win to average transaction value than most day trading systems. This is because when we can hold positions for a more extended period, we get an opportunity to make more profit from trade while keeping transaction costs relatively low.
Some traders find that switching from day trading to swing trading without initiating additional adjustments can sometimes turn a losing or breakeven system into a relatively profitable one. Automated swing trading systems are quite popular in the Forex market.
More popular swing trading pairs include EURUSD, GBPUSD, USDJPY, EURJPY, and GBPJPY. These instruments are liquid and volatile currency pairs that lend themselves well to various swing trading methods. Besides, they can often be translated into an automated Forex trading system.
Mechanical trend following system
Trend-following systems tend to work best at higher timeframes. In particular, trend-following strategies based on weekly data outperform most other timeframes. By its very nature, an automated trend-following system seeks to recognize an emerging trend, jump on board, and stay with it for as long as possible. Thus, many trend-following systems typically hold positions for weeks to months.
Mechanical trading systems based on this trend-following approach were popularized in the 1970s and 1980s by legendary traders such as Larry Williams, Bill Eckhardt, and Richard Dennis, to name a few. Trend-following systems can work well in many different sectors such as energy, metallurgy, finance, and agricultural products. They are widely used on Forex as well. As long as catalysts create an imbalance between supply and demand, those who follow the long-term trend will have opportunities to take advantage of price movements.
How to create a mechanical trading system
Your own system can be as simple or as advanced as you like. The important thing is that you can adapt it to your situation and needs. The development process should contain the following general steps:
Step 1: Choosing a timeframe
Step 2: Defining login rules
Step 3: Defining exit rules
Step 4: Backtesting
Step 1: Choosing a timeframe
First, choose a price timeframe for your system: M1, M5, M15, M30, H1, H4, or D1. It’s preferable to choose only one of these timeframes instead of trying to work your system on all of them.
As a rule, the shorter the timeframe, the lower the average profit per trade, and the greater the number of trades. You decide which timeframe is the best for you. For example, a day trading professional may trade on the 5-minute chart, but someone who can only access the trading screen once a day may prefer the daily chat.
So, let’s consider a trading strategy called “Red Dragon”. It requires the H1 timeframe.
Step 2: Defining the logic rules
There are millions of different entry rules, but all of them are divided into two large groups: trend-following rules and reversal rules.
Trend-following systems attempt to capitalize on the established trend in the market. These systems usually include trend indicators such as Moving Averages (MA) and Average Directional Index (ADX). Reversal systems, on the other hand, try to detect a change in market direction and get an advantage from it. Oscillators such as RSI and Stochastic are often used here. Compared to trend following systems, reversal systems tend to have shorter trade durations and more trades. As a result, reversal systems suit traders that are more active.
“Red Dragon” is a trend strategy. It relies primarily on EMA (Exponential Moving Average) and Parabolic SAR. The Awesome Oscillator is used as an additional indicator.
List of indicators:
- ЕМА (14, high)
- ЕМА (14, low)
- Parabolic SAR (0.01, 0.2)
- Awesome (default settings)
The rules for opening a BUY trade include:
- The candlestick broke the upper border of the channel and closed higher.
- The dots of Parabolic SAR are below the price.
- Histogram of the Awesome Oscillator crossed the zero line to the upside.
Step 3: Defining exit rules
Now that you are in a trade, you need to define the exit rules. There are two general rules you need: a Stop Loss rule to protect your capital and a Take Profit rule to make a profit.
To choose a place for a Stop Loss, you’ll need to decide what’s the maximum amount of your deposit you are willing to risk in a single trade. There are several options:
- Fixed amount of money, example: $20.
- Percentage of capital, example: 5% of funds.
- Percentage of the current price, example: 1% of the entry price.
- Percentage of volatility, example: 100% of the average daily movement.
- Time, example: leaving in 3 days.
- Chart Stop Loss, example: below the MA.
Going into detail, you can combine these methods. You can set a Stop Loss order at 1% of capital, a Take Profit order at 3% of the entry price, and a time rule to close the trade in two days if none of the orders are triggered.
In our strategy, Stop Loss is set below the previous local low. Take Profit is put in a trend and can be three times bigger than the Stop Loss. You can combine this exit strategy with the percentage of capital rule. In this case, you need to determine what size of Stop Loss your account size allows.
Step 4: Backtesting
Now that the rules of a mechanical trading system are well defined, it’s necessary to check if it’s a good one. You will be able to make some conclusions about the system’s quality if you test it on historical data.
When you backtest your strategy, make sure you observe its performance over a sufficient time and under different market conditions like trends or ranges.
There are two types of backtesting: manual and automated. Programs such as Expert Advisors (EAs) that open and manage trades for you when certain technical conditions are met perform automated backtesting. To create an Expert Advisor, you’ll need the MQL4 programming language and syntax knowledge. As a result, simpler and more reliable manual testing may be the best solution in many cases.
Manual backtesting of a trading strategy
1) Open the chart of the currency pair you want to test your strategy on. It’s better to analyze one pair at a time. If necessary, you can backtest on another pair later. Apply the necessary indicators and tools to the chart. Scroll the chart to the previous period.
2) Check the chart for setups that match the strategy you are testing.
3) After finding a trade setup based on your trading strategy, write down the details of a potential past trade. You must enter the date, entry point, Stop Loss, Take Profit and any other information you deem necessary.
4) Repeat the process until you find another possible trade setup and then return to the third step.
Once you have the results of the potential trades recorded (we recommend using Excel), it’ll be easy to calculate the win rate of a trading strategy.
If you find that your strategy is poorly performing when backtested, consider changing one variable at a time based on your observations until you have a profitable strategy.
Manual testing of a trading strategy on historical data takes time and discipline. However, if it’s done correctly, it’ll give you a good idea of the strategy’s success rate. Remember that you test the system to ensure that your trading will be good. In addition, manually testing against historical data will help you better understand the market and allow you to practice identifying entry and exit levels. Finally, the best practice after the manual backtesting is to test a strategy on a demo account. You’ll see how the trading system performs in a real market environment.
Advantages of mechanical systems
The main advantage of mechanical systems is that they eliminate emotions by automatically giving signals. Emotions get in the way of most traders. The mechanical system takes away most of the feelings.
Additionally, many traders lose money in the markets due to a lack of discipline. A mechanical system makes it easier to apply discipline because all you need is a commitment to follow the system. A well-defined mechanical system usually provides more consistency than a system in which a trader makes buy and sell decisions randomly.
Moreover, systems allow trading with greater confidence. If you have thoroughly backtested your system, you can be sure that your trading will be profitable and sustainable in the long run. So fewer sleepless nights worrying about an open position.
The last, mechanical systems are usually designed to trade with the trend, which is a lower risk trading method. They will always allow profits to run in the event of a strong trend and resist the temptation to take profits early.
Disadvantages of Mechanical Systems
The first disadvantage of the mechanical trading system is that it can’t adapt to unique market conditions. Such systems will allow you to stay more disciplined and emotion-free in the markets due to the automatic nature of the trade signals. This is an obvious advantage, as described earlier. However, the inability of a trading system to think and adapt to unique market conditions can also be a disadvantage. For the most part, trading activity in the market is normal. Still, there are certain instances, especially during black swan-type events, when human logic and critical thinking are more appropriate.
The second drawback is that a mechanical trading system can be over-optimized. Traders need to be very careful when they review test results. Hypothetical results can sometimes look great on paper. However, the same system will often perform poorly in actual market conditions in the future. That leads to many system traders falling into the trap of over-optimizing their system to find the best parameters or create the best trading system. This often leads to the accidental creation of a curve fitting system that only demonstrates the effectiveness of a strategy on historical data and may be practically useless in real life.
Finally, a trader needs to closely monitor the mechanical trading system to ensure everything runs smoothly. In other words, since there are so many different moving parts that need to work without failure, there's an additional risk of one of these components failing, which could cause the entire system to crash.
Mechanical systems are great for eliminating the emotions that cause many traders to fall.
They especially suit those who don't have time to read all the information and/or feel overwhelmed. However, they may be useless for those who like to participate in trading and look for trade ideas independently.
Still, the real key to sustainable system trading profits lies in learning computer research to create your reliable system. Finding a working system requires a lot of practice and learning, but the potential profit and satisfaction, in the end, is quite a motivator.
MetaTrader 4, also known as MT4, is the world’s most popular trading platform. It offers excellent trading and analytical tools to implement even the most complex strategies.
Doji candles are rare birds, but if you catch them, it can be a great chance to seize the right entry moment. This article will discuss what a Doji candle is. You will also get a Doji strategy that can bring profit.