automated foreign exchange trading strategies: improving ...771156/fulltext01.pdf · trading...

28
Automated Foreign Exchange Trading Strategies: Improving Performance Without Strategy Modification Degree Project in Computer Science DENNIS EKSTRÖM TOBIAS WIKSTRÖM Bachelor’s Thesis at KTH CSC Supervisor: Pawel Herman Examiner: Örjan Ekeberg 2014-04-29

Upload: others

Post on 22-Jul-2020

10 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Automated Foreign Exchange Trading Strategies: Improving ...771156/FULLTEXT01.pdf · Trading indicators are frequently used among foreign exchange traders in attempts to predict future

Automated Foreign Exchange Trading Strategies:

Improving Performance Without Strategy

Modification

Degree Project in Computer Science

DENNIS EKSTRÖMTOBIAS WIKSTRÖM

Bachelor’s Thesis at KTH CSCSupervisor: Pawel HermanExaminer: Örjan Ekeberg

2014-04-29

Page 2: Automated Foreign Exchange Trading Strategies: Improving ...771156/FULLTEXT01.pdf · Trading indicators are frequently used among foreign exchange traders in attempts to predict future

 ABSTRACT  

Trading indicators are frequently used among foreign exchange                

traders in attempts to predict future market events. Automated                  

trading strategies can easily be implemented to act on such                    

predictions.  

Motivated by a curiosity about whether the use of trading indicators                      

could be improved without actually changing the indicators                

themselves, this study was conducted in an attempt to investigate                    

opportunities in enhancing strategy profits by restricting strategies                

from  trading  during  periods  deemed  as  unfavorable.  

However, conditionally restricting strategies’ trading capabilities by              

introducing thresholds for strategy activation did not show                

significant effects on the performance. By examining the accumulated                  

strategy profits both with and without applied thresholds, it was                    

derived that the general characteristics of the performance were                  

withheld. Consequently, it cannot be concluded that this study                  

provides a reliable method of enhancing profits through applying                  

restrictions  to  foreign  exchange  strategies.  

Nevertheless, the effects fromapplying thresholds to strategies, albeit                  

not mainly profitable in this study, motivates further research on                    

advantages from conditionally restricting foreign exchange            

strategies.  

 

   

1  

 

Page 3: Automated Foreign Exchange Trading Strategies: Improving ...771156/FULLTEXT01.pdf · Trading indicators are frequently used among foreign exchange traders in attempts to predict future

TABLE  OF  CONTENTS    

1.  Terminology………………………………………………………………………………………………………………..3  

2.  Introduction………………………………………………………………………………………………………………...5  

2.1  Problem  Definition………………………………………………………………………………………….5  

2.2  Aims  and  Scope………………………………………………………………………………………………5  

3.  Background…………………………………………………………………………………………………………………6  

3.1  Moving  Average  Convergence-­‐Divergence  (MACD)………………………………………….7  

3.2  Linear  Regression  Trend  Channel  (LRTC)………………………………………………………..8  

3.3  Similar  Studies………………………………………………………………………………………………..9  

4.  Method…………………………………………………………………………………………………………...................10  

4.1  Implementing  the  Strategies………………………………………………………………………….10  

4.1.1  MACD  Strategy………………………………………………………………………………...11  

4.1.2  LRTC  Strategy………………………………………………………………………………….13  

4.2  Backtesting  and  Retrieving  Results………………………………………………………………..16  

4.2.1  Analysis  on  Profitable  Periods………………………………………………………….16  

4.2.2  Strategy  Performance  and  Market  Patterns……………………………………...16  

4.2.3  Strategy  Activation………………………………….……………………………………….16  

4.2.4  Backtesting  With  Thresholds……………………………………….…………………...18  

5.  Results…………………………………………….……………………………………….………………………………..18  

5.1  Backtest……………………………………….……………………………………………………………….18  

5.2  Market  Patterns……………………………………….…………………………………………………...19  

5.3  Strategy  Performance  Correlations……………………...………………………………………...20  

5.4  Optimization  of  strategies……………………………………….……………………………………..22  

6.  Discussion…………………………………………….……………………………………….…………………………..23  

6.1  Method……………………………………….………………………………………………………………...23  

6.2  Results……………………………………….…………………………………………………………………23  

6.3  Limitations……………………………………….…………………………………………………………...25  

6.4  Conclusion……………………………………….……………………………………………………………26  

8.  References…………………………………………….……………………………………….………………………….27  

   

2  

 

Page 4: Automated Foreign Exchange Trading Strategies: Improving ...771156/FULLTEXT01.pdf · Trading indicators are frequently used among foreign exchange traders in attempts to predict future

1.  TERMINOLOGY  Backtesting   The  process  of  testing  a  trading  strategy  on  prior  time  periods.  

Breakaway   A  sudden  increase  in  market  momentum,  causing  the  market  to  abandon  

ongoing  trends.  

Crossover   The  action  of  a  numerical  value  changing  sign  (e.g.  going  from  positive  to  

negative).  

Forex   Foreign  exchange  

Fractal   A  type  of  pattern  used  in  technical  analysis  to  predict  a  reversal  in  the  

current  trend.  The  fractal  value  is  the  market  rate  at  the  time  of  reversal.  

Indicator   Statistical  tool  used  to  measure  current  conditions  as  well  as  to  forecast  

financial  or  economic  trends.  

Instrument   A  currency  pair.  Conventionally  written  on  the  format  XXX/YYY  where  

XXX  is  the  base  currency  and  YYY  is  the  quote  currency  (e.g.  EUR/USD).  

Leverage   The  use  of  various  financial  instruments  or  borrowed  capital,  such  as  

margin,  to  increase  the  potential  return  of  an  investment.  Leverage  is  

expressed  as  the  ratio  between  the  actual  invested  amount  and  the  money  

put  into  the  trade  by  the  trader.  

Liquidity   The  availability  of  assets  in  a  market.  High  liquidity  means  a  higher  chance  

of  executing  a  trade  with  low  slippage.  

Long  position   An  executed  buy  order.  

Lot   100,000  units  of  the  quote  currency  in  a  forex  trade.  

M5   Five  minutes.  The  format  (M1,  M5,  H1,  etc.)  is  conventionally  used  by  

brokers  to  represent  data  of  specific  intervals.  

Market  momentum   A  measure  of  overall  market  sentiment,  calculated  as  the  change  in  market  

rate  multiplied  by  the  aggregate  trading  volume.  

Pip   1/10,000th  of  the  rate  unit.  

Point   1/10th  of  a  pip.  

Position   An  executed  market  order.  

Rate   The  quotient  of  the  base  currency  and  the  quote  currency  for  a  given  

3  

 

Page 5: Automated Foreign Exchange Trading Strategies: Improving ...771156/FULLTEXT01.pdf · Trading indicators are frequently used among foreign exchange traders in attempts to predict future

instrument.  

Recoil   The  event  of  the  rate  rapidly  changing  direction  at  a  specific  price.  

Resistance  level   A  rate  considered  unlikely  for  the  rate  to  climb  above.  

Short  position   An  executed  sell  order.  

Slippage   The  difference  between  the  expected  price  of  a  trade,  and  the  price  the  

trade  actually  executes  at.  

Spread   Difference  between  ask  and  bid  rate.  

Stop-­‐loss   An  order  placed  with  a  broker  to  close  a  position  when  it  reaches  a  certain  

price,  as  a  precaution  if  the  market  would  head  in  the  unintended  

direction.  

