UNIVERSITÀ DEGLI STUDI DI TORINO - terna.to.it · UNIVERSITÀ DEGLI STUDI DI TORINO SCHOOL OF...

23
UNIVERSITÀ DEGLI STUDI DI TORINO SCHOOL OF MANAGEMENT AND ECONOMICS SIMULATION MODELS FOR ECONOMICS Final Report “ Bollinger Bands Active Strategy ” Authors: Gerson Massobrio, Federico Pandolfo, Cristian Andres Escobar

Transcript of UNIVERSITÀ DEGLI STUDI DI TORINO - terna.to.it · UNIVERSITÀ DEGLI STUDI DI TORINO SCHOOL OF...

UNIVERSITÀ DEGLI STUDI DI TORINO SCHOOL OF MANAGEMENT AND ECONOMICS

SIMULATION MODELS FOR ECONOMICS

Final Report

“ Bollinger Bands Active Strategy ”

Authors: Gerson Massobrio, Federico Pandolfo, Cristian Andres Escobar

Summary    Introduction    1.   Calibration:  Net  Logo  

1.1   g1_CDA_basic_model  

1.2   Evaluation  of  Bollinger  Bands  parameters  

1.3   Bollinger  Bands  strategy  

1.4   Market  strategy  

1.5   Comparison  between  Bollinger  Bands  strategy  and  

Market  strategy  

1.6   Bollinger  Bands  Agents  effect  on  market  prices  

1.7   Graphs    2   Simulation  Results  

2.1   The  ordinary  strategy    3.   Conclusion    

 

 

 

 

 

 

     

1  

 

Introduction    Bollinger  Bands  model  is  an  application  of  technical  analysis.    Technical  analysis  is  essentially  the  search  for  recurrent  and  predictable  patterns  in  stock  prices.    The  key  to  successful  technical  analysis  is  a  sluggish  response  of  stock  prices  to  fundamental  supply-­‐and-­‐demand  factors.  This  prerequisite,  of  course,  is  diametrically  opposed  to  the  notion  of  an  efficient  market.  The  Dow  theory  ,  named  after  its  creator  Charles  Dow  (who  established  The  Wall  Street  Journal  ),  is  the  grandfather  of  most  technical  analysis.  The  aim  of  the  Dow  theory  is  to  identify  long-­‐term  trends  in  stock  market  prices.    The  Dow  theory  posits  three  forces  simultaneously  affecting  stock  prices:  1. The  primary  trend    is  the  long-­‐term  movement  of  prices,  lasting  from  several  months  to  several  years.  

2. Secondary    or  intermediate  trends    are  caused  by  short-­‐term  deviations  of  prices  from  the  underlying  trend  line.  These  deviations  are  eliminated  via  corrections,  when  prices  revert  back  to  trend  values.  

3. Tertiary    or  minor  trends    are  daily  fluctuations  of  little  importance.  

One  of  the  most  commonly  heard  components  of  technical  analysis  is  the  notion  of  resistance  levels    or  support  levels  .  These  values  are  said  to  be  price  levels  above  which  it  is  difficult  for  stock  prices  to  rise,  or  below  which  it  is  unlikely  for  them  to  fall,  and  they  are  believed  to  be  levels  determined  by  market  psychology.  John  A.  Bollinger  (born  1950)  is  an  American  author,  financial  analist,  contributor  to  the  field  of  technical  analysis  and  the  developer  of  Bollinger  Bands.  His  model  was  developed  in  the  80’s  and  it  consider:  1. Simple  moving  average,  it  is  a  mean  of  fixed  amount  of  data  (often  twenty  days),  generally  it  use  the  closing  prices  of  the  market.  The  term  “moving”  is  referred  to  the  fact  that  are  

     

2  

consider  the  last  willing  prices.  Indeed  moving  average  are  smoothed  lines  that  can  show  more  easily  price  trends.  

2. An  upper  band  and  a  lower  band  which  are  calculated  through  k  times  (generally  k  equal  to  two)  the  volatility  (statistically  is  the  standard  deviation).  

