Like it!

Join us on Facebook!

Like it!

Experimenting naive EUR/USD algo-trading

What happens when you blindly trade with a very dumb script in the year range 2000-2015.

Recently I wanted to do an experiment with algorithmic trading with the EUR/USD cross pair. However, instead on focusing on winning strategies and super-fancy mathematical models I decided to start from an unsophisticated approach. I built a very naive robot that just trade at a specific hour of the day and quits if any gains or losses occur.

More specifically, this is what my algorithm does for each day of the year:

  1. start buying at hour X;
  2. if the price exceeds a stop loss, a take profit or a new day comes in, close the trade. Go on otherwise;
  3. store gains/losses.

Definitely a naive approach here, and that's exactly what I wanted.

Running the tests

First of all I downloaded historical data from histdata.com in a range from year 2000 to year 2015. Then I defined three variables:

  • START_HOUR - when to start trading;
  • STOP_LOSS (in pip) - stop trading if value goes below (loss);
  • TAKE_PROFIT (in pip) - stop trading if value goes above (gain).

I played with those three variables, by tweaking the values and varying the stop loss/take profit range. I restricted the experiments from 9 am to 11 am because, given my previous analysis on EUR/USD volatility, that period seems to be the most lively, in terms of trading activity.

Marvelling at the results

I run my tests from year 2000 to 2015. What follows are the results in form of raw numeric outcomes.

START_HOUR  = 9                 START_HOUR  = 9
TAKE_PROFIT = 0.0006            TAKE_PROFIT = 0.0007
STOP_LOSS   = -0.0003           STOP_LOSS   = -0.0004

2000: losses=92  gains=59       2000: losses=81  gains=70
2001: losses=131 gains=91       2001: losses=111 gains=111
2002: losses=123 gains=77       2002: losses=96  gains=104
2003: losses=152 gains=103      2003: losses=134 gains=121
2004: losses=158 gains=105      2004: losses=141 gains=122
2005: losses=163 gains=96       2005: losses=145 gains=114
2006: losses=171 gains=87       2006: losses=149 gains=109
2007: losses=164 gains=95       2007: losses=149 gains=110
2008: losses=151 gains=109      2008: losses=151 gains=109
2009: losses=144 gains=115      2009: losses=134 gains=125
2010: losses=168 gains=92       2010: losses=153 gains=106
2011: losses=157 gains=103      2011: losses=153 gains=107
2012: losses=169 gains=91       2012: losses=168 gains=92
2013: losses=168 gains=91       2013: losses=159 gains=100
2014: losses=174 gains=84       2014: losses=170 gains=88
2015: losses=156 gains=103      2015: losses=150 gains=109

----------------------------------------------------------

START_HOUR  = 9                 START_HOUR  = 9
TAKE_PROFIT = 0.0008            TAKE_PROFIT = 0.0009
STOP_LOSS   = -0.0005           STOP_LOSS   = -0.0006

2000: losses=85  gains=66       2000: losses=85  gains=66
2001: losses=119 gains=103      2001: losses=119 gains=103
2002: losses=100 gains=100      2002: losses=100 gains=100
2003: losses=129 gains=126      2003: losses=129 gains=126
2004: losses=142 gains=121      2004: losses=142 gains=121
2005: losses=151 gains=108      2005: losses=151 gains=108
2006: losses=153 gains=105      2006: losses=153 gains=105
2007: losses=148 gains=111      2007: losses=148 gains=111
2008: losses=149 gains=111      2008: losses=149 gains=111
2009: losses=142 gains=117      2009: losses=142 gains=117
2010: losses=163 gains=96       2010: losses=163 gains=96
2011: losses=163 gains=97       2011: losses=164 gains=96
2012: losses=164 gains=96       2012: losses=159 gains=101
2013: losses=156 gains=103      2013: losses=160 gains=99
2014: losses=170 gains=88       2014: losses=166 gains=91
2015: losses=150 gains=109      2015: losses=147 gains=112

----------------------------------------------------------

START_HOUR  = 10                START_HOUR  = 10
TAKE_PROFIT = 0.0006            TAKE_PROFIT = 0.0007
STOP_LOSS   = -0.0003           STOP_LOSS   = -0.0004

2000: losses=97  gains=54       2000: losses=89  gains=62
2001: losses=141 gains=81       2001: losses=136 gains=86
2002: losses=121 gains=79       2002: losses=109 gains=91
2003: losses=165 gains=89       2003: losses=145 gains=109
2004: losses=160 gains=102      2004: losses=161 gains=101
2005: losses=154 gains=106      2005: losses=146 gains=114
2006: losses=147 gains=111      2006: losses=140 gains=118
2007: losses=166 gains=93       2007: losses=153 gains=106
2008: losses=152 gains=108      2008: losses=136 gains=124
2009: losses=150 gains=109      2009: losses=141 gains=118
2010: losses=164 gains=96       2010: losses=149 gains=110
2011: losses=162 gains=98       2011: losses=159 gains=101
2012: losses=164 gains=96       2012: losses=162 gains=98
2013: losses=145 gains=114      2013: losses=145 gains=114
2014: losses=151 gains=107      2014: losses=149 gains=109
2015: losses=144 gains=115      2015: losses=146 gains=113