Support  level   A  rate  considered  unlikely  for  the  rate  to  fall  below.  

Take-­‐profit   An  order  placed  with  a  broker  to  close  a  position  when  it  reaches  a  certain  

price,  defining  a  level  at  which  to  lock  in  profits.  

Technical  Analysis   The  academic  study  of  historical  market  trends  and  patterns,  performed  

with  the  purpose  of  forecasting  future  market  development.  

Tick   The  change  in  the  price  of  an  instrument  from  trade  to  trade.  

Timeframe   The  period  of  the  data  used  for  analysis.  

Trading  strategy   A  programmatically  implementable  algorithm  with  the  ability  to  open  and  

close  market  positions.  

Trend   The  general  direction  of  a  market  or  of  the  price  of  an  asset.    

 

   

4  

 

Page 6: Automated Foreign Exchange Trading Strategies: Improving ...771156/FULLTEXT01.pdf · Trading indicators are frequently used among foreign exchange traders in attempts to predict future

2.  INTRODUCTION  One  could  reasonably  argue  that  widely  used  technical  analysis  indicators  earned  their  popularity  

from  historically  providing  good  market  predictions.  However,  fundamental  properties  of  financial  

markets  contradict  the  existence  of  a  widely  used  and  ever  correct  indicator.  The  reason  is  that  an  

indicator  being  known  to  the  public  to  always  give  perfect  predictions  would  cause  the  market  

liquidity  to  drop  and  the  rate  to  potentially  experience  massive  fluctuations  in  an  attempt  to  adjust  

to  supply  and  demand  (Shefrin,  2002).  Accordingly,  it  would  be  mindless  to  believe  that  popular  

indicators,  such  as  historical  rate  averages  and  various  trend  identifiers,  could  generate  large  profits  

in  the  long  run.  

Consequently,  as  popular  indicators  seem  unlikely  to  show  long  run  profits,  their  popularity  may  

have  been  gained  from  historically  proven  abilities  to  perform  well  during  certain  periods  in  time.  If  

this  was  the  case,  traders  would  benefit  from  being  able  to  identify  and  characterize  such  profitable  

periods  (Murphy,  1999).  Such  analysis  of  multiple  indicators  would  provide  knowledge  about  what  

indicator  is  preferable  at  specific  points  in  time.  Furthermore,  performing  such  analysis  on  

indicators  that  have  been  derived  from  fundamentally  different  ideas  and  assumptions  could  

increase  the  chances  for  a  trader  to  frequently  be  able  to  choose  a  trustworthy  indicator.  These  

arguments  are  reasonable  as  fundamentally  different  indicators  are  more  likely  to  perform  well  

during  periods  of  different  market  conditions,  such  as  high  volatility,  consolidation  or  other  market  

patterns,  than  indicators  based  on  similar  grounds.  

Given  the  approach  of  analysis  presented  above,  this  study  was  motivated  by  a  curiosity  about  

whether  the  use  of  existing  indicators  could  be  improved  without  actually  changing  the  indicators  

themselves.  Instead,  ignoring  the  indications  given  during  periods  deemed  as  unreliable  for  a  

specified  indicator  was  seen  as  the  potential  source  of  improvement.  Such  an  approach  to  enhance  

profits  of  indicator  based  trading  strategies  would  differ  fundamentally  from  the  ideas  of  the  vast  

majority  of  strategies  (Larsen,  2010).  While  classical  strategy  development  is  concerned  with  

assumptions  on  a  market’s  mathematical  properties  or  psychological  impact  from  traders  (Chen,  2009),  the  strategy  development  conducted  in  this  study  would  mainly  depend  on  the  fact  that  there  exists  strategies  which  occasionally  performs  well.  

2.1  PROBLEM  DEFINITION  How  can  automated  foreign  exchange  trading  strategies  that  are  based  on  widely  used  indicators  

within  the  field  of  technical  analysis  be  conditionally  restricted  to  enhance  profits?  

2.2  AIMS  AND  SCOPE  Evidently,  one  of  the  motivating  factors  for  conducting  studies  within  the  field  of  technical  analysis  

inherits  from  the  fact  that  knowledge  in  the  area  increases  chances  of  one’s  personal  success  as  a  

trader.  Naturally,  potential  monetary  revenues  that  could  emerge  from  results  of  the  study  could  not  

be  neglected  as  an  incentive  to  conduct  it.  However,  the  main  purpose  of  this  study  is  to  gain  

knowledge  within  the  field  of  technical  analysis  in  financial  markets  and  to  explore  progressive  

5  

 

Page 7: Automated Foreign Exchange Trading Strategies: Improving ...771156/FULLTEXT01.pdf · Trading indicators are frequently used among foreign exchange traders in attempts to predict future

techniques  in  indicator  and  strategy  design.  Specifically,  by  characterizing  profitable  periods  for  

specific  indicators,  the  study  aims  to  present  an  innovative  trading  analysis  approach  that  makes  use  

of  already  existing  indicators  and  strategies.  

In  conclusion,  the  aim  of  the  study  is  to  investigate  an  alternative  approach  in  indicator  analysis  and  

trading  strategy  improvement.  The  main  purpose  being  learning,  as  opposed  to  monetizing,  

corresponds  to  the  fact  that  the  results  of  this  study  is  publicly  available,  since  publishing  a    trading  

strategy  may  affect  its  performance  due  to  changed  market  conditions  caused  by  the  strategy  itself.  

The  study  does  not  rely  on  any  particular  strategy  performing  well  individually.  As  it  aims  to  find  

similarities  in  the  periods  of  successful  strategy  performance,  it  is  more  important  that  each  strategy  

performs  well  on  occasion.  Although  the  discussion  will  not  go  into  depth  in  analyzing  the  risk  of  the  

chosen  strategies  never  performing  well,  that  risk  is  assumed  to  be  negligible  simply  due  to  the  

extensive  use  of  the  indicators  that  the  strategies  in  this  study  are  based  on.  

3.  BACKGROUND  Trading  the  foreign  exchange  market  has  become  increasingly  popular  over  the  last  couple  of  years.  

Huge  trading  volumes,  high  leverage  and  low  margins,  has  made  the  market  attractive  to  financial  

organizations  as  well  as  private  investors.  Frequent  activity  on  forex  web  forums  and  a  vast  amount  

of  material  being  published  on  the  subject  of  technical  analysis  of  the  forex  market  indicate  a  

widespread  belief  in  the  market  being  predictive  to  some  degree  if  appropriate  tools  are  applied.  

Accordingly,  numerous  approaches  to  trading  strategy  design  have  been  taken  in  attempts  to  

automate  successful  trading  systems.  Variants  of  well  known  indicators,  such  as  moving  averages  

and  trend  channels,  are  commonly  used  in  strategy  development,  but  alternative  approaches  such  as  

genetic  algorithms  that  evolve  to  maximize  profits,  or  neural  networks  that  “learn”  to  do  so,  are  

growing  in  popularity.  (Rosén,  2011)  

As  the  study  aims  to  investigate  opportunities  in  optimal  use  of  strategies  based  on  commonly  

known  indicators,  emphasis  has  been  put  on  researching  indicators  that  would  generally  be  referred  

to  as  basic  indicators.  These  indicators  are  founded  on  ideas  that  are  fairly  easily  understood  and  

that  do  not  require  much  trading  experience  or  mathematical  expertise.  

The  view  on  whether  the  fact  that  an  indicator  being  widely  used  affects  its  reliability  varies  among  

