NetLogo banner

NetLogo Publications
Contact Us

Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Farsi / Persian


NetLogo User Community Models

(back to the NetLogo User Community Models)

[screen shot]

If clicking does not initiate a download, try right clicking or control clicking and choosing "Save" or "Download".(The run link is disabled for this model because it was made in a version prior to NetLogo 6.0, which NetLogo Web requires.)

## Transaction Costs in Financial Market


Spišák, M. and Šperka, R. (2014): Transaction Costs in Financial Market. Netlogo v. 5.01 simulation.


The base model developed by Frank Westerhoff (Westerhoff, 2009) was chosen for the implementation. It is an agent-based model, which simulates the financial market. Two base types of traders are represented by agents:

* fundamental traders, whose reactions are based on fundamental analysis - they believe that asset prices in long term approximate their fundamental price - they buy assets when the price is under fundamental value
* technical traders, who decide using technical analysis - prices tend to move in trends - by their extrapolating there comes the positive feedback, which can cause the instability

Price changes are reflecting current demand excess. This excess is expressing the orders amount submitted by technical and fundamental traders each turn and the rate between their orders evolves in a time. Agents regularly meet and they are discussing their trading performance. One agent can be persuaded by the other to change his trading method, if his rules relative success is less than the others one. Communication is direct talk one agent with other. Talking agents meets randomly - there is no special relationship between them. The success of rules is represented by current and passed myoptic profitability. It is very important to mention, that model assumes traders ability to define the fundamental value of assets and they are behave rationally.
The price is reflecting the relation between assets that have been bought and sold in a turn and the price change caused by these orders. This can be formalized as a simple log-linear price impact function.

P_(t+1)= P_t+a(W_t^C D_t^C+ W_t^F D_t^F )+ ?_t

Where a is positive price adjustment coefficient, D^C are orders generated by technical angents while D^Fare orders of fundamental ones. W^C and W^Fare weights of the agents using technical respective fundamental rules. They are reflecting current ratio between the technical and fudamental agents. ? brings the random term to Figure 1. It is an IID normal random variable with mean zero and constant standard deviation ?^?.
As was already said, technical analysis extrapolates price trends - when they go up (price is growing) agents buy the assets. So the formalization for technical order rules can be like this

D_t^C=b(P_t- P_(t-1) )+ ?_t

The parameter b is positive and presents agent sensitivity to price changes. The difference in brackets reflects the trend and ? is the random term - IID normal random variable with mean zero and constant standard deviation ?^?.
Fundamental analysis permits the difference between price and fundamental value for short time only. In long run there is an aproximation of them. So if the price is below the fundamental value - the assets are bought and vice versa - orders according fundamentalists are formalized

D_t^F=c(F- P_t )+ ?_t

c is positive and presents agent sensitivity to reaction. F represents fundamental value - we keep as constant value to keep the implementation as simple as possible . ? is the random term - IID normal random variable with mean zero and constant standard deviation ?^?.
If we say that N is the total number of agents and K is the number of technical traders, then we define the weight of technical traders

W_t^C= K_t/N

and the weight of fundamental traders

W_t^F=(N- K_t)/N

Two traders meet at each step and they are discussing about the success of their rules. If the second agent rules are more successful, the first one changes its behavior with a probability K. Probability of transition is defined as (1-?). Also there is a small probability ? that agent changes his mind independently. Transition probability is formalized as

K_(t-1)(t) {?(K_(t-1)+1 with probability p_(t-1)^+= (N- K_(t-1))/N (?+(1-?)_(t-1)^(F?C)
K_(t-1)/(N-1))@K_(t-1)-1 with probability p_(t-1)^-= ( K_(t-1))/N (?+(1-?)_(t-1)^(C?F) (N- K_(t-1))/(N-1))@K_(t-1) with probability 1+? p?_(t-1)^+- p_(t-1)^- )?

where the probability that fundamental agent becomes technical one is

(1-?)_(t-1)^(F?C)={?(0.5+? for A_t^C>A_t^F @0.5-? otherwise

respective that technical agent becomes fundamental one is

(1-?)_(t-1)^(C?F)={?(0.5-? for A_t^C>A_t^F @0.5+? otherwise

Success (fitness of the rule) is represented by past myoptic profitability of the rules that are formalized as
A_t^C=(exp?[P_t ]-exp?[P_(t-1) ] ) D_(t-2)^C+dA_(t-1)^C

for the technical rules and
A_t^F=(exp?[P_t ]-exp?[P_(t-1) ] ) D_(t-2)^F+dA_(t-1)^F

for the fundamental rules. Agents use most recent performance (at the end of A_^C formula resp. A_^F) and also the orders submitted in period t-2 are executed at prices started in period t-1. In this way the myoptic profits are calculated. Agents have memory - which is represented by parameter d. Values are 0 ? d ? 1. If d = 0 then agent has no memory, much higher value is, much higher influence the myoptic profits have on the rule fitness.


The aim of the model is to investigate the influence of the transaction costs on the market stability (which is measured by the price volatility - much more stable the market is, much less are price differences in a time). The entrance of transaction costs (TC) - e.g. as a tax will have direct impact on the asset price. The model was little changed to adopt also this aspect into price. So price is composed this way:

P_(t+1)= P_t+a(W_t^C D_t^C+ W_t^F D_t^F )+ ?_t+TC

Where TC is a value of the transaction costs, which is constant during all the simulation.

While the tax is out-of trade factor, all the agents will be affected in the same way. Generally there can be also different transaction costs than taxes - e.g. information obtaining costs.
The TC increase has following results:
* price increase will stimulate technical rules usage, it-s influence on expected future profit opportunities (as the fundamental value of asset) is irrelevant - they depend on the company state, rather than on transaction costs
* in a short time, the price grow will attract technical traders, but after the realized profits will fall down and the fundamental traders will start to dominate, it will lead to market stabilization (price changes are falling - volatility of price is lower)


In the interface section set the values for the parameters, SETUP and RUN the model.


The most important thing to notice is price and technical traders percent envolvement based on the enterd transaction costs amount.


Try to set high and low tranaction costs to see the influence on the price and technical traders percent.


This model was developed with the support by grant of Silesian University no. SGS/6/2013 "Advanced Modeling and Simulation of Economic Systems”.

This model was described and analysed in detail in these papers:

ŠPERKA, R., SPIŠÁK, M. Transaction Costs Influence on the Stability of Financial Market: Agent-based Simulation. Journal of Business Economics and Management, Taylor & Francis, London, United Kingdom, 2013. Volume 14, Supplement 1, pp. S1-S12, DOI: 10.3846/16111699.2012.701227. Print ISSN 1611-1699, Online ISSN 2029-4433. Available from: <>.

ŠPERKA, R., SPIŠÁK, M. Tobin Tax Introduction and Risk Analysis in the Java Simulation. In: Proc. 30th International Conference Mathematical Methods in Economics. Part II. Silesian University in Opava, Karvina, Czech Republic, 11.-13.9.2012, pp. 885-890, ISBN 978-80-7248-779-0. Available from: <>.

SPIŠÁK, M., ŠPERKA, R. Financial Market Simulation Based on Intelligent Agents - Case Study. Journal of Applied Economic Sciences, Volume VI, Issue 3(17), Fall 2011, Spiru Haret University: Romania, ISSN 1843-6110, pp. 249-256. Available from: <>.

(back to the NetLogo User Community Models)