0% found this document useful (0 votes)
101 views33 pages

Ema Macd Forex

The document describes an optimization of an exponential moving average (EMA) and moving average convergence divergence (MACD) trading strategy for trading foreign exchange currency pairs. The objective is to optimize the trading strategy parameters to maximize profits for the EUR/USD, GBP/USD, and USD/JPY currency pairs using 15-minute interval data. The methodology section describes how the trading strategy will be implemented, optimized, and evaluated based on metrics like total profit, compound annual growth rate, maximum drawdown, and Sharpe ratio.

Uploaded by

Ap Pawar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
101 views33 pages

Ema Macd Forex

The document describes an optimization of an exponential moving average (EMA) and moving average convergence divergence (MACD) trading strategy for trading foreign exchange currency pairs. The objective is to optimize the trading strategy parameters to maximize profits for the EUR/USD, GBP/USD, and USD/JPY currency pairs using 15-minute interval data. The methodology section describes how the trading strategy will be implemented, optimized, and evaluated based on metrics like total profit, compound annual growth rate, maximum drawdown, and Sharpe ratio.

Uploaded by

Ap Pawar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

Optimization of Exponential Moving Average (EMA) and Moving

Average Convergence Divergence (MACD) trading strategy on

Trading Foreign Exchange

Nicholas Christanto
Year 3, Interdisciplinary Programs Office

COMP 4971C - Independent Work


Spring 2021

Supervised By:

Professor David Rossiter

Department of Computer Science and Enginneering

1
Contents

1 Introduction 4

1.1 Foreign Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

1.1.1 Common Foreign Exchange Pairs to be Analyzed . . . . . . . . . . . . . . . . . . . . . 4

1.2 Foreign Exchange Trading Terminologies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

1.2.1 Risk-ro-reward Ratio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

1.2.2 Market Order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

1.2.3 Limit Order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

1.2.4 Take Profit Order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

1.2.5 Stop Loss Order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

1.2.6 Lot Size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

1.3 Technical Indicators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

1.3.1 Exponential Moving Average . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

1.3.2 Moving Average Convergence Divergence . . . . . . . . . . . . . . . . . . . . . . . . . 8

1.3.3 Relative Strength Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

1.3.4 Average True Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

1.3.5 Moving Average Difference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

1.4 Exponential Moving Average and Moving Average Convergence Divergence trading strategy . 11

1.5 Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

2 Methodology 13

2.1 Data collection and Software Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

2.2 Initial Capital and Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

2.3 Trading Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

2.3.1 Trading Signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

2.3.2 Market Friction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

2.4 Optimization Algorithm Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

2.5 Result Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

2.5.1 Total Profit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

2.5.2 Compound Annual Growth Rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

2.5.3 Maximum Drawdown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

2.5.4 Sharpe Ratio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

2
3 Results Interpretation 19

3.1 EUR/USD 15-minute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

3.1.1 Optimization Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

3.1.2 Performance Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

3.2 GBP/USD 15-minute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

3.2.1 Optimization Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

3.2.2 Performance Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

3.3 USD/JPY 15-minute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

3.3.1 Optimization results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

3.3.2 Performance Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

4 Concluding Remarks 30

4.1 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

4.1.1 More currency pairs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

4.1.2 Optimizing the technical indicators parameters . . . . . . . . . . . . . . . . . . . . . . 30

4.1.3 Using K-Nearest Neighbors (KNN) algorithm . . . . . . . . . . . . . . . . . . . . . . . 30

4.1.4 Taking trading time zones into consideration . . . . . . . . . . . . . . . . . . . . . . . 30

3
1 Introduction

1.1 Foreign Exchange

Foreign Exchange or Forex (FX) refers to the global electronic marketplace for trading foreign currencies

and currency derivaties. Despite the fact that there is no central physical location, the forex market is the

largest and most liquid market in the world in terms of trading volume, with billions of dollars changing

hands every day[14]. The majority of the foreign exchange trading takes place through banks, brokers, and

financial organizations.

The forex market is open 24 hours a day, five days a week, starting from Monday to Friday. The foreign

exchange market is open on many holidays when the stock exchanges are closed, albeit trading volume is

likely to be reduced. There are three sessions for trading foreign exchange which are the Europoean, Asian,

and United States trading sessions. The main currencies in each market are traded mostly during their

respective market session.

Currency trading is done in pairs which means that the market requires traders to buy one currency

and sell another. Following that, practically all currencies are valued to the fourth decimal point. A pip of

percentage in point, is the smallest increment of trade. One pip is usually equivalent to 1/100 of one percent.

Most currencies are priced out to the fourth or fifth decimal point. Except for currency pairs that include

the Japanese Yen (JPY) as the quote currency, the pairs are typically price out to two or three decimal

places, with one pip being the second decimal place

Currency is traded in various lot sizes. A micro-lot is one thousand units of a currency. If the account’s

base currency is US Dollar, then a micro lot represents $1,000. A mini lot is 10,000 units of the base currency,

whereas a regular lot is 100,000 units [15].

There are multiple trading strategies for trading currencies, mainly technical and fundamental. This

study focuses on technical trading strategies which utilizes technical indicators.

1.1.1 Common Foreign Exchange Pairs to be Analyzed

This study selected three of the most common currency pairs based on volume traded:

1. EUR/USD: Euro against US Dollar and commonly referred as the euro-dollar.

2. USD/JPY: US Dollar against Japanese Yen.

3. USD/GBP: US Dollar Against United Kingdom pound and commonly referred as the pound-dollar.

4
These three currency pairs are taken from about 18 currency pairs that are conventionally quoted by foreign

exchange market makers due to their representation of the majority of the trading volume in the foreign

exchange market [16].

1.2 Foreign Exchange Trading Terminologies

1.2.1 Risk-ro-reward Ratio

The risk-to-reward ratio (RR) denotes the potential return a trader might gain for the risk the trade carries.

Many traders utilize RR to evaluate the trade’s predicted return with the amount of risk required to attain

those returns. For example, a trade with risk-to-reward ratio 1:2 indicates that the trader is ready to risk

USD$1 in exchange of the possibility of earning USD$2 [11].

In this study, multiple RR such as 1:1, 1:2, 1:3, 1:4, and 1:5 were studied to find the most profitable

ratio for the trading strategies.

1.2.2 Market Order

A market order is an instruction given to a broker by an investor to buy or sell assets such as currencies at

the current price [6].

1.2.3 Limit Order

A limit order is a form of order that allows investor to buy or sell assets such as currencies at a specific price

or better. Although there is a possibility that the purchase may not go through if the price never reach