technical  analysts.  Writing  about  technical  indicators  in  general,  Neely  and  Weller  (2011)  indicates  

that  continuous  development  of  indicators  is  necessary  by  arguing  that  profit  opportunities  will  

generally  exist  in  financial  markets,  but  that  learning  and  competition  will  gradually  erode  these  

opportunities.  However,  opposite  views  are  introduced  by  Marshall  and  Moubray  (2005),  as  they  present  the  major  strength  of  common  indicators  as  the  fact  that  they  are  widely  used  and  thus  

self-­‐fulfilling  to  some  extent.  Moreover,  full-­‐time  trader  McDonald  (2010)  agrees  with  the  

theoretical  concept  of  self-­‐fulfilling  indicators,  but  dismisses  any  substantial  effects  in  practice  due  

to  the  numerous  ways  of  using  a  specific  indicator.  Given  these  three  different  standpoints,  it  would  

be  hard  to  make  any  assumptions  on  whether  the  strategies  being  used  for  this  study  would  perform  

well  on  its  own  over  a  period  of  time.  Taking  the  standpoint  of  Neely  and  Weller,  the  strategies,  

6  

 

Page 8: Automated Foreign Exchange Trading Strategies: Improving ...771156/FULLTEXT01.pdf · Trading indicators are frequently used among foreign exchange traders in attempts to predict future

being  based  on  commonly  known  indicators,  would  most  probably  show  mediocre  performance.  

However,  taking  the  standpoint  of  Marshall  and  Moubray,  such  strategies  are  likely  to  be  successful  

given  that  the  used  indicators  are  indeed  commonly  used.  Consequently,  no  assumptions  are  being  

made  regarding  the  strategies’  individual  long-­‐term  performances.    

Since  this  study  aims  to  investigate  strategies  based  on  widely  used  indicators,  research  regarding  

such  indicators  was  conducted.  The  following  sections  presents  the  fundamentals  of  the  MACD  and  

LRTC  indicators.  

3.1  MOVING  AVERAGE  CONVERGENCE-­‐DIVERGENCE  (MACD)  A  moving  average  is  the  arithmetic  mean  of  data  observations  equally  spaced  in  time.  As  new  data  is  

available,  the  average  is  recomputed  by  appending  the  new  data  and  removing  the  oldest  data  from  

the  series.  

In  technical  analysis,  moving  averages  are  commonly  used  as  indicators  to  highlight  trends  and  

momentum  in  the  currency  market.  Popular  variations  of  this  indicator  includes  simple  and  

exponential  moving  averages,  as  well  as  moving  average  convergence-­‐divergence.  

The  Moving  Average  Convergence-­‐Divergence  (MACD)  indicator  is  possibly  the  most  widely  used  

variation  of  the  moving  average  indicators,  mainly  because  of  its  versatility.  MACD  is  defined  as  the  

difference  between  two  Exponential  Moving  Averages  (EMA),  one  reflecting  a  short-­‐term  trend  

subtracted  by  another  reflecting  a  long-­‐term  trend,  these  periods  are  generally  set  to  12  and  26  

timeframes.  By  analyzing  the  characteristics,  such  as  the  slopes  and  crossovers,  of  a  MACD  indicator,  current  trends  and  patterns  in  the  market  can  be  derived.  Additionally,  another  EMA  is  applied  to  the  

MACD  curve  itself,  called  the  signal  line,  usually  interpreted  such  that  whenever  the  signal  line  

crosses  the  MACD,  a  directional  change  in  the  market  is  soon  about  to  happen.  (Appel  &  Appel,  2008)  

 

7  

 

Page 9: Automated Foreign Exchange Trading Strategies: Improving ...771156/FULLTEXT01.pdf · Trading indicators are frequently used among foreign exchange traders in attempts to predict future

 figure  1:  Visualization  of  the  MACD  indicator  on  EUR/USD,  showing  the  EMA’s  used  for  calculation,  the  MACD  itself  and  the  signal  

line.  

 

Possible  benefits  of  MACD  come  from  its  characteristics  being  able  to  identify  both  momentum  and  

trend.  The  indicator  will  eventually  follow  the  movements  of  a  currency  pair  if  given  enough  time.  

The  immediate  drawback  would  be  potentially  slow  adjustment  times  to  sudden  changes  in  the  

market.  Since  MACD  uses  absolute  subtraction  in  its  calculation,  a  long-­‐term  analysis  comparison  of  

two  MACD  levels  is  potentially  deceptive  in  cases  when  the  currency  pair  has  had  an  exponential  

change.  (Murphy,  1999)  

3.2  LINEAR  REGRESSION  TREND  CHANNEL  (LRTC)  A  trend  channel  consists  of  two  linear  trend  lines,  commonly  referred  to  as  support  and  resistance  

lines.  In  the  case  of  LRTC,  each  of  these  lines  are  calculated  using  the  least  square  of  local  extreme  

points,  peaks  for  the  resistance  and  troughs  for  the  support  trend  line.  This  way,  in  the  event  of  a  

downward  trend  (as  depicted  in  figure  3),  the  resistance  line  connects  a  series  of  low  highs  (peaks  in  

a  downward  trend)  while  the  support  line  connects  a  series  of  low  lows  (troughs  in  a  downward  

trend).    

According  to  technical  analysis  theories,  the  rate  will  be  trapped  inside  the  lines,  recoiling  from  both  

8  

 

Page 10: Automated Foreign Exchange Trading Strategies: Improving ...771156/FULLTEXT01.pdf · Trading indicators are frequently used among foreign exchange traders in attempts to predict future

levels,  or  breaking  through  one,  causing  the  market  to  break  away  from  the  area  of  congestion.  

Trend  channels  are  thought  to  be  the  most  common  method  of  identifying  trends  in  the  currency  

market;  this  is  primarily  because  of  its  intuitive  visualization  of  a  trend,  giving  distinct  points  of  

directional  market  changes  to  an  eventual  trading  strategy’s  algorithm.  (Rosén,  2011)  

 

 

figure  2:  Visualization  of  LRTC,  including  the  Stop-­loss,  Take-­profit  levels,  and  high  and  low  fractals  (blue/red  arrows).  

 

3.3  SIMILAR  STUDIES  Prominent  studies  concerning  the  subject  of  optimizing  automatic  trading  strategies  tend  to  

construct  optimal  strategies  by  adjusting  input  parameters  to  reach  optimal  backtesting  

performance.  Maymin  &  Maymin  (2011)  aim  to  provide  traders  with  a  general  framework  for  

constructing  the  best  strategy  for  a  given  historical  indicator  by  interpreting  strategies  as  

mathematical  functions.  In  short,  claiming  to  enhance  the  performance  of  any  strategy  by  

maximizing  the  corresponding  function.  

Optimization  utilities  are  included  in  multiple  trading  platforms.  Such  tools  optimizes  strategies  by  

9  

 

Page 11: Automated Foreign Exchange Trading Strategies: Improving ...771156/FULLTEXT01.pdf · Trading indicators are frequently used among foreign exchange traders in attempts to predict future

running  them  on  historical  data  numerous  times,  modifying  the  input  parameters  to  obtain  the  

highest  net  profit.    

What  separates  this  study  from  other  studies  is  mainly  its  approach  to  add  an  exterior  constraint  to  

existing  strategies  as  opposed  to  modifying  them  or  optimizing  their  input  parameters.  

4.  METHOD  The  method  of  this  report  can  shortly  be  summarized  to  consist  of  the  following  components:  