----------------------------------------------------------

START_HOUR  = 10                START_HOUR  = 10
TAKE_PROFIT = 0.0008            TAKE_PROFIT = 0.0009
STOP_LOSS   = -0.0005           STOP_LOSS   = -0.0006

2000: losses=93  gains=58       2000: losses=93  gains=58
2001: losses=141 gains=81       2001: losses=141 gains=81
2002: losses=109 gains=91       2002: losses=109 gains=91
2003: losses=142 gains=111      2003: losses=142 gains=111
2004: losses=155 gains=107      2004: losses=155 gains=107
2005: losses=143 gains=117      2005: losses=143 gains=117
2006: losses=149 gains=108      2006: losses=149 gains=108
2007: losses=154 gains=105      2007: losses=154 gains=105
2008: losses=140 gains=120      2008: losses=140 gains=120
2009: losses=147 gains=112      2009: losses=147 gains=112
2010: losses=160 gains=99       2010: losses=160 gains=99
2011: losses=167 gains=93       2011: losses=167 gains=93
2012: losses=163 gains=97       2012: losses=160 gains=100
2013: losses=137 gains=122      2013: losses=140 gains=119
2014: losses=151 gains=107      2014: losses=151 gains=102
2015: losses=148 gains=111      2015: losses=147 gains=112

----------------------------------------------------------

START_HOUR  = 11                START_HOUR  = 11
TAKE_PROFIT = 0.0006            TAKE_PROFIT = 0.0007
STOP_LOSS   = -0.0003           STOP_LOSS   = -0.0004

2000: losses=107 gains=43       2000: losses=107 gains=43
2001: losses=127 gains=95       2001: losses=117 gains=105
2002: losses=132 gains=66       2002: losses=112 gains=86
2003: losses=164 gains=87       2003: losses=147 gains=104
2004: losses=159 gains=102      2004: losses=138 gains=123
2005: losses=165 gains=93       2005: losses=139 gains=119
2006: losses=161 gains=97       2006: losses=146 gains=112
2007: losses=158 gains=101      2007: losses=152 gains=107
2008: losses=139 gains=121      2008: losses=130 gains=130
2009: losses=155 gains=104      2009: losses=143 gains=116
2010: losses=156 gains=104      2010: losses=142 gains=117
2011: losses=159 gains=101      2011: losses=144 gains=116
2012: losses=141 gains=119      2012: losses=130 gains=130
2013: losses=160 gains=99       2013: losses=153 gains=106
2014: losses=164 gains=94       2014: losses=157 gains=101
2015: losses=154 gains=105      2015: losses=143 gains=116

----------------------------------------------------------

START_HOUR  = 11
TAKE_PROFIT = 0.0008
STOP_LOSS   = -0.0005

2000: losses=105 gains=45
2001: losses=121 gains=101
2002: losses=113 gains=85
2003: losses=147 gains=104
2004: losses=148 gains=113
2005: losses=146 gains=111
2006: losses=145 gains=113
2007: losses=153 gains=105
2008: losses=137 gains=123
2009: losses=149 gains=110
2010: losses=153 gains=106
2011: losses=142 gains=118
2012: losses=129 gains=131
2013: losses=152 gains=107
2014: losses=157 gains=99
2015: losses=140 gains=119

Organizing data into charts

Below you can find the previous raw data organized in nicer charts. Each drawing shows one trading experiment. Stacked bars are gains (green) versus losses (red). Vertical axis contains the trading days, which are roughly 250 in each year. The number above each bar represents the gain/loss ratio: if greater than zero, gains overcome losses. Bars for years 2000, 2001 and 2002 are shorter because of some missing data.

Naive EUR/USD trading, chart Result 1
Result 1
Naive EUR/USD trading, chart Result 2
Result 2
Naive EUR/USD trading, chart Result 3
Result 3
Naive EUR/USD trading, chart Result 4
Result 4
Naive EUR/USD trading, chart Result 5
Result 5
Naive EUR/USD trading, chart Result 6
Result 6
Naive EUR/USD trading, chart Result 7
Result 7
Naive EUR/USD trading, chart Result 8
Result 8
Naive EUR/USD trading, chart Result 9
Result 9

Final considerations

I must admit I was definitely suprised by the results. Initially I thought that, being just random and dumb trading, every outcome would be a complete loss. However my experiments turned out to be victorious several times. Take a look for example at the chart of Result 2: in year 2002 the gain/loss ratio is 1.1, which means I was able to make actual money from my naive trading!

Now, if you think of that experiment as a starting point, I guess what one should add in terms of strategies, heuristics and algorithms in order to raise those gain/loss ratios at least to 1.1, knowning that a complete dumb strategy like mine that can bring you close to a gain/loss ratio of ~0.5 (roughly the mean of all ratios).

comments
Korcan on November 10, 2019 at 23:29
great article !!!