the threshold price. Buy limit orders will be executed only at the limit price or a lower price, but sell limit

orders will be executed only at the limit price or a higher price. This condition allows traders to have more

control over the pricing at which they trade [13].

1.2.4 Take Profit Order

A take profit order (T/P) is a kind of limit order that specifies the precise price at which an open position

should be closed for a profit. If the security’s price does not reach the limit price, the take profit order will

not be initiated. For a buy position, the take profit order will close or sell the position. While for a sell

5
position, the take profit order will close or buy the position. Moreover a take profit order should be higher

than the trading price for a buy position and lower for a sell position [3].

In this study, the take profit price is determined by multiplying the distance between the trade price

and stop loss price with the risk-to-reward ratio .

1.2.5 Stop Loss Order

A stop loss order (S/L) is a kind of limit order where a broker purchases or sells an asset at a predetermined

price. A stop loss order is intended to restrict an investor’s loses on an asset holding. A stop loss price

should be lower than the trading price of a buy position. In contrast, a stop loss price should be higher than

the trading price of a sell position. Similar to the take profit order, a stop loss order will close or sell a buy

position and close or buy a sell position [17].

In this study, the stop loss price is determined using the Average True Range which will be further

explained in the Methodology section.

1.2.6 Lot Size

As mentioned in the Foreign Exchange section, lot sizes are a measurement of trade size when trading foreign

exchange. To further understand the impact of lot sizes to a trade, an example is introduced. Let’s assume

the EUR/USD pair is currently trading at 1.1930. This means that to to buy 1 European Euro, 1.1930 US

Dollar is needed. Another thing to note is that the price movement is measured with pips. For EUR/USD

pair, 1 pip is equal to 0.0001. In this example, a trade with standard (100,000 units) lot size takes place.

Next, the value per pip can be calculated as:

P ip
V alue P er P ip = ∗ Lot Size
T rading P rice

In this example, the value per pip for EUR/USD trading at 1.1930 is:

0.0001
∗ 100, 000 = 9.99734
1.1930

This means that every pip is associated with USD$9.99734 or rounded up to USD$10 per pip. Based on the

equation, the lot size determines the value per pip. Hence, it is important to always take the lot size into

consideration when making a trade. Although bigger lot size can bring bigger profit from smaller movement,

6
at the same time, it can also bring bigger loss.

Calculating lot sizes may not be needed depending on the broker used for trading forex. For example,

interactive broker trading platform does not require any lot size calculation considering that the input for

order size is in the currency itself (refer to Figure 1. Label (a)). However, it is a different case for trading

in MetaTrader trading platform where traders need to input the specific size of lot size (volume)(refer to

Figure1. Label(b)). Therefore, the importance of lot size calculation depends on the platform used to trading

[1].

(a) Interactive Broker order panel (b) MetaTrader order panel

Figure 1: Comparison between Interactive Broker order panel and MetaTrader order panel

In this study, the lot size depends on the amount of risk per trade as well as the gap between the

trading price and the stop loss price. More explanation is given in the Methodology Section.

1.3 Technical Indicators

Technical indicators are heuristic or pattern-based signals generated by the price, volume, and/or open

interest that are used by traders in applying technical analysis. Traders utilize the signals to forecast future

prices changes by evaluating previous data.

Any security with previous trading data can be subjected to technical analysis. This compromises

stocks, futures, commodities, fixed-income securities, currencies, and other financial instruments.

There are two basic types of technical indicators which are overlays and oscillators. Overlays are

technical indicators that utilize the same scale as prices are displayed on top of the prices. In this study, ex-

ponential moving average is an example of overlay indicators. Moreover, oscillators are technical indicators

that swing between a local minimum and maximum. Moving Average Convergence Divergence, Relative

Strength Index, Average True Range, and Moving Average Difference are examples of oscillators [4].

7
1.3.1 Exponential Moving Average

Exponential Moving Average (EMA) is a type of moving average (MA) that gives the most recent data points

more weight and relevance. The exponential moving average, also known as the exponentially weighted

moving average, responds more strongly to recent price changes than a simple moving average (SMA), which

gives equal weight to all the data points in the specified period. Traders often use several different EMA

period lengths, such as 10, 50, and 200. This indicator is usually used as a trend indicating indicator where

when the price is above the EMA, it shows an uptrend and when the price is below the EMA, it indicates a

downtrend [2].

The formula to calculate the EMA of a specific time:

Smoothing Smoothing
EM ACurrent = (V alueCurrent ∗ ) + EM AP revious ∗ (1 − )
1 + P eriodLength 1 + P eriodLength

where:

Smoothing = most common choice is 2[2]. The bigger the smoothing factor the more relevance is given to

the recent data points.

Figure 2: EMA and SMA example from Investopedia

1.3.2 Moving Average Convergence Divergence

Moving Average Convergence Divergence (MACD) is a momentum indicator that displays the relationship

between two moving averages of a currency’s prices. There are two lines in this indicator, MACD line and

signal line. The MACD line is derived by subtracting the 26-period EMA from the 12-period EMA, while

8
the signal line is the 9-period SMA of the MACD line.

M ACD Line = 12P eriod EM A − 26P eriod EM A

Signal Line = 9P eriod SM A of the M ACD line

The most common trading strategy associated with this indicator is the MACD crossover where when the

MACD line crosses above the signal line and both line values are below zero, it indicates an uptrend. On

the other hand, when the MACD line crosses below the signal line and both line values are above zero,

it indicates a downtrend [7]. In this study, MACD and EMA are used as a the control group due to its

popularity among traders.

Figure 3: MACD example from Investopedia

1.3.3 Relative Strength Index

Relative Strength Index (RSI) is a momentum indicator used in technical analysis that examines the mag-

nitude of recent price fluctuations to determine if an asset is overbought or oversold. The RSI is shown as

an oscillator and has a range of 0 to 100. Although the traditional interpretation of RSI is to determine

reversals, RSI can also be used to identify the general trend. When the RSI value is under a certain value,

it indicates a downtrend, while when the RSI value is above a certain value, it indicates an uptrend. In this

study, RSI is used as an additional trend confluence when trading the EMA and MACD trading strategy.

Moreover, when the RSI value is below a certain number it is better to not sell due to the oversell condition

and vice versa [19].

The RSI calculation requires simple computing. However the it is difficult to explain without pages

of example. Hence, the shown formula is in its basic form [8]. The basic formula to calculate the RSI of a

specific time:

9
100
RSI = 100 − Average of U pward P rice Change
1+ Average of Downward P rice Change

Figure 4: RSI example from Investopedia

1.3.4 Average True Range