● Implementation  of  two  simple  strategies,  each  being  based  on  one  indicator.  

● Backtesting  of  the  strategies  on  historical  data  from  Jan  1,  2005  to  Dec  31,  2008.  

● Analysis  regarding  during  what  periods  the  strategies  were  profitable.  

● Analysis  to  find  correlations  between  strategy  performance  and  market  patterns.  

● Implementation  of  constrained  strategies  that  takes  such  correlations  into  account  during  

execution  by  applying  thresholds  that  prevent  the  strategies  to  open  orders  when  the  market  

conditions  are  deemed  as  unfavorable.  

● Backtesting  of  the  strategies  with  and  without  applied  thresholds  on  historical  data  from    Jan  

1,  2009  to  Dec  31,  2012.  

In  accordance  with  the  generality  of  the  problem  definition,  the  chosen  course  of  action  was  

developed  in  an  attempt  to  define  a  procedure  that  could  be  applied  to  any  strategy.  The  above  steps  

are  intended  to  present  an  approach  to  how  widely  used  indicators  can  be  analyzed  to  find  market  

patterns  during  which  the  indicator  performs  well.  Finding  such  patterns  enables  development  of  

conditional  restrictions  (further  referred  to  as  thresholds)  to  enhance  strategy  profits,  providing  an  

answer  to  the  problem  definition.  Accordingly,  the  method  of  choice  was  considered  appropriate  for  

the  study.  

The  two  initially  developed  trading  strategies  were  based  on  the  two  conceptually  different  publicly  

known  and  widely  used  indicators,  MACD  and  LRTC,  respectively  (Schlossberg,  2006)  .  The  

backtesting  of  these  two  strategies  was  then  performed  using  the  EUR/USD  instrument  for  the  

period  of  Jan  1,  2005  to  Dec  31,  2012,  a  period  considered  long  enough  to  eliminate  major  

abnormalities  in  the  data  set  caused  by  large  financial  events.  Moreover,  the  EUR/USD  currency  pair  

was  considered  to  have  sufficient  volatility  to  provide  significant  strategy  activity  during  

backtesting.  Further  details  on  the  course  of  actions  are  described  in  detail  below.  

4.1  IMPLEMENTING  THE  STRATEGIES  The  strategies  were  written  in  MQL4,  a  script  language  specifically  designed  for  MetaTrader  4,  a  

trading  platform  common  among  traders  and  supported  by  multiple  brokers.  Both  strategies  were  

implemented  to  act  on  every  market  change  being  broadcasted  by  the  broker;  this  is  referred  to  as  

10  

 

Page 12: Automated Foreign Exchange Trading Strategies: Improving ...771156/FULLTEXT01.pdf · Trading indicators are frequently used among foreign exchange traders in attempts to predict future

acting  on  every  tick.    

A  common  trading  amount  was  set  to  0.1  lots  for  each  trade,  using  a  leverage  of  200.  In  practice,  this  

means  a  traded  amount  of  50  USD  per  trade,  reacting  to  market  changes  enhanced  by  a  factor  of  200.  

The  two  indicators  to  base  the  strategies  on  were  chosen  to  be:  

● Moving  Average  Convergence-­‐Divergence  (MACD)  

● Linear  Regression  Trend  Channel  (LRTC)  

The  MACD  strategy  was  implemented  using  the  iMACD  indicator,  available  in  the  MQL4  indicator  

library,  whereas  the  trend  channel  indicator  and  strategy  were  implemented  without  use  of  existing  

library  indicators.  Having  the  sole  purposes  of  opening  buy  or  sell  positions  in  accordance  with  the  

indications  from  the  corresponding  indicator,  the  strategies  were  simply  tools  to  apply  the  indicator  

output  in  the  market.  The  logic  that  defines  the  strategies,  representing  one  indicator  each,  is  

presented  below.  

4.1.1  MACD  STRATEGY  The  MACD  indicator  follows  a  widely  used  convention  (Murphy,  1999)  of  using  12  bars  for  the  

short-­‐term  EMA  interval  and  26  bars  for  the  long-­‐term  EMA  interval.  The  bar  period  used  for  

execution  was  M5.    

For  each  trade  made  by  the  strategy,  a  trailing  stop-­‐loss  was  set  to  3  pips  and  a  static  take-­‐profit  set  

to  5  pips.  Trailing  meaning  that  the  stop-­‐loss  was  updated  to  never  be  more  than  3  pips  from  the  

current  market  rate.  This  was  achieved  by  moving  the  stop-­‐loss  in  the  direction  of  the  trade  as  the  

rate  changes.  

Additionally,  a  moving  average  applied  on  the  26  bar  interval  determines  whether  the  market  rate  

has  upwards  or  downwards  momentum.  

The  underlying  logic  of  the  MACD  strategy  was  specified  as  follows:  

A  buy  order  is  executed  if:  

● The  MACD  value  is  negative,  and  

● the  MACD  value  has  just  crossed  the  signal  line  in  the  positive  direction,  and  

● the  MA  of  the  long-­‐term  period  has  upwards  momentum.  

A  sell  order  is  executed  on  the  exact  opposite  conditions,  that  is  if:  

● The  MACD  value  is  positive,  and  

● the  MACD  value  has  just  crossed  the  signal  line  in  the  negative  direction,  and  

11  

 

Page 13: Automated Foreign Exchange Trading Strategies: Improving ...771156/FULLTEXT01.pdf · Trading indicators are frequently used among foreign exchange traders in attempts to predict future

● the  MA  of  the  long-­‐term  period  has  downwards  momentum.    

A  close  order  on  an  open  buy  position  is  executed  if:  

● The  MACD  value  is  positive,  and    

● the  MACD  value  has  just  crossed  the  Signal  Line  in  the  negative  direction.  

figure  3:  Buy  order  scenarios  and  their  respective  close  order  scenarios  for  the  MACD  strategy.  

 

A  close  order  on  an  open  sell  position  is  executed  if:  

● The  MACD  value  is  negative,  and    

● the  MACD  value  has  just  crossed  the  signal  line  in  the  positive  direction.  

12  

 

Page 14: Automated Foreign Exchange Trading Strategies: Improving ...771156/FULLTEXT01.pdf · Trading indicators are frequently used among foreign exchange traders in attempts to predict future

figure  4:  Sell  order  scenarios  and  their  respective  close  order  scenarios  for  the  MACD  strategy.  

 

All  open  orders  may  also  be  closed  as  a  result  of  the  rate  crossing  the  specified  take-­‐profit  or  trailing  

stop-­‐loss.  

Lastly,  a  condition  was  set  to  disallow  the  strategy  having  more  than  one  open  position.  This  was  

simply  implemented  such  that  potential  buy  or  sell  signals  were  ignored  if  an  order  was  already  

open.  

4.1.2  LRTC  STRATEGY  The  implemented  LRTC  indicator  uses  high  and  low  fractals  (defined  in    terminology)  as  estimations  

of  peaks  and  troughs  in  order  to  calculate  the  high  and  low  linear  regression  trend  lines.  

The  strategy  considers  fractals  among  the  72  previous  M5  bars,  motivated  by  the  assumption  that  

five  hours  are  enough  to  get  a  reasonably  large  set  of  fractals  for  the  M5  period  and  thus  determine  a  

reliable  channel  (Schlossberg,  2006).  Both  trend  lines  were  calculated  using  conventional  linear  

