Trading System Development

The following section describes the main objectives, the trading plan, and the scientific journey that was taken to develop the final version of the automated trading system. In order to develop a robust trading strategy it is necessary to have a detailed background information and investigation that will support this strategy. For this project specifically, the detailed background information is described in a previous section. The final strategy can be a compilation of different strategies that have been done separately or a simple strategy that has been developed according to the necessities and requirements of the trader. The final strategy in this section started as a simple strategy and has been modified to make it more robust, always keeping in mind the aspects of the group’s trading plan. The changes made to the original strategy have been done to fix issues the strategy presented during the trading experience.

System’s Objectives and Trading Plan

The first step that was taken to start developing the trading system was defining its objectives and goals. It was decided to set up a goal that was challenging but realistic, one that would be attractive to potential clients and investors. For this project, it was defined that an appealing annual rate of return would be 8%. With this said, the goal of each member of the group would be to generate a monthly return of 0.67%. Each group member received a TradeStation simulated account with $100,000 of initial investment capital; so each person should focus on having a monthly net income of $670. The group had a total initial investment capital of $400,000, and the goal was to generate eight percent return per year, which is $2,680 per month as a group. One crucial factor to determine the profit or losses of a system is position sizing. As a group it was decided not to use leverage for this project. Even though with the use of leverage, at a 50:1 ratio, each person in the group would have the ability to invest up to $5 million in the forex market, just as the potential profits would be heavily increased, the chances of getting wiped out severely increased as well. Since it was the first time most members of the group were trading, using leverage meant a potential hazard. It was decided to be a little conservative and every individual would use a fixed position size of $50,000 per trade, fifty percent of the of the initial investment capital of each member.

An important part of the objectives of a trading system is defining the maximum drawdown. One of the goals of the strategy was to have a low drawdown. Many customers get scared away with strategies that have a high draw-down tolerance, so it was decided to set the maximum monthly drawdown to $1,000 per account (one percent of initial capital); in this way, reducing the risks of getting wiped-out.

It is crucial for any person attempting to trade to realize that it is a very time consuming business. In order to create a system that fits one’s trading personality, it is important to realize how much time one has available for trading. As college students, it should be considered that the time availability for trading may be low. With this said, this trading system was designed for a low time commitment. Even though it is an automated trading system, this does not mean that one can simply activate it and expect to come back after one month and see everything working perfectly with huge profits. With an automated trading system one still needs to be attentive to everything going on in the news, especially when there is an open position, since the robot computes exactly what the code states, without knowing if any important events occur or if there are news releases that may severely affect these positions. Robot trading requires the trader to be monitoring the trades and making sure everything is running correctly. The objective of the system was to have a low time commitment, making between two to four trades per week, and hold positions for only about one day. In this way, the trader does not have to be every day, all day in front of the computer, but only a couple of times per day whenever there is a position open, monitoring how the system is performing.

As it was previously mentioned, each person had $100,000 of initial investment capital in their account, and it was decided that each individual should trade a different currency pair. The distribution of currency pairs are as follows: Antonio EUR/JPY, Mauricio EUR/USD, Paolo AUD/USD, and Steven GBP/USD. The reason that these four currency pairs were chosen is that they have volatility and a huge volume of trades. This is important since one needs the market to be in motion in order to be able to make profits. Each member of the team will use the same automated trading system; however, the parameters that will be used are different, according to what fits best for the specific currency pair that was assigned.

Development of the Strategy

In order to develop an automated trading strategy, one has to start from a basic automated strategy and take several steps to make it more robust and profitable. In each of these steps, one needs to identify what are the strategy’s strengths, weaknesses, and needs, and with this information, add new or modify existing features to make it stronger. In the following section, the scientific journey that was taken to develop the final trading strategy will be described step by step. It is important to know that all the strategies shown below have the same bar length (60 minute bars) and they all entered the trades with a fixed position sizing of $ 50,000.

Step by Step Development of the Final Strategy

Listed below are the strategies that were constantly optimized and modified in order to reach the final strategy that fitted the group’s objectives. The processes of developing the final strategy consisted on starting from a very basic strategy and with small steps make it more complex and robust.

Double EMA Cross I (entries and exits at market price)

As the name indicates, this strategy is based on the crossing of two exponential moving averages (EMAs). The values for these EMAs were determined with optimization feature in TradeStation according to what was best for each currency pair. For the fast EMA, the range of values that were optimized was between 2 and 12 bars. For the slow EMA, the range of values that were optimized was between 12 and 30 bars. There was not a constant value for these EMAs because every currency pair had better results using different values. They way this strategy worked was, every time there was a cross between these two EMAs a fixed $50,000 position was entered. If the fast EMA crossed over the slow EMA, the strategy had to buy long at the market price at the next bar; on the other hand, if the fast EMA crossed under the slow EMA, the strategy had to sell short at the market price at the next bar. This strategy was a “Stop and Reverse” because it never exited the market; every time the two EMAs crossed the strategy entered the market, and when the EMAs crossed in the opposite direction, the strategy exited the positions and immediately entered the market in the opposite direction. This strategy had a high drawdown and low profits because it was not able to identify the wrong crossovers. The wrong crossovers are the ones that, as shown in figure 30, signal the robot that it is time to enter a position in a specific direction, but suddenly after a few bars, another crossover occurs in the opposite direction.

Figure: Example of a wrong crossover

Double EMA Cross II (entries and exits at highest-highs and lowest-lows of previous bars)