So  the  upper  band  is  obtained  by  adding  to  the  moving  average  k  times  the  standard  deviation,  while  the  lower  band  is  calculated  subtracting  to  the  moving  average  k  times  the  standard  deviation.    If  stock  prices  follow  a  normal  distribution  then  bollinger  bands  with  k=2  will  capture  around  95%  of  price  movements  (level  of  confidence).  The  region  above  the  upper  band  will  be  considered  as  overbought;  the  region  under  the  lower  band  will  be  considered  as  oversold.    So  the  strategy  to  buy  or  sell  will  be:      

• buying  strategy    

PN(t-­‐1)  <  BBNLOW(t-­‐1)    and    PN(t)  >  BBNLOW(t)    

• selling  strategy  

PN(t-­‐1)  >  BBNUP(t-­‐1)    and    PN(t)  <  BBNUP(t)    Where  BBNLOW  and  BBNUP  represent    the  lower  and  the  upper  band  respectively.  In  our  work  we  will  perform  the  active  strategy  applying  the  model  to  a  market  program  simulation  which  generate  instantaneously  stock  prices.    The  computational  aspect  is  to  modify  the  program  g1  in  NetLogo,  which  generates  a  random  market  composed  by  investors  who  sell  or  buy  randomly.  Our  elaborate  cares  to  put  in  the  program,  the  active  strategy,  that  is,  enter  a  code  that  calculates  the  moving  average  and  bollinger  bands,  whereby  then  the  investor  will  decide  whether  to  sell  or  buy.      

 

     

3  

1.   Calibration:  Net  Logo    1.1   g1_CDA_basic_model    Our  work  in  Net  Logo  starts  from  the  program  g1_CDA_basic_model.  This  program  creates  a  variable  number  of  agents  (according  to  the  slider  nRandomAgents)  and  displays  them  orderly.Each  agent  has  an  equal  probabilty  of  being  a  buyer  a  seller,  moreover,  there  is  a  probability  to  pass:  it  is  chosen    using  a  slider.  Next,  the  agent  is  given  a  different  random  price  (specifically,  it  is  composed  by  a  fixed  part  plus  a  random  part).    The  series  of  different  prices  is  ordered  in  a  vector  that  is  sorted  (set  in  increasing  order  for  sellers)  or  reverse  sorted  (set  in  decreasing  order  for  buyers),    and  then  the  first  element  of  the  vector  is  chosen  as  the  market  price.  That  procedure  is  repeated  continuously,  eliminating  the  first  element  of  the  vector  of  prices  (logB  for  buyers  and  logS  for  sellers);  in  this  way  it  is  always  taken  a  diffen  rent  price  as  market  price,  resulting  ithe  formation  of  bid  and  ask  prices  through  an  auction  mechanism.  In  our  analisys  we  will  not  care  about  the  probability  of  being  out  of  market,  (determined  by  the  slider  out-­‐of-­‐market-­‐level  ,that  represents  the  probabilty  of  stopping  the  negotiation  if  the  price  is  under  a  certain  value)  because  in  evaluating  the  Bollinger  Band  model  we  will  need  continuous  trading.            1.2   Evaluation  of  Bollinger  Bands  parameters    To  perform  the  Bollinger  Bands  model  we  first  have  to  compute  the  parameters  needed  in  the  model,  namely  the  moving  average  and  standard  deviation.  Moving  average:  the  number  of  prices  considered  is  determined  by  

     

4  

