Bussinesscycles v19

Bussinesscycles v19 preview image

1 collaborator

Default-person Jean van Haperen (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 5.0.5 • Viewed 278 times • Downloaded 32 times • Run 0 times
Download the 'Bussinesscycles v19' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

breed [fundamentals fundamental]
breed [trendfollowers trendfollower]


fundamentals-own [
stock


  ]

trendfollowers-own [

  stock

 
  ]

turtles-own
[
  pricepaid
  profit; changed in v10
]

globals
[ 
  pricet
  pricet-1
  pricet-2
  pricet-3
  fundamentalvalue
    trendedvalue
   purchase?
   pricetx
  novolume?
  dividendlist
  dividend
  fundamentalistsvalue
  portiontrendfollowers
]

to setup
  __clear-all-and-reset-ticks
  set-default-shape fundamentals "house"
  set-default-shape trendfollowers "person"
  create-ordered-fundamentals Numberoffundamentals
  [setxy random-ycor random-xcor
    set color white]
  create-ordered-trendfollowers Numberoftrendfollowers 
  [setxy random-ycor random-xcor
    set color white]
  set pricet 350 ; changed in v10
  set pricet-1 350; changed in v10
  set pricet-2 350
  set pricet-3 350
  set trendedvalue 350; changed in v10
  set fundamentalvalue 350; changed in v10
  set fundamentalistsvalue 350
  setup-plots; changed in v10
  update-plots ; changed in v10
  ask fundamentals
  [set stock noStocksperTrader
    set fundamentalistsvalue 350]
  set portiontrendfollowers (count trendfollowers / (count fundamentals + count trendfollowers))
  
  ask trendfollowers
  [set stock noStocksperTrader
  ]
  set novolume? 0
  ask turtles [set profit 0
    ]
  set dividendlist [36 4 -16 -24]
end 

to go
  
  if ticks >= timePeriods [stop] ; changed in v10
  set dividend one-of dividendlist
  set fundamentalvalue fundamentalvalue + changeinfundamentalvalue
  ask fundamentals
  [ifelse ticks < 15 [ set fundamentalistsvalue fundamentalvalue  + (dividend * (((16 - ticks) / 16) * riskattitude))] [set fundamentalistsvalue fundamentalvalue]]
  set pricet-3 pricet-2
  set pricet-2 pricet-1
  set pricet-1 pricet
 ask fundamentals [recolorf]
  ask-concurrent trendfollowers [buyorsell]
 
 set pricet median [pricepaid] of trendfollowers

  tick
end 

to buyorsell
    
    without-interruption
   
       [
    set purchase? 0
   
     ifelse ticks > 0 [ifelse novolume? >= 1 and mean [stock] of trendfollowers != 0 [set trendedvalue trendedvalue - (2 / count trendfollowers) * novolume? ^ 2][set trendedvalue (pricet-1 - pricet-2) + 0.2 * (pricet-2 - pricet-3) + pricet-1 ]][set trendedvalue 350] ;changed to 2 / count in v 13
     
     recolortrend
     
     if any? fundamentals with [stock > 0] and trendedvalue > fundamentalistsvalue
     [set purchase? 1]
    
    
     if stock > 0 and trendedvalue < fundamentalistsvalue
     [set purchase? -1]
       
    if purchase? = 1 [
    ask one-of fundamentals with [stock > 0 ] [set stock stock - 1]] 
  
    if purchase? = -1 [
    ask one-of fundamentals [set stock stock + 1]] 
    
    if purchase? = 0 [set novolume? novolume? + 1] 
     
    if purchase? = 1
      [set stock stock + 1
        set novolume? 0]
    
    if purchase? = -1
      [set stock stock - 1 
      set novolume? 0]
      
       if purchase? = 1
      [set pricepaid (portiontrendfollowers * (trendedvalue - fundamentalistsvalue)) + fundamentalistsvalue 
                set profit profit + (350 - pricepaid); changed in v10
        ]
      
      
       if purchase? = -1
      [set pricepaid ((1 - portiontrendfollowers) * (fundamentalistsvalue - trendedvalue)) + trendedvalue 
        set profit profit + (pricepaid - 350)]; changed in v10
      
      
      
      
      if purchase? = 0 [
        if mean [stock] of trendfollowers = 0  [set pricepaid fundamentalistsvalue]
        if mean [stock] of fundamentals = 0 [set pricepaid trendedvalue]
       ;if mean [stock] of trendfollowers != 0 and mean [stock] of fundamentals != 0 [set pricepaid ((1 - portiontrendfollowers) * (fundamentalistsvalue - trendedvalue)) + trendedvalue ] ; waarom deze?
        ]
    ]
end 

to recolorf
    ifelse fundamentalistsvalue > pricet-1 [set color blue][set color red]
end 

to recolortrend
    ifelse trendedvalue > pricet-1 [set color blue][set color red]
end 

There is only one version of this model, created over 10 years ago by Jean van Haperen.

Attached files

File Type Description Last updated
Bussinesscycles v19.png preview Preview for 'Bussinesscycles v19' over 10 years ago, by Jean van Haperen Download

This model does not have any ancestors.

This model does not have any descendants.