Average True Range (ATR) is a technical analysis indicator that quantifies market volatility by dissecting

an asset’s entire price range for a certain amount of period. In this study, ATR is used as an additional

volatility confluence to the EMA and MACD trading strategy which means that at times it is better to not

trade when the volatility is above a certain value due to uncertainty and at the same time to not trade when

the volatility is below a certain value due to the market being in consolidation [10].

The ATR formula is:

T R = M AX[(P riceHigh − P riceLow ], Abs(P riceHigh − P riceCurrent ), Abs(P riceLow − P riceCurrent )]

P eriodLength
1 X
AT R = ( )∗ T Ri
P eriodLength i=1

10
Figure 5: ATR example from Investopedia

1.3.5 Moving Average Difference

Moving Average Difference (MAD) is a technical indicator that is quantified by the difference between the

EMA and Close price at a certain time. The intuition is related to mean reversion, often known as reversion

to the mean, which is a finance theory that proposes that asset price, volatility, and historical returns will

eventually revert to the long-run mean or average of the whole dataset. Therefore, when the Moving Average

Difference value is low, it can be inferred that the market is in consolidation. On the other hand, when the

Moving Average Difference value is high, price tends come back to the moving average.This indicator is used

as an additional confluence to the EMA and MACD trading strategy where the value of the Moving Average

Difference should be between certain values for a trade to be made [5].

The formula for finding the Moving Average Difference is as follow:

M AD = Abs(P riceClose − 200P eriod EM A)

1.4 Exponential Moving Average and Moving Average Convergence Divergence


trading strategy

There are multiple versions of this trading strategy. However, in this study, the combination of 200-period

EMA and MACD with default setting (12,26,9) is evaluated. Buy signal is created when the MACD line

crosses above the Signal line while at the same time, price closes above the 200-period EMA. On the other

hand, a sell signal is generated when the MACD line crosses below the Signal line and the price closes below

the 200-period EMA.

The reason why this trading strategy is chosen for this study is because of its popularity, yet not con-

11
vincing methodology [12]. Many traders try to prove the profitability of this trading strategy by backtesting.

Most of them only backtested 100 times and seldom takes into account the market friction such as spread and

commission fee. Because of this, I was inspired to test it myself and propose additional technical indicators

that can be used to improve the results.

1.5 Objective

The aim of this study is to develop an optimization procedure for the parameters of Relative Strength

Index, Average True Range, and Moving Average Difference based on historical data from 2010 to 2016 as

additional confluences to the Exponential Moving Average and Moving Average Convergence Divergence

trading strategy. The reason why this specific trading strategy is chosen is because of its vast popularity. Its

simple setup and signal conditions makes this strategy suitable for beginners. Hence, this study is developed

to produce quantitative proof for this strategy’s worth. To evaluate the performance of the additional

confluences, the trading strategies proposed is tested on the three chosen currency pairs in term of their

excess annual return from 2017 to 2021.

12
2 Methodology

2.1 Data collection and Software Framework

In this study, all historical prices of EUR/USD, USD/JPY, GBP/USD pairs were gathered from MetaQuotes

Software Corp History Center in MetaTrader4 trading platform. The data were retrieved on a 15-minute

time frame basis, which compromises open, high, low, close, and volume of the currency pairs. The data was

gathered from January 1, 2010 to December 31, 2021.

Python data science libraries such as Pandas and NumPy are used for developing and executing trading

strategies. Plotly library is used for visualization. Lastly, TA-lib library is used to obtain technical indicators

values including EMA, MACD, RSI, and ATR. Since MAD is not available in TA-lib, it is calculated using

Pandas and Numpy.

2.2 Initial Capital and Parameters

The initial capital in this study is USD$10,000.

For the technical indicators, default values are used except for EMA.

1. Exponential Moving Average: 200-period

2. Moving Average Convergence Divergence: 12-period fast, 26-period slow, 9-period signal

3. Relative Strength Index: 14-period

4. Average True Range: 14-period

5. Moving Average Difference: 1-period

The timeframe used in this study is the 15-minute timeframe. The risk-to-reward ratio studied are 1:1, 1:2,

1:3, 1:4, 1:5.

2.3 Trading Rules

2.3.1 Trading Signal

Exponential Moving Average and Moving Average Convergence Divergence As mentioned in

the introduction section, the trading strategy that is going to be studied is the Exponential Moving Average

and Moving Average Convergence Divergence. The trading strategy includes setting the buy signal, sell

signal, take profit price, stop loss price, and lot size.

13
The buy signal is generated when the price closes above the 200 EMA, the MACD line crosses above

the signal line, and the signal line value is below zero. Firstly, 200 EMA is used as a trendline, when the price

closes above the 200 EMA, it generally indicates that price is going on an uptrend. Moreover, the MACD

crossover is a popular strategy that indicates the change of momentum. When the MACD line crosses above

the signal line, it indicates the momentum has changed from downtrend to uptrend.

On the other hand, the sell signal is generated when the price closes below the 200 EMA, the MACD

line crosses below the signal line, and the signal line value is above zero. When the price closes below the

200 EMA, it generally shows that the current trend is a downtrend. When the MACD line crosses below the

signal line, the price tends to change from uptrend to downtrend.

In this study, the risk management includes quantitatively determining the stop loss price, take profit

price, and lot size.

The stop loss of every trade is based on the value of multiplying the ATR value by two. Since ATR

indicates the volatility of the price, setting the stop loss distance based on ATR is an objective approach.

For a buy trade, the stop loss is determined by adding the value of ATR * 2 to the close price. For a sell

trade, the stop loss is determined by subtracting the close price by the value of ATR * 2.

The take profit price will be based on the RR values and the stop loss distance. The stop loss distance

is determined by the ATR * 2. The RR values studied in this class is 1:1, 1:2, 1:3, 1:4, and 1:5. For a buy

trade, the take profit price is determined by adding the value of ATR * 2 * RR value to the close price. In

the backtesting process, each trade will have five different take profit prices tested independently, meaning

that in this study, it can be assumed that there are five different accounts where each account will only use

one RR value during the whole backtesting.

In forex trading, it is a good habit to determine the risk per trade which is the amount of capital risked

every trade. A good number is 2% of the initial capital [9]. By having the amount of capital to risked each

trade, the appropriate lot size can also be determined. In an ideal environment where there is no market

friction, the profit gain percentage is determined by the risk per trade times the RR value. This means that

a trade with RR value 1:2 can gain 4% increase of the initial capital or lose 2% of the initial capital.

To further understand the calculation of lot size an example is given. Assume the initial account is