the  slider  nMovingAverage  (it  can  assume  values  from  0  to  50,  step  1).  Since  each  realization  of  the  moving  average  takes  into  account  the  last  nMovingAverage  market  prices  (exeprice),  we  need  to  insert  every  market  price  in  a  vector  ;  that  vector  at  each  price  formation  cancels  its  first  element  (through  the  command  but-­‐first)  and  inserts  the  new  price  at  the  end  (through  the  command  lput).  In  general  a  shorter  moving  average  is  more  sensitive  to  price  changes,  but  it  is  a  biased  estimator  if  we  consider  long  term  analysis.  On  the  other  side,  a  longer  moving  average  is  less  sensitive  to  price  changes,  but  it  performs  better  in  long  term  analysis.  Standard  deviation:  it  is  the  volatility  of  the  economy.  It  is  calculated  on  the  same  sample  of  the  moving  average,  and  with  the  same  procedure.  Both  formulas  for  moving  average  and  standard  deviation  are  put  in  the  program  for  both  buy  and  sell  positions.        1.3   Bollinger  Bands  strategy    The  first  step  is  the  creation  of  Bollinger  Bands  agents  (BBAgents)  according  to  the  slider  nBBAgents.  The  crucial  point  of  the  Bollinger  Bands  strategy  (BBStrat)  is  the  capability  of  BBAgents  to  compare  each  price  realization  with  the  value  of  the  bands  at  the  same  time.  For  this  purpose  it  is  necessary  to  memorize  every  market  price  and  every  bands  value  in  different  vectors  (SboxP  for  prices,  SboxLB  for  lower  band,  SboxUB  for  upper  band).  Then  in  each  tick  (if  the  length  of  those  vectors  is  greater  than  two)  the  first  two  elements  of  the  vectors  are  compared  to  identify  the  overbought  and  oversold  conditions.    to  BBStrat      ask  BBAgents[        if  length  SBoxLB  >=  2  and  length  SBoxP  >=  2  and              item  0  SBoxP  <  item  0  SBoxLB  and                item  1  SBoxP  >  item  1  SBoxLB  and                sold  >=  1  [set  BBpocket  BBpocket  -­‐  item  1  (SBoxP)  

     

5  

                                                                       set  overbought  True                                                                          set  oversold  False                                                                          set  ovB  ovB  -­‐  1                                                                          set  AR  lput  BBpocket  AR                                                                          set  purchase  purchase  +  1  set  sold  sold  -­‐  1]                                            if  length  SBoxUB  >=  2  and  length  SBoxP  >=  2  and              item  0  SBoxP  >  item  0  SBoxUB  and                item  1  SBoxP  <  item  1  SBoxUB  and                purchase  >=  1  [set  BBpocket  BBpocket  +  item  1  SBoxP                                                                            set  oversold  True                                                                          set  overbought  False                                                                          set  ovS  ovS  +  1                                                                          set  AR  lput  BBpocket  AR                                                                          set  purchase  purchase  -­‐  1  set  sold  sold  +  1]]    To  perform  the  strategy  in  continuous  time,  as  imposed  for  the  moving  average  and  the  standard  deviation,  we  must  eliminate  the  first  item  of  each  vector,  after  the  command    to  BBStrat.    if  length  SBoxP  >=  2  and  length  SBoxLB  >=  2  and  length  SBoxUB  >=  2            [set  SBoxP  but-­‐first  SBoxP                set  SBoxLB  but-­‐first  SBoxLB                set  SBoxUB  but-­‐first  SboxUB]    In  our  program  BBAgents  memorize  every  step  of  the  strategy  in  the  global  variable  BBpocket:  for  what  concerns  the  cash  flow  statement  the  buy  position  (overbought)  has  negative  sign    while  the  sell  position  (oversold)  has  positive  sign.  BBAgents  starts  the  strategy  with  a  long  position,  and  next    they  sell  or  buy  only  if  they  respectively  have  bought  or  sold  in  previous  periods.              

     

6  

1.4   Market  strategy    Since  the  program  g1_CDA_basic_model  gives  to  randomAgents  a  probability  of  being  a  buyer  and  a  probability  of  being  a  seller,  it  is  possible  to  perform  a  strategy  based  on  the  bid  and  ask  prices.  This  strategy  consists  in  buying  when    a  new  ask  price  is  created  and  selling  when  a  new  bid  price  is  created.  As  in  the  Bollinger  Bands  strategy,  agents  start  with  a  long  position  and  then  in  the  next  periods  they  take  short  or  long  positions  only  if  they  have  performed  respectively  a  long  or  short  position  in  previous  periods.    strategy  based  on  random  market  prices:  BUY  ask  BBAgents  [     if  Osell  >=  1[set  ordinaryPocket  ordinaryPocket  -­‐  exeprice                                                                                                    set  OP  lput  ordinaryPocket  OP                                                                                                  set  Obuy  Obuy  +  1                                                                                                  set  Osell  Osell  –  1]]      strategy  based  on  random  market  prices:  SELL  ask  BBAgents  [                                           if  Obuy  >=  1  [set  ordinaryPocket  ordinaryPocket  +  exeprice                                                                                                    set  OP  lput  ordinaryPocket  OP                                                                                                    set  Osell  Osell  +  1                                                                                                    set  Obuy  Obuy  –  1]]    The  global  variable  that  memorizes  each  position  of  the  strategy  is  ordinaryPocket.        1.5   Comparison  between  Bollinger  Bands  strategy  and     Market  strategy    In  our  analysis  it  is  interesting  to  check  whether  the  strategy  previously  described  is  more  profitable.  The  related  variable  is  called  difference.  

     