regression  on  the  two  sets  of  fractals.  As  the  main  purpose  of  the  strategy  was  to  trade  in  accordance  

with  the  indications  from  an  LRTC  indicator,  the  ideas  of  the  implementation  were  based  on  the  

assumptions  that  trends  are  common  market  patterns  and  that  the  rate  has  a  tendency  to  stay  

between  the  two  trend  lines.  The  conditions  listed  below  were  constructed  with  the  intent  of  

13  

 

Page 15: Automated Foreign Exchange Trading Strategies: Improving ...771156/FULLTEXT01.pdf · Trading indicators are frequently used among foreign exchange traders in attempts to predict future

achieving  such  trading  behavior.  

Conditions  that  must  be  fulfilled  in  order  to  consider  opening  a  position  are:  

● There  must  be  at  least  two  high  fractals,  forming  the  high  trend  line.  

● There  must  be  at  least  two  low  fractals,  forming  the  low  trend  line.  

● Both  trend  lines  must  slope  in  the  same  direction  (positive  or  negative  slope).  

● In  the  case  of  an  upward  trend,  the  slope  of  the  low  trend  line  must  be  at  least  5  points  per  

M5  period.  

● In  the  case  of  a  downward  trend,  the  slope  of  the  high  trend  line  must  be  at  least  -­‐5  points  per  

M5  period.  

● The  vertical  difference  between  the  current  trend  line  rates  is  at  least  10  pips.  

Given  that  the  above  conditions  are  fulfilled:  

A  buy  order  is  executed  if:  

● The  slope  of  both  lines  are  positive,  and  

● the  current  rate  has  just  crossed  the  low  trend  line  in  the  negative  direction.    

A  sell  order  is  executed  if:  

● The  slope  of  both  lines  are  negative,  and  

● the  current  rate  has  just  crossed  the  high  trend  line  in  the  positive  direction.  

The  triggering  conditions  for  opening  a  position  relies  on  the  assumed  tendency  for  the  rates  to  stay  

inside  the  channel.  

A  close  order  on  an  open  buy  position  is  executed  if:  

● The  current  rate  has  just  crossed  the  stop-­‐loss  

● the  current  rate  has  just  crossed  the  take-­‐profit.  

A  close  order  on  an  open  sell  position  is  executed  if:  

● The  current  rate  has  just  crossed  the  stop-­‐loss  

● the  current  rate  has  just  crossed  the  take-­‐profit.  

14  

 

Page 16: Automated Foreign Exchange Trading Strategies: Improving ...771156/FULLTEXT01.pdf · Trading indicators are frequently used among foreign exchange traders in attempts to predict future

figure  5:  Buy  order  scenarios  and  their  respective  close  order  scenarios  for  the  LRTC  strategy.  Includes  the  scenario  where  a  close  order  is  caused  by  the  stop-­loss  line.  

 

Similar  to  the  MACD  strategy,  a  condition  was  set  to  disallow  the  strategy  having  more  than  one  

open  position.  This  was  simply  implemented  such  that  potential  buy  or  sell  signals  were  ignored  if  an  

order  was  already  open.  

Furthermore,  an  open  position  is  continuously  adjusted  with  regard  to  stop-­‐loss  and  take-­‐profit:    

● The  stop-­‐loss  is  updated  to:  

o Stay  3  pips  below  the  current  low  trend  line  rate  in  the  case  of  a  long  position.  

o Stay  3  pips  above  the  current  high  trend  line  rate  in  the  case  of  a  short  position.  

● The  take-­‐profit  is  updated  to  stay  at  the  rate  between  the  current  trend  line  rates.  

The  update  was  necessary  for  the  strategy  to  fulfill  its  purpose  of  acting  in  accordance  with  the  

trend  channel  indicator  since  the  trend  slopes  and  the  rates  are  expected  to  stay  between  the  trend  

lines.  

15  

 

Page 17: Automated Foreign Exchange Trading Strategies: Improving ...771156/FULLTEXT01.pdf · Trading indicators are frequently used among foreign exchange traders in attempts to predict future

 

4.2  BACKTESTING  AND  RETRIEVING  RESULTS  Backtesting  of  strategies  were  done  using  the  MetaTrader  backtesting  utility  to  generate  a  report  

with  position  openings  and  closings,  order  types  and  profits  for  each  trade.  The  backtesting  was  

performed  on  tick  data  in  an  attempt  to  achieve  as  realistic  results  as  possible.  However,  as  spreads  

rely  on  market  liquidity  that  would  be  affected  by  trades  performed  by  the  strategy  itself,  historical  

liquidity  cannot  be  simulated.  Thus,  a  constant  spread  of  1  pip  was  set  on  the  grounds  that  spreads  in  

the  EUR/USD  market  commonly  lies  around  this  level.  

Both  strategies  were  run  on  historical  data  of  the  period  Jan  1,  2005  to  Dec  31,  2008.  The  period  of  

Jan  1,  2009  to  Dec  31,  2012  was  spared  for  future  backtesting  of  the  theories  developed  using  the  

result  from  the  first  period.  This  approach  was  taken  in  an  attempt  to  minimize  the  risk  of  the  

analysis  ending  up  in  mere  curve  fitting  (Larsen,  2010).  

4.2.1  ANALYSIS  ON  PROFITABLE  PERIODS  When  determining  during  what  periods  strategies  should  be  active  to  maximize  profits,  trades  for  

each  strategy  were  grouped  such  that  profits  from  orders  that  were  placed  within  the  same  hour  

were  summed  together,  representing  the  total  profits  for  that  strategy  and  hour.  The  hour  intervals  

were  considered  as  the  minimum  time  unit  for  a  strategy  to  be  active  for.  In  practice,  this  would  

imply  restricting  a  strategy  to  trade  only  during  the  interval,  yet  allowing  it  to  modify  already  open  

positions  outside  the  interval  (such  as  adjusting  the  stop-­‐loss  and  take-­‐profit).  The  decision  to  group  

profits  made  within  the  same  hour  was  made  in  order  to  limit  the  amount  of  data  to  handle  for  the  

analysis.  As  the  study  aims  to  recognize  strategy  behavior  in  periods  of  different  market  conditions,  

an  assumption  was  made  that  an  hour,  given  the  eight  year  test  period,  is  a  small  enough  time  unit  for  

many  significant  changes  in  market  patterns  to  be  noticeable.  

4.2.2  STRATEGY  PERFORMANCE  AND  MARKET  PATTERNS  The  output  resulting  from  the  analysis  on  profitable  periods  were  illustrated  visually  in  charts  that  

were  programmed  to  show  market  rates  as  well  as  the    accumulated  profit  (the  sum  of  all  previous  

hourly  profits)  for  each  strategy.  This  utility  was  implemented  to  provide  a  visual  representation  of  

the  data  gathered  up  until  this  point  in  order  to  assist  in  the  attempts  to  find  correlations  between  

market  patterns  and  strategy  performance.  

4.2.3  STRATEGY  ACTIVATION    For  each  strategy,  the  visual  representation  of  the  market  rates  and  strategy  performance  was  

examined  to  identify  market  patterns  during  which  the  strategy  performed  well.  The  identified  

market  patterns  were  interpreted  numerically  such  that  strategy  profit  and  the  value  depicting  the  

market  conditions  were  assumed  to  correlate  (this  value  will  further  be  referred  to  as  the  strategy’s  

correlation  quantity).  For  each  hour  of  historical  data,  the  strategy  performance  was  plotted  against  its  correlation  quantity  for  the  same  period.  The  result  was  examined  to  determine  a  threshold,  