$15,000. Each trade will risk 2% of the initial account, which is $300. Moreover, the ATR value is 10 pips

which put the stop loss distance at 20 pips (10 pips * 2). This means that every pips is valued at $15 ($300

divided by 20 pips). In this scenario, the trade is for EUR/USD pairs where for a standard lot, the value

for each pip is $10. Hence, the lot size is $15 (value per pips needed for the trade) divided by $10 (value per

pips for EUR/USD pair standard lot) which is 1.5 lot. For each trade, the lot size not be affected by the RR

value as the lot size is only determined by the initial capital and stop loss distance.

14
Additional Confluences Optimization is also a key topic in this study. The optimization process will

be explained in the next subsection. However, it is important to understand that the optimization process

will return a range of values for each additional indicators (RSI, ATR, MA difference) for each buy and sell

signals. Therefore, the trading strategy is similar to the one explained before. Determining the stop loss

price, take profit price, and lot size is the same as the Exponential Moving Average and Moving Average

Convergence Divergence trading strategy. The only difference is the generation of buy and sell signals which

is more layered due to the need to fulfill the additional confluences conditions.

2.3.2 Market Friction

To make the backtesting result more realistic, market friction such as spread and commission fee is included.

Spread The spreads used in this studied were sourced from forex.com. There are two types of spread

given, typical and as low as. To make the backtesting as realistic as possible, the typical spread is used.

EUR/USD pair’s spread is 1.2 pips, USD/JPY pair’s spread is 1.5 pips, and GBP/USD pair’s spread is 1.6

pips.

Commissions fee The commissions fee is also sourced from forex.com being USD$5 for every standard

lot traded. This applies to both opening and closing trades.

2.4 Optimization Algorithm Development

To provide optimization to the Exponential Moving Average and Moving Average Convergence Divergence

trading strategy, the following approach was done.

Firstly, all the indicators values has been determined in the beginning which includes EMA, MACD,

RSI, ATR, and MA difference. Then the Exponential Moving Average and Moving Average Convergence

Divergence trading strategy is applied. By doing this, all the signals generated are gathered as well as status

of win or lose for each RR value. At the same time, each trade signal includes information about the other

technical indicators such as RSI, ATR, and MA difference.

Next, the trades are isolated from the rest of the data points and split between buy trades and sell

trades. It is then partitioned into wins and losses. The wins and losses status used are from RR value

equals to 1:5. This RR value provides the biggest distance between the trade price and the take profit price

meaning that a win with RR 1:5 is also a win for the other RR values tested. At this point, there are four

categories being buy-win trades, buy-lose trades, sell-win trades, and sell-lose trades.

15
From here, the optimization process can start by determining the initial upper bound and lower bound

for each additional confluences. The upper bound is set to the maximum value for each indicator. On the

other hand, the lower bound is set to the minimum value for each indicator.

Next, loops are used to help determine the range with the maximum win-to-lose ratio. For example,

when determining the RSI range values with the maximum win-to-lose ratio for the buy trades, the lower

bound will start at 0 and upper bound at 100. After this, the number of win buy trades where the RSI

values are between 0 and 100 and the number of lose buy trades where the RSI values are between 0 and

100 are counted and the difference is found. The iterations will continue until all combinations of lower and

upper bounds are tested and the RSI values range with maximum win-to-lose ratio is found. This process

is repeated to find the buy and sell value ranges for RSI, ATR, and MA differences. In total this process is

repeated 6 times and 6 value ranges are generated.

The optimized trading strategy leverages these range of values as additional confluences. Meaning that

for example,the buy trades will only take place when the RSI, ATR, and MA difference values fall between

the buy trades ranges for RSI, ATR, and MA difference.

Lastly, to help adjust for over-fitting, the range of values are obtained by utlizing the data points from

January 1, 2010 to December 31, 2017. The rest of the data up to December 31, 2021 are used to test the

performance of the optimized Exponential Moving Average and Moving Average Convergence Divergence

trading strategy.

2.5 Result Analysis

To determine the profitability of the trading strategies, the following indicators were utilized.

2.5.1 Total Profit

The total profit is the excess financial gain after the whole process of trading. Hence, the trading strategy

that produced the most total profit is preferred. The formula to calculate the total profit is as follows:

Vf inal − Vbeginning
T otal P rof it =
Vbeginning

where:

Vf inal = Final balance

Vbeginning = Beginning balance

16
2.5.2 Compound Annual Growth Rate

Compound Annual Growth Rate (CAGR) represents a steady rate of return over time. A high CAGR

denotes a high rate of return on investment. Therefore, the trading strategy with the highest CAGR is

preferred.

The formula to calculate CAGR is as follows:

Vf inal 1
CAGR = ( )t − 1
Vbeginning

Where:

Vf inal = Final balance

Vbeginning = Beginning balance

t = Period of trading in years

2.5.3 Maximum Drawdown

Maximum Drawdown is the largest loss seen during the period of trading. Low maximum drawdown indi-

cates a reduced level of risk during the trading process. Because of this, the trading strategy with the lowest

maximum drawdown is preferred.

The formula to calculate the maximum drawdown is as follows:

VP eak − VT rough
M aximum Drawdown =
VP eak

Where:

VP eak = Peak value

VT rough = Trough value

2.5.4 Sharpe Ratio

Sharpe Ratio is used to assist traders comprehend the return on an investment in relation to its risk. The

ratio is the average return obtained over the risk-free rate per unit of volatility or total risk. Volatility is a

measure of an asset’s or portfolio’s price changes. In this study, risk-free rate is assumed to be zero.

The formula to calculate the Sharpe Ratio is as follows:

Rp − Rf
Sharpe Ratio =
σp

17
Where:

Rp = Portfolio’s return

Rf = Risk-free rate

σp = Standard deviation of the portfolio’s excess return

18
3 Results Interpretation

3.1 EUR/USD 15-minute

3.1.1 Optimization Results

Long trades (n=1437)

Indicator Lower bound Upper bound Min Max Median

RSI 48 54 32 86 51

ATR (in pips) 4 30 1 41 7

MA difference (in pips) 0 31 0 152 16

Short trades (n=1481)

Indicator Lower bound Upper bond Min Max Median

RSI 48 56 21 66 48

ATR (in pips) 8 23 1 30 7

MA difference (in pips) 0 48 0 169 16

Table 1: EUR/USD optimized range of RSI, ATR, and MA difference

Based on table 1, there were in total 2918 trades that occured from 2010 to 2016. 1437 trades were long

trades and 1481 trades were short trades. Moreover, the RSI range for long and short trades are similar.