7  

The  related  Net  Logo  function  is:    to  check_strategies        set  differenceB  BBpocket  -­‐  ordinaryPocket  end  

Here  difference  is  computed  with  respect  to  the  Bollinger  Bands  strategy.      1.6   Bollinger  Bands  Agents  effect  on  market  prices    BBAgents  will  enter  in  the  price  formation,  that  is  the  auction  mechanism,  only  if  there  are  the  Bollinger  signals  of  overbought  or  oversold.  In  the  program  this  is  implemented  through:                  ask  randomAgents                        [if  not  pass  and  not  out-­‐of-­‐market                                      [                                          let  tmp[]                                          set  tmp  lput  price  tmp                                          ask  BBAgents[if  overbought  [set  tmp  lput  price  tmp]]                                          ask  BBAgents[if  oversold  [set  tmp  lput  price  tmp]]                                          set  tmp  lput  who  tmp    where  first  all  random  prices  of  randomAgents  are  putted  in  the  vector  tmp;  then  if  the  Bollinger  strategy  suggest  to  buy  (overbought)  or  to  sell  (oversold),  also  all  random  prices  of  BBAgents  are  putted  in  the  vector  tmp.  This  vector  is  the  main  vehicle  for  the  auction  mechanism.        1.7   Graphs    • exeprice  refers  to  the  market  prices  created  in  the  program  

g1_CDA_basic_model  

     

8  

• Bands  represents  the  oscillation  of  the  market  price  in  the  bands:  the  band  width  is  determined  by  both  the  value  of  standard  deviation  and  the  slider  Bandwidth  (it  represents  a  multiple  of  the  standard  deviation).  

• Bollinger  Bands  strategy  refers  to  the  variable  BBpocket;  • Ordinary  strategy  refers  to  the  variable  ordinaryPocket;  • Above/Under  bands  is  connected  to  both  the  variables  ovB  and  ovS:  

they  count  how  many  times  the  price  crosses  the  lower  and  the  upper  band  respectively;  

• Difference  in  the  two  strategies  refers  to  the  variable  difference.        2.   Simulation  Results    In  our  model  we  assume  that  each  exeprice  (market  price)  formation  corresponds  to  a  daily  closure  price.  In  this  way  each  graph,  after  one  tick,  displays  almost  one-­‐hundred  price  realizations.  We  also  assume,  for  simplicity,  that  one  year  is  reached  after  three  ticks.  We  will  consider,  for  the  analysis,  a  framework  with  intervals  of  thirty  years  maximum,  distinguishing  between  short  term  (one  year    in=  3  ticks),  medium  term  (up  to  ten  years  =  30  ticks),  long  term  (  from  ten  to  thirty  years  =  90  ticks).  Since  the  value  of  each  slider  (nRandomAgents,nBBAgents,pass  level,  nMovingAverage,Bandwidth)  affects  the  outputs  differently  in  the  interface,  we  define  different  benchmark  cases,  according  to  Bollinger's  instructions.  In  general  Bollinger  suggests  investors  to  chose  a  sample  for  the  moving  average  calculus  (slider  nMovingAverage),  and  a  bandwidth  (slider  Bandwidth),  that  are  proportional  to  the  time  considered.  The  slider  nRandomAgents  affects  the  number  of  agents  that  will  participate  at  the  auction  mechanism,  with  a  probability  defined  by  the  slider  pass  level  (  for  simplicity  we  keep  this  probability  fixed  at  0.2;  it  means  that  at  each  price  formation,  randomAgents  have  a  probability  of    0.8  of  participation  in  the  market).  If  the  value  of    nRandomAgents  increases  also  the  variability  of  prices  increases,  

     

9  

leading  to  a  higher  variance  and  to  wider  bands.  The  slider  nBBAgents  affects  the  number  of  agents  that  will  participate  at  the  auction  mechanism  under  the  Bollinger  strategy  conditions.  As  it  happens  with  nRandomAgents,  the  variability  of  prices  is  affected,  but  only  according  to  specified  conditions:  principally,  it's  the  price  trend  (characterized  by  its  random  component)  that  can  push  the  agents    to  invest  in  the  market.  The  next  section  is  divided  in  four  scenarios,  characterized  by  a  different  variability  of  the  parameters  involved.  Each  scenario  is  itself  divided  in  three  sub-­‐points.  The  analysis  is  performed  through  the  simulation  of  one-­‐hundred  iterations  for  each  sub-­‐point,  where  for  each  group  the  average  profit  in  the  BollingerBands  strategy  is  computed,  distinguishing  from  short,  medium  and  long  term.  All  iterations  evaluate  the  strategy  only  on  the  oversold  condition,  taking  into  account  the  variable  difference.        2.1   The  ordinary  strategy    It  is  a  completely  myopic  strategy,  adopted  by  randomAgents:  every  buying  price  is  a  cash  flow  with  negative  sign,  and  every  selling  price  is  a  cash  positive  flow.  Since  the  ask  price  is  always  a  little  higher  than  the  bid  price,  this  strategy  obviously  leads  to  losses  in  the  long  run,  but  sometimes  it  can  provide  positive  profits  in  the  short  run,  according  to  the  price  trend.          Case  1    :  general  advice  for  short  term  investing;  points  a)  b)  c)  are  increasing  in  number  of  Bollinger  agents.      

     

10  

1.a  Bandwidth  =  2,    nMovingAverage  =  20,    nRandomAgents  =  100,      nBBAgents  =  1  In  general  the  behaviour  of  the  profit  is  decreasing  with  time;  the  short  term  profit  is  often  positive  (the  strategy  starts  with  a  negative  cash  flow:  this  effect  has  a  negative  impact  on  the  strategy  and  returns  are  not  significantly  different  from  zero);  the  medium  term  profits  are  positive  on  average  (but  not  statistically  different  from  zero:  almost  +0.0008%  annual  return),  while  the  long  term  leads  always  to  strongly  negative  profits.  The  difference  (variable  difference)  between  the  Bollinger  Bands  strategy  and  the  ordinary  strategy  (myopic  strategy)  is  always  increasing  and  greater  than  zero.    

     The  graph  represents  the  Bollinger  Bands  strategy  corresponding  to  seed  =  100.              

     

11  

1.b  Bandwidth  =  2,    nMovingAverage  =  20,    nRandomAgents  =  100,      nBBAgents  =  10  This  point  has  the  same  Bollinger  Bands  parameters  of  the  previous  point;  the  only  difference  is  in  the  number  of  Bollinger  Bands  agents  (  10  instead  of  1).  The  agents  now  corresponds  to  the  10%  of  the  randomAgents.  It  provides  always  (short,  medium,long  term)    strong  negative  profits  (cumulative  for  all  agents)  ,  that  are  decreasing  with  time.  The  minimum  loss  is  reached  between  the  short  and  the  long  term  and  it  is  approximatively  equal  to  -­‐1850.  The  variable  differenceS  is  in  general  negative,  although  in  the  long  run  it  can  be  oscillating:  meaning  that  often  the  Bollinger  strategy  is  worse  than  the  ordinary  one.  

     

The  graph  represents  the  Bollinger  Bands  strategy  corresponding  to  seed  =  206.          1.c  Bandwidth  =  2,    nMovingAverage  =  20,    nRandomAgents  =  100,      nBBAgents  =  50  In  this  point  we  have  a  total  of  150  agents  where  1/3  are  Bollinger  agents.  Since  this  agents  participate  to  the  market  only  according  to  overbought  and  oversold  conditions,  these  extreme  situations  lead  

     

12  

to  a  strong  growth  of  the  price  variance,  and  consequently  produce  bull  and  bear  situations.  

   

The  hump  shaped  profile  is  always  a  consequence  of  an  oversold  (bear)  or  an  overbought  (bull)  condition.    The  profit  of  the  Bollinger  strategy  is  always  negative  and  decreasing  with  time,  emphasizing  the  behaviour  of  1.b.    

 The  two  graphs  represent  the  Bollinger  Bands  strategy  corresponding  to  seed  =  330.      

     

13  

Case  2  :    general  advice  for  medium  term  investing;  points  a)  b)  c)  are  increasing  in  the  number  of  Bollinger  agents.  In  this  situation  we  have  no  profits  in  the  short  term:  the  probability  of  crossing  the  bands  is  very  low  (less  than  3%),  and  Bollinger's  signals  are  displayed  every  500-­‐700  price  realizations  on  average  (oversold  happens  always  after  4  ticks).    The  analysis  starts  from  the  medium  term.        2.a  Bandwidth  =  3,    nMovingAverage  =  30,    nRandomAgents  =  100,      nBBAgents  =  1  As  in  point  1.a  the  effect  on  the  market  price  of  only  one  Bollinger  agent  is  negligible.  In  this  situation  profits  are,  on  average,  increasing  up  to  the  long  term,  and  then  decreasing.  After  the  100  iterations  we  can  conclude  that  gains  are  not  statistically  different  from  zero  (  although  they  are  a  little  higher  than  in  the  1.a  case).  The  graph  represents  the  Bollinger  Bands  strategy  corresponding  to  seed  =  406.    

   With  this  parameters  the  Bollinger  Bands  strategy  is  strongly  influenced  by  the  price  trend:  in  general  the  increasing  trend  means  

     