defined  in  terms  of  the  value  depicting  the  market  conditions,  which  had  to  be  exceeded  for  the  

strategy  to  be  active.  

16  

 

Page 18: Automated Foreign Exchange Trading Strategies: Improving ...771156/FULLTEXT01.pdf · Trading indicators are frequently used among foreign exchange traders in attempts to predict future

The  correlation  quantity  for  the  MACD  strategy  was  chosen  as  the  standard  deviation  of  the  close  

rates  of  the  previous  72  M5  bars.  In  the  same  way,  the  correlation  quantity  for  the  LRTC  strategy  

was  chosen  as  the  absolute  value  of  the  slope  of  the  linear  regression  trend  line  of  the  close  rates  of  

the  previous  72  M5  bars.  The  reasoning  behind  these  decisions  are  described  in  the  results  section.  

 

 

figure  6:  Visualization  of  the  period  where  correlation  quantity  is  calculated  (red)  and  the  current  active  strategy  period  (green).  The  time  vector  (x-­axis)  is  described  in  discrete  one  hour  intervals  and  the  y-­axis  is  the  EUR/USD  rate.  

 

The  threshold  values  for  each  strategy,  being  defined  in  terms  of  the  strategy’s  correlation  quantity,  

was  determined  by  the  following  procedure:  

● The  trades    for  each  strategy  were  sorted  descendingly  with  regard  to  the  strategy’s  

correlation  quantity  corresponding  to  each  trade.  

● The  profits  were  then  accumulatively  summed  together,  such  that  the  accumulated  profit  for  

each  trade  was  the  sum  of  all  profits  of  trades  with  a  higher  or  equal  correlation  quantity.  

● The  threshold  was  chosen  as  the  lowest  correlation  quantity  of  the  trades  with  a  positive  

accumulated  sum.  

Choosing  the  threshold  this  way  was  considered  reasonable  as  the  total  profits  of  the  backtest  

period  were  clearly  negative  (see  result  section  for  further  details),  although  the  total  profits  for  the  

trades  with  a  correlation  value  higher  than  or  equal  to  the  threshold  were  positive,  indicating  that  

market  conditions  were  more  profitable  with  a  correlation  quantity  above  the  threshold.  

17  

 

Page 19: Automated Foreign Exchange Trading Strategies: Improving ...771156/FULLTEXT01.pdf · Trading indicators are frequently used among foreign exchange traders in attempts to predict future

The  threshold  for  the  correlation  quantity  of  the  LRTC  strategy  (being  the  absolute  value  of  slope  of  

the  linear  regression  trend  channel  from  the  last  72  M5  bars  as  previously  described)  was  calculated  

analogously  as  the  relation  between  the  slope  and  profits  was  similar  to  the  corresponding  

relationship  of  the  MACD  strategy.  

4.2.4  BACKTESTING  WITH  THRESHOLDS  Finally,  after  calculating  threshold  values  assumed  to  improve  strategy  performance,  backtesting  

was  done  on  the  period  of  Jan  1,  2009  to  Dec  31,  2012.  The  result  from  the  final  backtesting  provides  

an  indication  to  whether  the  assumed  correlations  between  strategy  performance  and  market  

patterns  have  any  validity  or  if  the  correlations  were  simply  the  outcome  of  mere  curve  fitting  over  

the  Jan  1,  2005  to  Dec,  31  2008  period.  

5.  RESULTS  Conducting  the  previously  described  method,  results  where  established  and  are  presented  below.  

Most  results  are  presented  in  charts  or  tables  to  be  easily  assimilated.  

5.1  BACKTEST  The  backtest  result,  depicted  in  figure  7,  shows  the  accumulated  profits  (being  significantly  

negative)  for  the  MACD  and  LRTC  strategy  during  the  period  Jan  1,  2005  to  Dec  31,  2008.  

 

 

figure  7:  Backtest  results.  Accumulated  profits  for  strategies  MACD  and  LRTC  during  the  period  Jan  1,  2005  to  Dec  31,  2008.  

   

18  

 

Page 20: Automated Foreign Exchange Trading Strategies: Improving ...771156/FULLTEXT01.pdf · Trading indicators are frequently used among foreign exchange traders in attempts to predict future

5.2  MARKET  PATTERNS  With  the  obtained  backtest  result,  the  strategies’  profits  were  plotted  parallel  to  the  market  rates  to  

provide  a  visual  representation  of  what  market  conditions  seemed  favorable  for  each  strategy.  

 

 

figure  8:  Market  rates  with  accumulated  profits  for  strategies  MACD  and  LRTC  during  the  period  Jan  1,2005  to  Dec  31,  2008.  

 

 

Indications  were  that  the  MACD  strategy  generated  higher  profits  during  volatile  periods,  and  the  

LRTC  strategy  generated  higher  profits  during  trending  periods.  As  mentioned  in  the  methods  

section,  the  correlation  quantities  were  chosen  as  follows:  

 

● The  correlation  quantity  for  the  MACD  strategy  was  chosen  as  the  standard  deviation  of  

close  prices  of  the  last  72  M5  bars  ,  being  a  measurement  of  market  volatility  for  the  last  six  

hours.  

● The  correlation  quantity  for  the  LRTC  strategy  was  chosen  as  the  absolute  value  of  the  slope  

of  the  linear  regression  trend  line  of  the  close  prices  of  the  previous  72  M5  bars,  being  a  

measurement  of  market  trend  tendencies  for  the  last  six  hours.  

 

   

19  

 

Page 21: Automated Foreign Exchange Trading Strategies: Improving ...771156/FULLTEXT01.pdf · Trading indicators are frequently used among foreign exchange traders in attempts to predict future

5.3  STRATEGY  PERFORMANCE  CORRELATIONS  The  MACD  (figure  9)  and  LRTC  (figure  10)  strategy  profits  were  plotted  in  scattered  graphs,  to  

visualize  a  potential  correlation  between  the  profit  and  its  correlation  quantity.  

The  correlation  quantity  thresholds  for  each  strategy,  which  were  chosen  in  accordance  with  the  

procedure  described  in  the  methods  section,  are  specified  below  and  represented  in  figure  9  and  10  

with  blue  vertical  lines.  

 

● MACD  standard  deviation  threshold:   0.00209  

● LRTC  linear  regression  trend  line  slope  threshold:   0.00013  

 

 

figure  9:  Profits  for  each  hour  by  the  MACD  strategy,  plotted  against  the  standard  deviation  calculated  for  the  close  rates  of  the  72  M5  bars  previous  to  the  start  of  that  hour.  

20  

 

Page 22: Automated Foreign Exchange Trading Strategies: Improving ...771156/FULLTEXT01.pdf · Trading indicators are frequently used among foreign exchange traders in attempts to predict future

 

figure  10:  Profits  for  each  hour  by  the  LRTC  strategy,  plotted  against  the  slope  of  the  linear  regression  trend  line  for  the  close  rates  of  the  72  M5  bars  previous  to  the  start  of  that  hour.  

 

The  Pearson  correlation  between  the  strategies’  profits  and  their  correlation  quantities  are  depicted  

in  table  2,    together  with  the  confidence  interval  of  the  pearson  correlation  value.    

 

Strategy   Correlation  Quantity   Pearson  Correlation  Value  (PCV)  

Confidence  interval  of  PCV*  

MACD   Standard  Deviation   0.0274   [0.0034,  0.0515]  