Both ranges are close to the middle level (50). When the RSI value is above 30 reference level, it signals a

bullish or uptrend. On the other hand, when the RSI value is below 70, it signals a bearish or downtrend.

Moreover, another way to interpret RSI value is that 70 or above indicates overbought and increase the

tendency to go downtrend, and 30 or below indicates oversold and increase the tendency to go uptrend [19].

Based on these interpretation, the ”golden zone” for RSI is indeed between 30 and 70 for both long and

short trades. The result gathered further narrowed down the range into 48 to 54 for long trades and 48 to

56 for short trades.

The ATR range for long trades is between 4 pips and 30 pips, while for short trades, the range is

between 8 pips and 23 pips. Both ranges show that the Exponential Moving Average and Moving Average

Strategy is not always profitable considering the minimum and the maximum value of each range.

The MA difference range for long trades is between 0 pips and 31 pips. For short trades, it is between 0

and 41 pips. Both ranges touches the lower bound which is 0 pips, but bounded on the upper side. Therefore,

it can be analyzed that the trading strategy works better when closing price is as far as 31 pips for the long

trades and 48 pips for the short trades.

19
3.1.2 Performance Evaluation

Non-optimized Trading Strategy (n=2157)

RR ratio Win rate Total Profit CAGR Cons. wins Cons. losses Sharpe Ratio

1:1 49.61% -452.94% - 12 11 -1.63

1:2 33.57% -387.55% - 10 24 -0.99

1:3 26.05% -232.25% - 6 30 -0.48

1:4 21.60% -64.69% -18.82% 5 43 -0.12

1:5 17.98% -68.78% -20.80% 5 55 -0.11

Optimized Trading Strategy (n=405)

RR ratio Win rate Total Profit CAGR Cons. wins Cons. losses Sharpe Ratio

1:1 52.10% -23.22% -5.17% 7 7 -0.49

1:2 36.29% 15.57% 2.95% 6 15 0.19

1:3 27.16% 13.53% 2.58% 5 25 0.12

1:4 24.20% 115.63% 16.68% 5 25 1.02

1:5 21.48% 180.97% 23.05% 5 25 1.39

Table 2: EUR/USD backtesting result from 2017 to 2021

Based on Table 2, it can be seen how the optimized strategy is generally a better trading strategy for trading

EUR/USD pair compared to the original Exponential Moving Average and Moving Average Convergence

Divergence trading strategy.

Firstly, the non-optimized trading strategy is not profitable for all the RR ratio. RR 1:1, 1:2, 1:3 even

has return beyond 100% which is not possible in real-life trading. However, to realize the severity of the

combination of the non-optimized trading strategy and the RR ratio, it is assumed that the account is able

to trade even when it has no more balance. Because of the return being more than -100% the CAGR for

RR 1:1, 1:2, 1:3 cannot be calculated. For RR 1:4 and 1:5 the CAGR are negative which corresponds to the

negative returns. This is also reflected on the Sharpe Ratio where all of the results show negative value.

Furthermore, the win rates are actually above the needed break even win rate except for RR 1:1. For

example, when using RR 1:1, it implies that if the risk per trade is $10 , then gain per trade is also $10.

Hence, to be profitable, the win rate should be above 50%. Looking at the other RR, the break even win rate

is as follows: RR 1:2 is 33.33%; RR 1:3 is 25%; RR 1:4 is 20%; RR 1:5 is 16.67%. Based on these break even

win rate, RR 1:2, 1:3, 1:4, and 1:5 have profitable win rates. However, due to the consideration of spreads

and commissions fee, the slight difference of the win rate cannot be profitable.

20
Moving on to the optimized strategy backtest result on the EUR/USD pair, most of the R:R show

positive returns except for R:R 1:1. Based on the win rate, all of the win rate results are above the needed

break even win rate. Yet, the 2.10% difference in RR 1:1 win rate does not cover the spread and commission

cost. Compared to the non-optimized trading strategy, all the win rates have increased, which shows that the

optimization method works for this currency pair. The additional confluences act as a filter which ignores

loss trades. This can be seen by the significant decrease of trades from 2157 trades to 405 trades. The

number of trades for the optimized trading strategy shows that for the 5-year span, a trade is executed every

4.5 days.

The positive returns are also reflected on the CAGR and Sharpe Ratio values. Based on the number

of consecutive losses, RR 1:3, 1:4. 1:5 have the same number which is 25 trades. This shows that during

those period, the account is suffering at most 50% of the initial balance which is USD$5000. This number

does not reflect the maximum drawdown since these consecutive losses might not happen in the beginning

of the backtesting period.

The Sharpe Ratios of the optimized trading strategy are relatively better compared to the non-optimized

trading strategy. With the Sharpe Ratio of RR 1:4 and 1:5 being above 1.0 is generally perceived as acceptable

to good by investors. So far, the optimization method used in this study has shown positive impact towards

the trading journey. Although the optimized trading strategy is not profitable for all RR ratio (RR 1:1),

but compared to the non-optimized trading strategy, all the indicators used to determine profitability have

been positively impacted.

21
Non-optimized Trading Strategy (n=2157)

RR ratio 2017 2018 2019 2020 2021 Average

1:1 -119.74% -30.19% -167.70% -24.10% -225.00% -113.34%

1:2 -116.59% -43.25% -181.81% -17.83% -276.67% -127.23%

1:3 -142.20% -34.25% -115.86% -17.89% -237.14% -109.46%%

1:4 -134.65% -24.23% -71.98% -19.93% -196.65% -89.48%

1:5 -112.84% -31.60% -64.05% -26.99% -251.47% -97.39%

Optimized Trading Strategy (n=405)

RR ratio 2017 2018 2019 2020 2021 Average

1:1 -21.94% -9.71% -12.69% -17.54% -52.09% -22.79%

1:2 -21.86% -18.49% -18.89% -18.67% -79.95% -31.57%

1:3 -37.05% -13.40% -22.98% -20.67% -80.33% -34.88%

1:4 -37.05% -9.37% -19.79% -17.76% -73.28% -31.45%

1:5 -37.05% -8.96% -15.19% -15.95% -91.96 % -33.82%

Table 3: EUR/USD backtesting maximum drawdown from 2017 to 2021

To produce accurate representation of the maximum drawdown, the backtesting procedure is different.

Each year is treated independently, meaning that at the start of every year, the initial balance is reset back

to USD$10,000.

For the non-optimized trading strategy, in 2017, 2019, and 2021, the maxium drawdown are generally

higher than 100%. Although this is not possible in real life scenario, the calculation was done to make

sure that the severity of the trading strategy is presented. Looking at the average column, the average

