Ema Macd Forex
Ema Macd Forex
Nicholas Christanto
Year 3, Interdisciplinary Programs Office
Supervised By:
1
Contents
1 Introduction 4
1.4 Exponential Moving Average and Moving Average Convergence Divergence trading strategy . 11
1.5 Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2 Methodology 13
2
3 Results Interpretation 19
4 Concluding Remarks 30
3
1 Introduction
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
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
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,
There are multiple trading strategies for trading currencies, mainly technical and fundamental. This
This study selected three of the most common currency pairs based on volume traded:
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
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
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
A market order is an instruction given to a broker by an investor to buy or sell assets such as currencies at
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
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
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
In this study, the stop loss price is determined using the Average True Range which will be further
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.
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].
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.
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
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].
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
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.
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
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
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
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].
P eriodLength
1 X
AT R = ( )∗ T Ri
P eriodLength i=1
10
Figure 5: ATR example from Investopedia
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
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 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
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
12
2 Methodology
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
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
For the technical indicators, default values are used except for EMA.
2. Moving Average Convergence Divergence: 12-period fast, 26-period slow, 9-period signal
The timeframe used in this study is the 15-minute timeframe. The risk-to-reward ratio studied are 1:1, 1:2,
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
In this study, the risk management includes quantitatively determining the stop loss price, take profit
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
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.
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
To provide optimization to the Exponential Moving Average and Moving Average Convergence Divergence
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
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
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
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.
To determine the profitability of the trading strategies, the following indicators were utilized.
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:
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.
Vf inal 1
CAGR = ( )t − 1
Vbeginning
Where:
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
VP eak − VT rough
M aximum Drawdown =
VP eak
Where:
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.
Rp − Rf
Sharpe Ratio =
σp
17
Where:
Rp = Portfolio’s return
Rf = Risk-free rate
18
3 Results Interpretation
RSI 48 54 32 86 51
RSI 48 56 21 66 48
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
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
19
3.1.2 Performance Evaluation
RR ratio Win rate Total Profit CAGR Cons. wins Cons. losses Sharpe Ratio
RR ratio Win rate Total Profit CAGR Cons. wins Cons. losses Sharpe Ratio
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
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
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
21
Non-optimized Trading Strategy (n=2157)
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
22
3.2 GBP/USD 15-minute
RSI 54 64 33 78 52
RSI 26 36 14 65 47
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
23
3.2.2 Performance Evaluation
RR ratio Win rate Total Profit CAGR Cons. wins Cons. losses Sharpe Ratio
RR ratio Win rate Total Profit CAGR Cons. wins Cons. losses Sharpe Ratio
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
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.
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
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.
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
RR ratio Win rate Total Profit CAGR Cons. wins Cons. losses Sharpe Ratio
RR ratio Win rate Total Profit CAGR Cons. wins Cons. losses Sharpe Ratio
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
28
So far, USD/JPY currency has the worst performance both for optimized and non-optimized trading
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
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
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.
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
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.
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.
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
31
References
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