LRTC   Trend  Line  Slope   0.0160   [–0.0039,  0.0360]  

table  2:  The  Pearson  Correlation  Values  for  the  assumed  correlations  between  strategy  profits  and  correlation  quantities.  *  Assuming  normal  distribution  and  a  confidence  level  of  95%.  

 

 

   

21  

 

Page 23: Automated Foreign Exchange Trading Strategies: Improving ...771156/FULLTEXT01.pdf · Trading indicators are frequently used among foreign exchange traders in attempts to predict future

5.4  OPTIMIZATION  OF  STRATEGIES  The  accumulated  profit  for  the  MACD  and  LRTC  strategies  using  their  respective  correlation  

quantity  threshold    are  represented  in  figure  10  together  with  the  respective  strategies  without  a  

threshold.  The  LRTC  strategy  with  a  threshold  showed  a  higher  accumulated  profit  than  the  same  

strategy  without  a  threshold,  while  the  MACD  strategy  with  a  threshold  showed  a  lower  

accumulated  profit  than  the  same  strategy  without  a  threshold.  

 

 

figure  11:  Accumulated  profits  of  MACD  and  LRTC  with  and  without  applied  thresholds  during  the  period  of  Jan  1,  2009  to  Dec  31,  2012.  

 

 

 

 

 

22  

 

Page 24: Automated Foreign Exchange Trading Strategies: Improving ...771156/FULLTEXT01.pdf · Trading indicators are frequently used among foreign exchange traders in attempts to predict future

6.  DISCUSSION  Analysis  and  thoughts  regarding  methodology,  results  and  limitations  of  this  study  are  presented  

below.  Many  of  the  addressed  subjects  and  concerns  originates  from  the  fact  that  the  time  provided  

to  conduct  the  study  was  limited.  In  general,  better  accuracy  and  more  trustworthy  results  could  

naturally  have  been  achieved  given  more  time  to  examine  the  subject  further.  

6.1  METHOD  Since  the  study  aims  to  investigate  an  alternative  approach  in  strategy  development,  the  conclusion  

would  preferably  be  presented  as  a  general  effect  on  strategy  performance  from  taking  the  

developed  approach  in  an  attempt  to  optimize  any  strategy.  However,  the  method  in  this  study  

cannot  be  considered  general  enough  to  expect  such  an  outcome.  Firstly,  none  of  the  two  developed  

strategies,  MACD  and  LRTC,  can  be  guaranteed  to  show  similar  performance  if  any  of  the  parameters  

for  the  strategy  were  changed  or  if  the  strategy  implementation  was  adjusted  due  to  different  

interpretations  on  how  to  best  respond  to  indications  from  the  initially  chosen  indicators.  Moreover,  

the  performance  further  relies  on  the  period  for  which  the  backtesting  was  performed  on  and,  

fundamentally,  what  two  indicators  that  were  chosen  for  this  study  to  begin  with.  

The  method  used  to  derive  correlations  between  market  patterns  and  strategy  performance  should  

be  considered  a  potential  source  of  inaccuracy.    Knowledge  of  strategy  implementation  when  

searching  for  correlations  between  market  patterns  and  strategy  profit  introduces  the  risk  of  a  

confirmation  biased  conclusion  regarding  what  correlation  is  the  most  prominent.  A  more  

trustworthy  approach  would  be  to  utilize  an  algorithm  to  find  correlations.  However,  although  this  

risk  is  important  to  note,  it  was  assumed  to  have  a  small  impact  on  this  study  since  the  two  strategies  

used  were  implemented  based  on  common  indicators,  each  with  documented  behavior  in  various  

market  patterns.  

Due  to  the  many  factors  potentially  affecting  the  outcome  of  this  study,  the  methodology  should  not  

be  considered  a  general  recipe  to  optimize  any  trading  strategy,  but  rather  as  a  method  to  gather  

information  to  be  used  in  eventual  further  analysis  regarding  strategy  performance  improvement.  

6.2  RESULTS  The  initial  backtesting  of  the  two  strategies,  depicted  in  figures  7  and  8,  shows  poor  performance  

with  no  tendencies  of  making  profit  before  2008.  However,  going  into  2008,  both  strategies  begin  to  

produce  profits.  This  could  be  an  effect  of  the  dramatic  market  change  caused  by  the  financial  crisis  

during  the  period.  It  is  important  to  note  that  strategy  profitability  is  of  low  importance  in  this  study  

since  it  aims  for  improvement  rather  than  explicit  profits.  However,  variations  in  strategy  

performance  over  different  periods  are  important  in  the  process  of  finding  correlations  between  

strategy  performance  and  market  patterns.  

Before  going  into  details  about  the  result,  it  is  important  to  note  that  any  strategy  active  in  the  

foreign  exchange  market  would  affect  the  market  as  every  trade  has  an  impact  on  market  liquidity.  

23  

 

Page 25: Automated Foreign Exchange Trading Strategies: Improving ...771156/FULLTEXT01.pdf · Trading indicators are frequently used among foreign exchange traders in attempts to predict future

As  previously  stated,  the  effects  from  this  phenomena  are  nearly  impossible  to  simulate  and  results  

from  backtesting  must  therefore  be  viewed  as  potentially  misleading.  However,  due  to  the  relatively  

small  trading  amount  used  to  conduct  this  study,  the  strategies’  effects  on  market  liquidity  are  

negligible.    

Moreover,  the  constant  spread  used  for  the  backtesting  poses  a  potential  error  as  it  does  not  reflect  a  

real  market  situation.  The  effects  from  applying  constant  spread  cannot  be  assumed  to  be  negligible.  

However,  as  the  constant  spread  of  1  pip  was  based  on  average  spreads  for  the  EUR/USD  instrument  

the  long  term  effects  should  be  small  as  profits  from  low  spreads  should  even  out  losses  from  high  

spreads.  

The  final  backtest  result  (shown  in  figure  11)  indicates  that  the  introduction  of  thresholds  did  not  

have  a  significant  effect  on  strategy  performance.  From  studying  the  performance  with  and  without  

thresholds,  it  can  be  derived  that  the  general  characteristics  of  the  performance  were  withheld.  One  

could  assume  that  the  impact  from  applying  thresholds  would  differ  depending  on  the  strategy  and  

period,  but  to  draw  such  a  conclusion  would  require  analysis  of  more  sample  strategies  and  more  

historical  data.  

As  the  thresholds  were  determined  from  backtesting  over  the  period  of  Jan  1,  2005  to  Dec  31,  2008,  

they  naturally  had  a  positive  effect  on  strategy  performance  during  that  period.  This  is  shown  in  

figure  12  (below),  which  clearly  indicates  a  positive  impact  from  applying  the  threshold.  However,  

no  positive  impact  is  indicated  in  figure  11,  showing  the  same  results  but  for  the  period  of  Jan  1,  

2009  to  Dec  31,  2012.  This  can  be  viewed  as  an  example  of  curve  fitting    for  the  interval  initially  

used  to  develop  theories.  It  is  completely  rational  that  threshold  values,  causing  occasional  

deactivation  of  strategies,  show  positive  results  when  backtests  are  ran  over  a  period  for  which  the  

general  trend  of  the  original  strategy  was  clearly  negative.  However,  if  the  thresholds  were  merely  

blocking  trades  at  random,  strategies  with  active  thresholds  would  simply  cause  the  accumulated  

profits  to  be  closer  to  zero  than  the  same  strategies  without  thresholds,  regardless  of  whether  the  