14  

positive  profits  (sometimes  also  in  the  long  term)  and  vice-­‐versa.  We  can  see  this  effect  in  the  following  graphs:    

   The  graph  represents  the  Bollinger  Bands  strategy  corresponding  to  seed  =  408.        2.b  Bandwidth  =  3,    nMovingAverage  =  30,    nRandomAgents  =  100,      nBBAgents  =  10  As  happened  before  in  point  1.b,  by  rising  the  number  of  Bollinger  agents  there  is  translation  to  the  bottom  in  the  profit  behaviour:  it  becomes  negative,  in  medium  and  in  long  term,  except  for  the  20%  of  iterations  where  it  is  positive  for  very  short  periods.  

 

     

15  

The  graph  represents  the  Bollinger  Bands  strategy  corresponding  to  seed  =  507.        2.c  Bandwidth  =  3,    nMovingAverage  =  30,    nRandomAgents  =  100,      nBBAgents  =  50  The  characteristics  of  this  point  are  very  similar  to  those  at  the  point  1.c:  namely  the  negative  and  decreasing  profit  trend.  The  effect  of  amplifying  the  bandwidth  and  the  sample  for  the  moving  average  is  not  enough  to  conpensate  the  effect  of  the  frequent  use  of  the  Bollinger  strategy  by  agents.  However  losses  are  less  marked  than  in  point  1.c.    

   The  graph  represents  the  Bollinger  Bands  strategy  corresponding  to  seed  =  600.        Case  3  :    characterized  by  very  high  bandwidth,  this  strategy  can  be  performed  only  in  the  long  run.  Often  profits  starts  from  tick  30,  and  become  more  significant  as  

     