maximum drawdown throughout the years is exceptionally beyond what is usually accepted (25%). When

the maximum drawdown is above 25%, traders have the tendency to lose hope and stop trading [18].

Furthermore, for the optimized trading strategy, the numbers are significantly below the corresponding

values from the non-optimized trading strategy. However, the maximum drawdown for 2021 is relatively

unacceptable considering that RR 1:5 has 91.96% maximum drawdown which is close to losing everything.

The severe condition can also be observed in the non-optimized trading strategy 2021’s maximum drawdowns

which are relatively larger compared to the other years. Overall, all RR ratios are slightly above the

acceptable maximum drawdown.

22
3.2 GBP/USD 15-minute

3.2.1 Optimization Results

Long trades (n=1500)

Indicator Lower bound Upper bound Min Max Median

RSI 54 64 33 78 52

ATR (in pips) 6 16 2 34 9

MA difference (in pips) 0 30 0 157 22

Short trades (n=1594)

Indicator Lower bound Upper bond Min Max Median

RSI 26 36 14 65 47

ATR (in pips) 7 17 2 34 9

MA difference (in pips) 3 48 0 347 23

Table 4: GBP/USD optimized range of RSI, ATR, and MA difference

Based on table 4, there were in total 3094 trades that occurred from 2010 to 2016. From the trades, 1500 are

long trades and 1594 are short trades. Starting from the RSI indicator, the lower and upper bounds for the

long trades are close to the middle level (50). It is different for the short trades where the lower and upper

bounds are both below the middle level. One of the possible reason for this result is that the GBP/USD pair

follows the conventional RSI pattern where this indicator can be used as a trend indicator where when the

indicator value is below 50, then it is showing a downtrend. Both the RSI range for long and short trades

are still in the ”golden zone” that was explained in EUR/USD optimization results.

The ATR range for long trades is between 6 pips and 16 pips. The result is similar for short trades

where the range is between 7 pips and 17 pips. Considering the minimum and maximum values of the

ATR distribution, this result shows that the Exponential Moving Average and Moving Average Convergence

Divergence trading strategy is not always profitable. The MA difference range for long trades touches the

lower bound which is 0 pips, but is restricted by an upper bound (30 pips) which is far from the maximum

value (157 pips). For the short trades, the lower bound is 3 pips and the upper bound is 48 pips. Based on

the results, it is again seen that trades that are far from the 200-period moving average is not profitable due

to the behavior to revert to the mean.

23
3.2.2 Performance Evaluation

Non-optimized Trading Strategy (n=2129)

RR ratio Win rate Total Profit CAGR Cons. wins Cons. losses Sharpe Ratio

1:1 49.27% -340.55% - 8 13 -1.25

1:2 33.72% -226.16% - 6 24 -0.58

1:3 25.97% -107.68% - 6 24 -0.22

1:4 21.23% -9.64% -2.01% 6 39 -0.02

1:5 17.47% -66.83% -19.84% 6 42 -0.11

Optimized Trading Strategy (n=174)

RR ratio Win rate Total Profit CAGR Cons. wins Cons. losses Sharpe Ratio

1:1 52.87% -0.83% -0.17% 4 4 -0.04

1:2 37.35% 18.43% 3.51% 4 7 0.72

1:3 25.86% -12.13% -2.60% 4 23 -0.18

1:4 22.98% 35.89% 6.46% 4 23 0.71

1:5 17.82% 7.30% 1.44% 4 27 0.10

Table 5: GBP/USD backtesting result from 2017 to 2021

Similar to the EUR/USD currency pair, all of the RR show negative returns. For GBP/USD currency pair,

only RR 1:1 that has a win rate (49.61%) below the break even win rate (50%), while the others are higher

than the break even win rate. Still, the win rates are not high enough to compensate for the spread and

commissions fee. In general, the Exponential Moving Average and Moving Average Convergence Divergence

trading strategy is not a profitable when trading GBP/USD currency pair from 2017 to 2021.

Moving on to the optimized trading strategy. There is increase in win rate for all the RRs. This leads

to increase in the total profit and CAGR. Only RR 1:1 is showing negative return. This might be due to the

fact that for RR 1:1, the gain is not equal to the loss due to the commissions fee. Hence, even a win rate

higher than the break even win rate (50%) does not produce positive return.

When comparing the consecutive wins and losses, the optimized trading strategy shows improvement

in profitability through the decrease of consecutive losses. This is good for traders since consecutive losses

can affect the mental state. Because of this, the fewer the consecutive losses, the better the trading strategy

is perceived.

The Sharpe Ratios of the optimized trading strategy shows increases compared to the non-optimized

trading strategy. This is mainly due to the relative increase in total profit as well as the win rate.

24
One of the drawback that can be seen from the optimization process is the significant decrease in the

number of trades. The non-optimized trading strategy executed 2129 trades between 2017 to 2021. This

implies that on average, a trade is made every 0.85 days or once or twice per day. However, with the

additional confluences that act as filters, the number of trades executed decrease significantly to 174 trades,

which on average is executed every 10.4 days. The advantage of the decrease number of trades is the decrease

in commissions fee which impacts the gains.

Overall, the optimization process can be seen to increase the profitability of the Exponential Moving

Average and Moving Average Convergence Divergence trading strategy. However, the optimized strategy

for GBP/USD is not as profitable as the optimized strategy applied to the EUR/USD currency pair.

Non-optimized Trading Strategy (n=2129)

RR ratio 2017 2018 2019 2020 2021 Average

1:1 -69.04% -67.01% -54.24% -30.43% -176.21% -79.38%

1:2 -44.35% -45.28% -69.81% -40.04% -137.97% -67.49%

1:3 -83.41% -29.45% -67.29% -43.34% -316.95% -108.08%

1:4 -109.24% -30.40% -59.23% -51.57% -415.37% -133.16%

1:5 -140.74% -28.04% -59.85% -97.83% -448.92% -155.07%

Optimized Trading Strategy (n=174)

RR ratio 2017 2018 2019 2020 2021 Average

1:1 -15.25% -7.93% -6.12% -6.39% -16.95% -10.52%

1:2 -11.81% -15.42% -14.49% -5.50% -26.84% -14.81%

1:3 -21.58% -14.70% -13.71% -8.09% -47.46% -21.10%

1:4 -28.77% -12.17% -15.13% -7.94% -49.38% -22.67%

1:5 -47.09% -12.13% -18.94% -7.79% -51.57% -27.50%

Table 6: GBP/USD backtesting maximum drawdown from 2017 to 2021