strategy  was  profiting  or  losing.  Figure  11  indicates  that  this  is  not  the  case  since  the  general  

characteristics  of  the  strategy  performance  were  withheld  with  active  thresholds  during  the  shown  

period.  Thus,  even  if  the  thresholds  were  not  able  to  enhance  profits  of  an  already  profiting  strategy,  

indications  are  that  the  thresholds  used  for  this  study  had  some  sort  of  relevance  for  strategy  

performance,  rather  than  just  randomly  blocking  trades.  Further,  comparing  figure  11  and  12,  it  is  

reasonable  to  believe  that  the  thresholds  in  this  study  could  have  an  ability  of  cutting  of  the  really  

bad  periods  with  none  or  only  a  small  tradeoff  in  profits  during  profitable  periods.  

 

24  

 

Page 26: Automated Foreign Exchange Trading Strategies: Improving ...771156/FULLTEXT01.pdf · Trading indicators are frequently used among foreign exchange traders in attempts to predict future

 

figure  12:  Accumulated  profits  of  MACD  and  LRTC  with  and  without  applied  thresholds  during  the  period  of  Jan  1,  2005  to  Dec  31,  2008.  

 

6.3  LIMITATIONS  Certain  aspects  regarding  the  study  were  estimated  to  have  an  impact  on  the  result  of  varying  

degree.  The  most  limiting  factor  is  the  fact  that  no  more  than  two  widely  used  indicators  have  been  

subject  to  analysis.  As  factors  such  as  indicator  parameters,  choice  of  currency  pair  and  the  chosen  

time  interval  for  backtesting  the  strategies  naturally  affect  the  results  of  this  study,  limitations  in  the  

implementation  of  strategies  and  indicator  parameters  were  necessary  to  consider.  Only  simple  

approaches  to  indicator-­‐based  strategies  have  been  pursued  in  order  to  gain  the  most  representative  

depiction  on  two  of  the  most  common  public  indicators  used  in  strategies  during  the  2005-­‐2012  

period.  

Rationally,  using  a  larger  set  of  in  indicators  and  including  more  advanced  strategies,  would  

potentially  have  lead  to  different,  more  detailed,  results  and  a  more  substantial  conclusion  as  to  how  

strategies  can  be  optimized  to  maximize  profit.  However,  taking  more  indicators  and  strategies  into  

account  would  require  a  greater  amount  of  time  assigned  for  this  study.    

Another  limitation  that  was  applied  was  the  fact  that  the  only  instrument  used  was  EUR/USD.  Also,  

the  period  for  historical  testing  was  limited  to  the  years  2005-­‐2012  and  the  strategy  profits  were  

analyzed  on  an  hourly  basis,  meaning  that  profits  from  trades  initiated  within  the  same  hour  were  

summed  together.  These  limitations  were  established  since  EUR/USD  is  the  largest  instrument  

regarding  trading  volumes,  hence  being  likely  to  provide  high  liquidity,  low  spreads  and  minimal  

impact  from  fundamental  analysis  (Schlossberg,  2006).  Moreover,  the  decision  to  analyze  on  an  

hourly  basis  was  motivated  by  the  needs  for  a  substantial  quantity  of  data  in  order  to  perform  the  

analysis  for  characterizing  strategy  behavior,  still  limiting  the  data  to  some  extent.  As  the  used  

25  

 

Page 27: Automated Foreign Exchange Trading Strategies: Improving ...771156/FULLTEXT01.pdf · Trading indicators are frequently used among foreign exchange traders in attempts to predict future

indicators  are  highly  scalable  according  to  the  technical  analysis  interpretation  (Chen,  2009),  the  

period  intervals  were  not  viewed  as  problematic.  

Lastly,  having  indicators  depending  solely  on  technical  analysis,  no  impact  of  fundamental  analysis  

on  the  EUR/USD  market  has  been  taken  into  account  in  the  results  and  analysis.  This  introduces  a  

potential  risk  of  misleading  results  caused  by  aspects  such  as  corporate  and  political  events  affecting  

the  currency  market.  

6.4  CONCLUSION  The  result  indicates  that  the  conditional  restrictions  applied  in  this  study,  being  thresholds  for  

strategy  activation,  did  not  have  a  significant  effect  on  strategy  performance.  From  studying  the  

accumulated  profits  both  with  and  without  thresholds,  it  can  be  derived  that  the  general  

characteristics  of  the  performance  were  withheld.  Consequently,  it  cannot  be  concluded  that  this  

study  provides  a  reliable  method  of  enhancing  profits  through  applying  restrictions  to  foreign  

exchange  strategies.  

Expecting  significant  increases  in  profit  would  not  be  reasonable  without  using  more  reliable  

methods  for  analyzing  the  correlations  between  strategy  performance  and  market  patterns.  

However,  albeit  being  small,  the  impact  from  applying  simple  conditional  restrictions,  such  as  the  

thresholds  developed  in  this  study,  motivates  further  research  on  advantages  from  conditional  

restrictions.  

To  conclude,  this  study  can  be  viewed  upon  as  introducing  a  new  approach  to  develop  and  apply  

conditional  restrictions  with  a  future  potential  of  improving  performance  of  foreign  exchange  

strategies.  

 

   

26  

 

Page 28: Automated Foreign Exchange Trading Strategies: Improving ...771156/FULLTEXT01.pdf · Trading indicators are frequently used among foreign exchange traders in attempts to predict future

7.  REFERENCES  Appel,  G.,  &  Appel  (2008).  M.  A  Quick  Tutorial  in  MACD:  Basic  Concepts.  www.systemsandforecasts.com.  

Chen,  J.  (2009).  Essentials  of  Foreign  Exchange  Trading.  Hoboken,  New  Jersey:  John  Wiley  &  Sons,  Inc.  

Larsen  I.,  J(2010).  Predicting  Stock  Prices  Using  Technical  Analysis  and  Machine  Learning,  Norwegian  University  of  Science  and  Technology.  

Marshal,  K.,  &  Moubray,  R.  (2005).  Practical  Fibonacci  Methods  for  Forex  Trading.  Forex  Systems  Research  Company.  

Maymin,  P.  Z.,  &  Maymin,  Z.  G  (2011).  Constructing  the  Best  Trading  Strategy:  A  New  General  Framework.  New  York:  NYU-­‐Polytechnic  Institute.  

McDonald,  N  (2010).  Fibonacci  Retracements.  www.traders-­‐mag.com.  

Murphy,  J.  (1999).  Technical  Analysis  of  the  Financial  Markets.  New  Jersey:  Prentice  Hall  Press.  

Neely,  C.  J.,  &  Weller,  P.  A.  (2011).  Lessons  from  the  Evolution  of  Foreign  Exchange  Trading  Strategies  .  St.  Louis:  FEDERAL  RESERVE  BANK  OF  ST.  LOUIS.  

Rosén,  T.  (2011).  Winning  Trading.  Kristianstad:  Vinnarbyrån.  

Ruggiero  Jr.,  M.  A.  (2011).  How  to  backtest  trading  systems  and  avoid  curve  fitting.  Futures  Magazine.  

Shefrin,  H.  (2002).  Beyond  Greed  and  Fear:  Understanding  Behavioral  Finance  and  the  Psychology  of  Investing.  Oxford  University  Press.  

Schlossberg,  B.  (2006).  Technical  Analysis  of  the  Currence  Market.  Hoboken,  New  Jersey:  John  Wiley  &  Sons,  Inc.  

 

27