Businesscyclesv9

Businesscyclesv9 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 488 times • Downloaded 46 times • Run 0 times
Download the 'Businesscyclesv9' modelDownload this modelEmbed this model

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


WHAT IS IT?

(a general understanding of what the model is trying to show or explain)

HOW IT WORKS

(what rules the agents use to create the overall behavior of the model)

HOW TO USE IT

(how to use the model, including a description of each of the items in the Interface tab)

THINGS TO NOTICE

(suggested things for the user to notice while running the model)

THINGS TO TRY

(suggested things for the user to try to do (move sliders, switches, etc.) with the model)

EXTENDING THE MODEL

(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)

NETLOGO FEATURES

(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)

RELATED MODELS

(models in the NetLogo Models Library and elsewhere which are of related interest)

CREDITS AND REFERENCES

(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)

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
]

globals
[ 
  pricet
  pricet-1
  fundamentalvalue
    trendedvalue
   purchase?
   pricetx
  novolume?
]

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]
  create-ordered-trendfollowers Numberoftrendfollowers 
  [setxy random-ycor random-xcor]
  set pricet random 50 + 10
  set pricet-1 random 50 + 10
  set trendedvalue random 50 + 10
  set fundamentalvalue 40
 
  ask fundamentals
  [set stock noStocksperTrader]
  
  ask trendfollowers
  [set stock noStocksperTrader
  ]
  set novolume? 0
end 

to go
  
  
  
  set fundamentalvalue fundamentalvalue + IncreaseFundamentalvalue
  set pricet-1 pricet
  set pricet mean [pricepaid] of trendfollowers
  ask-concurrent trendfollowers [buyorsell]
 

  tick
end 

to buyorsell
    
    without-interruption [
    set purchase? 0
   
     ifelse novolume? >= 1 and mean [stock] of trendfollowers != 0 [set trendedvalue trendedvalue - (1 / count trendfollowers) * novolume?][set trendedvalue (2 * pricet - pricet-1)]
     
     
     if any? fundamentals with [stock > 0] and trendedvalue > pricet
     [set purchase? 1]
    
    
     if any? trendfollowers with [stock > 0] and stock > 0 and pricet < fundamentalvalue
     [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 0.5 * (fundamentalvalue + trendedvalue)]
      
      
       if purchase? = -1
      [set pricepaid 0.5 * (fundamentalvalue + trendedvalue)]
      
      if purchase? = 0 [
        if mean [stock] of trendfollowers = 0  [set pricepaid fundamentalvalue]
        if mean [stock] of fundamentals = 0 [set pricepaid trendedvalue]
        if mean [stock] of trendfollowers != 0 and mean [stock] of fundamentals != 0 [set pricepaid 0.5 * (fundamentalvalue + trendedvalue)]
        ]
      
     
    ]
end 
  
  

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

Attached files

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

This model does not have any ancestors.

This model does not have any descendants.