After backtesting both trading strategies independently every year from 2017 to 2021, table 6 is pro-

duced. The reason for backtesting it independently every year is to truly observe the performance without

being affected by previous years performances.

The non-optimized trading strategy shows relatively unacceptable results. The average for each RR

ratio is above 25%. Similar to the EUR/USD currency pair, the strategy worst performance was in 2021

where all RR ratios has maximum drawdown more than 100%. This is not possible in real life account

considering that brokers would not allow the balance to be negative. However, by continuing the trading

25
process, the gravity of the performance can be seen.

The optimized trading strategy performs better and it can be seen by the significant reduction in

maximum drawdown. By looking at the average column for the optimized trading strategy, it is clear how

the behavior of ”High risk, high return” is relevant. The higher the RR ratio, the probability of hitting the

take profit is lower since it is further away. Because of this the number of losses is also increased. However,

all RR ratios produce average maximum drawdown that are acceptable (¡25%) except for RR 1:5 (27.50%).

This is probably caused by the fewer number of trades compared to the other currency pairs.

3.3 USD/JPY 15-minute

3.3.1 Optimization results

Long trades (n=1358)


Indicator Lower bound Upper bound Min Max Median
RSI 47 59 34 83 51
ATR (in pips) 2 20 1 20 6
MA difference (in pips) 7 42 0 127 14
Short trades (n=1440)
Indicator Lower bound Upper bond Min Max Median
RSI 16 44 16 65 48
ATR (in pips) 5 16 2 33 6
MA difference (in pips) 10 38 0 172 13

Table 7: USD/JPY optimized range of RSI, ATR, and MA difference

Based on table 7, the total number of trades used for optimization was 2798. 1358 trades were long

trades and 1440 were short trades. For long trades, the RSI range is in the ”golden zone” which is between

30 to 70. The range is also more skewed towards the upper values with the lower bound being 47 and the

upper bound being 59. For the short trades, the RSI range is not in the ”golden zone”. However, similar to

GBP/USD currency pair, the pattern shown is that the RSI range for the long trades tend to be higher than

the short trades. This can also be linked to how the RSI is perceived which is as a momentum indicator. The

optimization process illustrate how long trades are more profitable when the momentum is uptrend which

is higher RSI value and short trades are more profitable when the momentum is downtrend which is lower

RSI value.

The ATR range for the long trades is quite interesting considering that the optimization result shows

that the ATR upper bound is the same as the maximum value of the dataset and the lower bound is only

slightly above the minimum value. It can be implied that USD/JPY currency pair does not have significant

upward movement for long trades when compared to GBP/USD (34 pips) and EUR/USD (41 pips). However,

it is a different case for the short trades where the maximum ATR value is 33 and the median is 6. This

26
might be due to the long term downtrend that the USD/JPY had been facing from 2017 to 2021.

The MA difference optimization result for long trades is loewr bounded by the minimum value which

is 0 pips and upper bounded by 30 pips. By looking at the maximum value and median, it seems that the

perception that trades are not profitable when further away from the moving average is realized. For the

short trades, the MA difference value is lower bounded by 3 and upper bounded by 48. The maximum value

for short trades MA difference is significantly larger than the long trades which shows the tendency of a

downtrend for the USD/JPY currency pair.

3.3.2 Performance Evaluation

Non-optimized Trading Strategy (n=2119)

RR ratio Win rate Total Profit CAGR Cons. wins Cons. losses Sharpe Ratio

1:1 45.25% -412.25% - 10 14 -1.52

1:2 29.91% -444.91% - 8 22 -1.19

1:3 22.51% -432.66% - 7 45 -0.95

1:4 18.64% -295.93% - 7 45 -0.56

1:5 15.86% -212.26% - 5 65 -0.35

Optimized Trading Strategy (n=743)

RR ratio Win rate Total Profit CAGR Cons. wins Cons. losses Sharpe Ratio

1:1 43.88% -185.20% - 9 13 -1.97

1:2 29.87% -156.63% - 6 21 -1.2

1:3 22.48% -152.55% - 5 24 -0.97

1:4 18.30% -128.05% - 5 24 -0.70

1:5 16.55% -9.69% -2.02% 4 39 -0.06

Table 8: USD/JPY backtesting result from 2017 to 2021

Firstly, based on the non-optimized trading strategy performance result, the Exponential Moving Average

and Moving Average Convergence Divergence strategy did not perform well even when compared to the

performance of this trading strategy when applied to EUR/USD and GBP/USD. The other currency pairs’

results can give at least less than -100% return. However, for USD/JPY currency pair, all RR ratio can

guarantee the loss of all the account balance. This led to the inability to calculate the CAGR.

The bad performance can also be seen by the number of consecutive losses. In general, the higher the

RR ratio, the more likely it is to lose a trade due to the possibility or reversal before reaching the take profit

27
price. USD/JPY currency pair has the most number of consecutive losses (38.2 trades) on average compared

to GBP/USD(28.4 trades) and EUR/USD (32.6 trades). The bad performance of the non-optimized trading

strategy is also reflected by the win rates. Based on previous backtesting results, some of the win rates

are above the break even win rate and suffer negative returns due to the commissions fee. However, it is a

different case for USD/JPY where all the win rates are below the break even win rates.

Moving on to the optimized trading strategy. Overall, the returns are negative, meaning that this

optimized trading strategy is not profitable when used for USD/JPY from 2017 to 2021. The win rates are

not better as well except for RR 1:5 which increased by 0.69%. However, the increase in total profit when

compared to the non-optimized trading strategy result is more impacted by the decreasing number of trades

which leads to decrease in total commission fees and not significantly impacted by change in win rates0 .

Although when compared with GBP/USD and EUR/USD, USD/JPY has the most trades for the optimized

trading strategy with 743 trades while the others have 174 trades and 405 trades respectively.

The number of consecutive losses also shows a decreasing pattern. Usually this can be due to the

optimization process filtering the bad trades. However, when looking at the win rates that do not differ too

much from the non-optimized trading strategy, the decrease of consecutive losses is more impacted by the

fewer number of trades taken rather than the optimization process.

Non-optimized Trading Strategy (n=2119)

RR ratio 2017 2018 2019 2020 2021 Average

1:1 -52.25% -47.72% -219.66% -34.78% -34.60% -77.80%

1:2 -33.45% -53.74% -257.03% -95.26% -52.51% -108.49%

1:3 -28.89% -60.77% -259.02% -159.65% -42.95% -110.26%

1:4 -33.41% -52.88% -229.03% -91.48% -45.42% -90.44%

1:5 -51.00% -47.25% -173.02% -70.72% -81.04% -84.60%