This strategy was based on the previous basic strategy. However, in this strategy an extra condition to enter or exit a position was included. In order to enter or exit the market, this robot was required to only enter or exit the market when the EMAs crossed and the price reached the highest high or lowest low price, respectively, of a predefined number of bars back. In more detail, for buying long it had to buy it at a higher price compared to the highest high from a predetermined number of previous bars; for selling short it had to sell it at a lower price than the lowest low from a specific number of previous bars. These conditions helped the strategy to enter a position one bar after the EMAs crossed, and trying to only enter the position if the market was still going in the same direction.

Figure: Example of entry at a Lowest-low

Figure 31 shows how the crossover and the lowest-low conditions are met, meaning that a position would have been entered, and in this case, selling short. This strategy was still stop and reverse since the entry parameters were the same as the exit parameters.

Double EMA Cross III (entries and exits at highest-highs and lowest-lows of previous bars, exits when profit target and maximum loss stops)

This strategy is based on the previous strategy and adds two extra conditions for the exits: a profit target and a stop loss. This means that when the strategy opens a position based on the EMA cross and highest-highs or lowest-lows conditions, it is going to close this position when one of these conditions is first met: there is a cross in the opposite direction, the profit target has been reached, or the maximum loss condition has been met. Adding these two conditions to exit a position gives the strategy more concise conditions to exit a position, doing it after reaching the desired profit or a maximum loss. With these conditions, the back-tested equity curve became smoother, avoiding the huge loses and also getting out of the market when a profit target that is defined by the trader is met. This strategy helps reduce the risk of getting wiped out or loosing clients due to large drawdowns. Each trader in the team optimized the profit target and stop loss values according to what fitted best with the specific currency pair; the optimization ranges were between $100 to $1,000 for profit target and $100 to $500 for stop loss amount.

Double EMA Cross IV (entries and exits at highest-highs and lowest-lows of
previous bars, exits with trailing stops and maximum loss stops)

This strategy replaces the profit target component of the previous strategy with a trailing stop profit target. A trailing stop is simply a stop order that is generated when the position reaches a predefined profit value, and the exit will execute after the market price reaches a trailing percentage below the target price. If the profit keeps incrementing, so does the price for the exit, which always stays the determined percentage below the highest profit after reaching the initial target. Using this condition to exit the market helps to keep a position open for some time after the profit target is reached only if the price is going in a profitable direction, the position is exited the price begins to go in the opposite direction to prevent a potential loss. The decision for the final strategy was made between percentage trailing stops, and profit targets. Trailing stops showed to be more profitable according to back-testing results.

Double EMA Cross V (entries and exits at highest-highs and lowest-lows of previous bars if above or below 50 EMA, exits with trailing stops and maximum loss stops)

The results obtained by the previous strategy were very concise and met to objectives that the strategy was set to. Despite the results of this strategy, it was necessary to add an extra condition to the strategy to make it more robust. Exiting the positions were not an issue anymore with the trailing stops for profit target and the maximum loss stop. The problem at this point was how the entries were made. The approach taken to overcome this challenge was to add a condition, now in order to enter a market the price had to be greater (to buy long) or smaller (to sell short) than the EMA50. The EMA50 by itself is a good long term trend indicator, and this compared to the market price helps to prevent entering the market in the wrong direction. By adding this condition the results showed a more robust strategy that entered the market in the right moments, but it had less profit than the previous ones. Here there is a tradeoff, even though total profit is reduced, the percentage of wining trades versus losing trades is considerably higher and the strategy is more protected against entering a position against the long term trend.

Double EMA Cross VI (entries and exits at highest-highs and lowest-lows of previous bars if above or below 50 EMA and slope, exits with trailing stops and maximum loss stops)

This strategy adds an extra entry condition to the previous strategy. The robot only enters a trade if the EMAs cross in the same direction as the slope of the 50 EMA. The addition of the slope of the EMA50 makes more concise entry decisions, this because a position will be opened only if the trend of the market is going in the same direction of the EMA50. This may sound very trivial, but having support from the EMA50 to enter the market makes difference. The EMA50 means that the exponential moving average is applied to 50 bars back, so having the EMA50 trending in the same direction of the other two EMAs is a signal that the trending is strong enough to enter the market. The inclusion of the slope of the EMA50 was done as a separate condition from the other two EMAs because this is a very slow EMA that shows a long period of time trend, on the other hand the other EMAs show short time changes in momentum.

Additional Strategy (Double EMA Cross, entries and exits at highest-highs and lowest-lows of previous bars, exits with trailing stops and maximum loss stops, and extra entries at big momentum changes determined by opening and closing price changes)

This strategy was not used by all the members of the group, since it was only an experimental strategy. When the strategy was not in the market, waiting for another cross to happen, there were big momentum changes that were missed because the two EMAs did not cross due to the fact that price was only going in one direction. To see what happened when the strategy took advantage of these chances this new condition was included, to enter the market if the pip difference in the previous three bars was big enough to do so. This strategy had a great profit, but it was in the market almost all the time and also had some big losses because of entering too much to the market. The reason why this strategy was not considered for the development of the final strategy was because the number of trades that this strategy was doing and the risk involved in it did not fit the group’s objectives.

Backtesting Performance of Previous Strategies

The following section shows four tables that illustrate the performance of each of the old strategies that were developed in the process of arriving to the final robot applied. This results show the performance of each strategy applied to the specific currency pair of each trader in the team. All of these strategies were backtested since February 1, 2012, in order to obtain a significant comparison of the performance of each. It is important to notice how in most of the cases the total profit, profit factor, and the percent of profitable trades increased as one goes from a simpler strategy to a more complex one; on the other hand, the total number of trades gets smaller as the strategies get more sophisticated, getting closer to the objectives of the group. For a more detailed report on the performance, the equity curves, and parameters of each strategy see Appendix B.

Leave a Reply

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