16  

time  goes  by.  3.a  Bandwidth  =  5,    nMovingAverage  =  40,    nRandomAgents  =  100,      nBBAgents  =  1  The  profit  of  the  Bollinger  strategy  is  in  95%  of  the  cases  positive  (considering  the  oversold  situation)  and  it  is  always  increasing  with  time.  The  portfolio  becomes  self  financing  in  almost  50%  of  the  cases,  but  only  from  tick  200-­‐300  (meaning  60-­‐90  years  in  our  model).    

   The  graph  represents  the  Bollinger  Bands  strategy  corresponding  to  seed  =  705.      3.b  Bandwidth  =  5,    nMovingAverage  =  40,    nRandomAgents  =  100,      nBBAgents  =  10  The  behaviour  of  profits  is  slightly  increasing,  leading  to  significant  profits  only  in  the  very  long  run.  The  higher  bandwidth  and  the  bigger  sample  for  the  moving  average  compensate  the  rather  strong  effect  on  prices  of  Bollinger  agents.    

     

17  

   The  oscillating  trend  of  the  Bollinger  strategy  (almost  until  tick  =  50  in  this  case)  produces  also  an  oscillating  difference  compared  to  the  ordinary  strategy.    

   The  two  graphs  represent  the  Bollinger  Bands  strategy  corresponding  to  seed  =  800.            

     

18  