Optimized Trading Strategy (n=743)

RR ratio 2017 2018 2019 2020 2021 Average

1:1 -32.11% -47.45% -52.98% -37.41% -20.40% -38.07%

1:2 -21.09% -32.78% -80.93% -98.24% -27.19% -52.04%

1:3 -24.70 % -47.32% -67.43% -94.27% -31.17% -52.97%

1:4 -36.29% -42.15% -79.48% -96.34% -25.91% -56.03%

1:5 -31.11% -39.38% -73.58% -75.26% -20.47% -47.96%

Table 9: USD/JPY backtesting maximum drawdown from 2017 to 2021

28
So far, USD/JPY currency has the worst performance both for optimized and non-optimized trading

strategy. The performance was also reflected on the maximum drawdown.

Overall, RR 1:2 and 1:3 has maximum drawdown average above 100%. This means for every year, the

account balance would lose all its money. The maximum drawdown for all RR ratios are unacceptable due

to the numbers being above 25%.

Although the optimized trading strategy produced significantly lower maximum drawdown compared to

the non-optimized trading strategy, the overall average for all RR ratios are above the acceptable threshold.

The significant decrease can be seen for the year of 2019 where most of the maximum drawdown is above

200% for the non-optimized trading strategy, but was able to be brought down with the optimized trading

strategy to be lower than 100%.

29
4 Concluding Remarks

Throughout the backtesting and optimizing process, the Exponential Moving Average and Moving Average

Convergence Divergence trading strategy is proven to not be profitable for EUR/USD, GBP/USD, and

USD/JPY currency pairs. The trading strategy actually produced profitable signals for EUR/USD and

GBP/USD when looking only at the win rates being above break even win rate. However, when taking

into account the commissions fee, the overall trading process produce negative returns. Moreover, the

optimization process was able to leverage historical information to increase the probability of providing

profitable signals on all currency pairs. The optimized trading strategy has shown better results from all

aspects especially in increasing total profit and win rate. In conclusion, the optimized strategy applied to

EUR/USD with RR 1:5 is the most profitable with total profit of 180.97% and CAGR of 23.05% from 2017

to 2021. However, the optimized trading strategy is not profitable for USD/JPY on all RR ratios.

4.1 Future Work

4.1.1 More currency pairs

In this study, only three currency pairs are tested. However, on the forex market, there are 18 major currency

pairs traded based on volume. Because of this, it can be another approach to provide better insights of the

optimization process if it is applied on other currency pairs.

4.1.2 Optimizing the technical indicators parameters

In this study, default parameters are used for each technical indicators for simplicity. Yet, if the parameters

are fine tuned for each currency pairs, the result might be better. This is because each currency pair has its

own unique price action behavior; hence, a personalized parameters can produce better signals.

4.1.3 Using K-Nearest Neighbors (KNN) algorithm

Throughout the development of this study, I was curious on using KNN as a way to classify whether a trade

is profitable or not. Technical indicators values can be used as an input when calculating the distance to

find nearest neighbors. This new approach can filter trades not based on ranges, but on referring historical

results.

4.1.4 Taking trading time zones into consideration

There are multiple trading hours which are known to affect specific currency pairs. For instance, there is

the New York hours (open 8 a.m. EST to 5 p.m. EST). During this hours, 90% of the traded currency

30
pairs involved the U.S. Dollars. Therefore, the price movement of the related currency pairs is more active.

There are other trading hours such as Tokyo, Sydney, and London which affects their corresponding national

currency. This can be a new approach when classifying the trades and only executes the ones that are in

the trading hours.

31
References

[1] BabyPips.com. What is a lot in forex? Dec. 2011. url: https://www.babypips.com/learn/forex/

lots-leverage-and-profit-and-loss.

[2] James Chen. Exponential moving average (EMA). Apr. 2022. url: https://www.investopedia.com/

terms/e/ema.asp.

[3] James Chen. Take-profit order - t/P. Feb. 2022. url: https://www.investopedia.com/terms/t/

take-profitorder.asp.

[4] James Chen. Technical indicator definition. Feb. 2022. url: https://www.investopedia.com/terms/

t/technicalindicator.asp.

[5] James Chen. Understanding the theory of mean reversion. Nov. 2021. url: https://www.investopedia.

com/terms/m/meanreversion.asp.

[6] Rajeev Dhir. How a market order works. Feb. 2022. url: https://www.investopedia.com/terms/

m/marketorder.asp.

[7] Jason Fernando. Moving average convergence divergence (MACD). Mar. 2022. url: https://www.

investopedia.com/terms/m/macd.asp.

[8] Jason Fernando. Relative strength index (RSI). Mar. 2022. url: https://www.investopedia.com/

terms/r/rsi.asp.

[9] Selwyn M. Gishen. Understanding forex risk management. Jan. 2022. url: https://www.investopedia.

com/articles/forex/10/forex-risk-management.asp.

[10] Adam Hayes. Average true range (ATR). Dec. 2021. url: https://www.investopedia.com/terms/

a/atr.asp.

[11] Adam Hayes. Inside the risk/reward ratio. Mar. 2022. url: https://www.investopedia.com/terms/

r/riskrewardratio.asp.

[12] High Profitable Forex Strategy with 200 EMA and MACD. url: https://www.forexfunction.com/

high-profitable-forex-strategy-with-200-ema-and-macd.

[13] Michael J. Kramer. Limit order definition. May 2021. url: https://www.investopedia.com/terms/

l/limitorder.asp.

[14] Cory Mitchell. What is forex (FX) and how does it work? Feb. 2022. url: https://www.investopedia.

com/terms/f/forex.asp.

32
[15] Tim Parker. The basics of currency trading. Feb. 2022. url: https : / / www . investopedia . com /

financial-edge/0412/the-basics-of-currency-trading.aspx.

[16] Albert Phung. What are the most commonly traded currency pairs? Feb. 2022. url: https://www.

investopedia.com/ask/answers/06/maincurrencypairs.asp.

[17] The Investopedia Team. The stop-loss order-make sure you use it. Feb. 2022. url: https://www.

investopedia.com/articles/stocks/09/use-stop-loss.asp.

[18] Why Is Max Drawdown Important In Trading? What Is A Good Drawdown Percentage? url: https:

//www.quantifiedstrategies.com/why-is-max-drawdown-important-in-trading-what-is-a-

good-drawdown-percentage/.

[19] Welles Wilder. What is RSI? - relative strength index. url: https://www.fidelity.com/learning-

center/trading-investing/technical-analysis/technical-indicator-guide/RSI.

33

You might also like