3.c  Bandwidth  =  5,    nMovingAverage  =  40,    nRandomAgents  =  100,      nBBAgents  =  50  The  very  strong  effect  of  Bollinger  agents  on  prices  can  be  compensated  by  Bollinger  parameters,  on  average,  only  after  tick  =  70-­‐80.  The  statistical  significance  of  the  bands'  stream  produces  profits  only  after  a  very  long  period.    

   The  graph  represents  the  Bollinger  Bands  strategy  corresponding  to  seed  =  900.        Case  4.0  :    extreme  case  in  which  only  two  randomAgents  (the  minimum  possible)  generate  the  market  price,  that  can  be  thus  strongly  affected  by  Bollinger  agents.  Points    a)  b)  c)  are  increasing  in  Bandwidth  and  in  nMovingAverage.  In  general  price  movements  are  strongly  affected  by  Bollinger's  conditions:  the  variable  exeprice  has  a  little  variability,  and  so  it  has  very  tight  bands;  the  overbought  and  oversold  situations  forces  the  price  to  have  long-­‐lasting  bear  (oversold)  and  bull  (overbought)  profiles  with  higher  magnitude  with  respect  to  any  other  case.    

     

19  

4.a  Bandwidth  =  2,    nMovingAverage  =  20,    nRandomAgents  =  2,      nBBAgents  =  50  It  can  produce  strongly  positive,  strongly  negative  or  oscillating  profit  trends,  depending  on  price  behaviour  with  respect  to  the  bands.    

 

 

   The  graphs  represent  the  Bollinger  Bands  strategy  corresponding  respectively  to  seed  =  1000,  1001  1002  the  Despite    price  variations  having  a  very  low  level  of  heterogeneity  

     

20  

and  the  bands  being  particularly  tight,  in  lots  of  cases  (almost  40%  of  the  total)  we  cannot  evaluate  the  short  term  return  performance  because  overbought  and  oversold  conditions  are  quite  infrequent.  Two  examples  of  the  extreme  price  variation  can  be  seen  looking  at  exeprice  behaviour:        

   The  two  graphs,  corresponding  to  respectively  seed  =  1105,  1100,  displays  two  opposite  trends:  the  first  leads  to  a  market  price  that  is  almost  five  times  greater  than  the  initial  price.  The  second  case  is  the  opposite:  the  market  price  is  strongly  negative.    On  the  other  hand,  the  ordinary  strategy  is  now  more  stable,  and  often  produces  positive  profits  in  the  short  –  medium  run.  The  standard  deviation  steeply  increases  during  resistance  and  support  levels  according  to  the  very  marked  effect  of  Bollinger  agents  on  the  market  price,  creating  bands  that  are  very  large  with  respect  to  price  variations  and  consequently  making  the  strategy  strongly  unstable.  This  effect  is  emphasized  if  we  increase  Bandwith  and  nMovingAverage,  keeping  constant  nRandomAgents  =  2,      nBBAgents  =  50.                

     

21  

3.   Conclusions    Various  studies  of  the  effectiveness  of  the  Bollinger  Band  strategy  have  been  performed,  with  mixed  results.  In  2007  Lento  et  al  published  an  analysis  using  a  variety  of  formats  (different  moving  average  timescales  and  standard  deviation  ranges)  and  markets  (eg  Dow  Jones  and  Forex).Analysis  of  the  trades,  spanning  a  decade  from  1995  onwards,  found  no  evidence  of  consistence  performance  over  the  standard  "buy  and  hold"  approach.  The  authors  did,  however,  find  that  a  simple  reversal  of  the  strategy  ("contrarian  Bollinger  Band")  produced  positive  returns  in  a  variety  of  markets.  In  general  in  our  analisis  we  can  evidence  the  fact  that  the  selection  of  Bollinger's  parameters  is  very  important:  Sample  mean  and  bandwidth  should  be  increasing  with  time  (  as  Bollinger  suggests).  Regarding  Case  1,  we  can  say  that,  although  it  is  quite  stable,  the  strategy  can't  outperform  the  market,.  Cases  2,  3  seem  to  be  more  efficient  than  Case  1,  but  the  Bollinger  strategy  performs  well  in  a  specific  framework,  defined  by  the  assumptions  of  the  program  (id  est  number  of  agents  and  the  random  behaviour  of  randomAgents).  Case  4  is  useful  to  understand  how  the  effectiveness  of  the  two  strategies  involved  changes,  resulting  as  if  almost  all  the  agents  invest  using  the  Bollinger  strategy:  the  method  becomes  useless  and  completely  random,  while  the  ordinary  strategy  (that  is  random  by  construction)  becomes  more  stable.