4-5 May 2022
IEEE Computational Intelligence for Financial Engineering and Economics
https://cifer.risklab.fi/

Instability of financial markets
by optimizing investment strategies
investigated by an agent-based model
Takanobu Mizuta SPARX Asset Management Co. Ltd.
mizutata[at]gmail.com https://mizutatakanobu.com

Isao Yagi

Kogakuin University

Kosei Takashima Nagaoka University
Note that the opinions contained herein are solely those of the authors and do notnecessarily reflect those of SPARX Asset Management Co., Ltd.

You can download this presentation material fromhttps://mizutatakanobu.com/2022CIFEr.pdf

1(1) Introduction(2) Our Model(3) Simulation Results(4) Conclusion

You can download this presentation material fromhttps://mizutatakanobu.com/2022CIFEr.pdf

2

(1) Introduction(2) Our Model(3) Simulation Results(4) Conclusion

You can download this presentation material fromhttps://mizutatakanobu.com/2022CIFEr.pdf

3

Hypothesis of optimizing investment strategies is criticized

Most finance studies are discussed on the basis of several hypotheses. However, the hypotheses
themselves are sometimes criticized.
The rational optimization of investors' investment strategies is also criticized.
* Investors themselves are not rational in the first place [Shiller 2003]* Optimization is impossible due to the limitations of the investors’ calculation ability [Shiozawa 2019]・ Impossibility of handling market impacts, where trades of investors can impact andchange market prices, in “backtesting” also make optimization impossible. Today’s talk“backtesting”
Investors profits are estimated if they were trading at past market prices.
If they were buying this time
Under fixed time evolution
How much profits?

Past time evolution of market prices
was fixed and unchanged
If they were selling
How much?

In fact, there is no method to exactly estimate the market impact before trading.
Investors cannot estimate their earnings, including the effect of their market impacts.

4

“Optimization Instability"

The rational strategy
is no longer rational

An investor selects
rational strategy
at that time
Optimization
Instability
The tradeschangethe time evolutionof prices

MicroTrades

Macro

Optimization instability causes not only market prices
but also the parameters of investment strategies to continually change
The optimization instability is one level higher than “non-equilibrium of market prices.”

Optimization Instability caused by this “micro-macro feedback loops”
5

(1)A parameterof investment
strategy

Equilibrium ofmarket prices

A parameterof investment
strategyMarketprices

Optimization instability

A parameterof investment
Stablystrategy
optimized

Equilibrium

Marketprices

(2)

(3)

(only noises)

Non-equilibrium of
market prices

Marketprices(4)
A parameter
Stably of investment
optimized
strategyNon-equilibrium

Changing
cyclicallyNon-equilibrium
Optimization instability

Changing
irregularly
andunexpectedlyMarketprices
Non-equilibrium6An empirical study can not handle market impacts
We can not actually trade with large impacting.
An empirical study can not separate the causes of changing market prices whether bytime evolution or by market impacts

An “artificial market model”, agent-based models for financial markets,
can handle market impacts.
An artificial market model can fix other factors than market impacts.
Only an artificial market model can effectively handle micro-macro feedback loops.
No artificial market study optimized investment strategies in which an agent searches one
optimized parameter in a whole simulation run in economics and financial studies, and nomodel determined whether only market impacts lead to optimization instability.
Therefore in this study,
We built an artificial market model, agent-based models for financial markets, byadding technical analysis strategy agents (TAs), which search one optimized
parameter in a whole simulation run, to the prior model of Mizuta[2016].
The TAs are a momentum TA (TA-m) and reversal TA (TA-r), and we investigatedwhether investors' inability to accurately estimate market impacts in theiroptimizations leads to optimization instability7

An artificial market model = an agent-based model for a financial market
Virtual and Artificial financial Market built on Computers
ModelsIncludeAgents (Artificial Investors)＋
Price Mechanism (Artificial Exchange)
Order
Price
Mechanism(Exchange)

Agent(Investor)

Each Agent determines anorder by some rules,
Price Mechanism gather
agents orders anddetermines Market Price

Determination market priceComplete Computer Simulation needing NO Empirical Data✓ can discuss on the mechanism between the micro-macro feedback✓ can be conducted to investigate situations that have neveroccurred in actual financial markets✓ can effectively handling micro-macro feedback loops8(1) Introduction(2) Our Model(3) Simulation Results(4) Conclusion

You can download this presentation material fromhttps://mizutatakanobu.com/2022CIFEr.pdf

9My Model
Normal Agents (NAs)exist 1000 agents
To replicate the nature of priceformation in actual financialmarkets, I introduced the NA tomodel a general investor.

StockExchange

TA-m(momentum)TA-r(reversal)

Two TAs exist one TA-m and one TA-r
In this study, the artificial market model was built by adding thetwo Tas to the prior model of Mizuta et al[2016]
Two TAs (technical analysis strategy agents) search
their one optimized parameter to a whole simulation run(TAs details will be showed later)

10

Stock Exchange (Price Mechanism)
continuous double auction

SharesSell
1030

Shares
BuyPrice103
Waiting Orders
102
101
50100
When buy order come here
13099
transaction immediately occurs
98
150
When sell order come heretransaction immediately occurs
97
96
70
Multiple buyers and sellers compete to buy and sell stocks in the market, andtransactions can occur at any time whenever an offer to buy and an offer tosell match.
11Normal Agents (NAs)This term is needed To
replicate stylized facts

1000 agents
j: agent number ordering in number ordert: tick time

Expected Returnof each NA

Technical𝑡−1
𝑃1𝑃𝑓𝑡
𝑟𝑒,𝑗=𝑤1,𝑗 log 𝑡−1 + 𝑤2,𝑗 log 𝑡−𝜏𝑗 + 𝑤3,𝑗 𝜀𝑗𝑡
σ𝑖 𝑤𝑖,𝑗𝑃𝑃noise

wi , j and  jFundamental

Pf Fundamental Price tj

Random ofUniform Distribution

P t Market Price at t

Parameters for agentswi , jji=1,3: 0～1
i=2: 0～1000～10000

Random ofNormal
Distribution
Average=0
σ=3%10000 = constantThis term is needed toprevent the prices goout far away

To keep agents varied
To keep simulation runs stably

Expected Price 𝑡
𝑃 𝑒,𝑗 = 𝑃𝑡 exp( 𝑟 𝑡 𝑒,𝑗 )of each NA12

Fundamental Strategy
Fundamental Price ＞ Market Price -> Expect + return
Fundamental Price < Market Price -> Expect - return
Technical Strategy (Historical Return)
Historical Return ＞ 0 -> Expect + return
Historical Return < 0 -> Expect - return
TechnicalStrategyFundamental
PriceMarketPriceFundamental
Strategy13

TAs: Placing orders

NAs(1000)

oneshare

TA-m

TA-r

(momentum)(reversal)

Pt>Pt-tm
Hold 100 sharesPt<Pt-tr
Hold 100 sharesPt<Pt-tm
Short Sell
100 shares

Pt>Pt-tr
Short Sell
100 shares

After the 1000 NA places an order, the TA-m and TA-r placeorders in this order when the following conditions are satisfied.
tm,tr are optimized to earn the best by backtesting
14

TAs: optimizing the parameters
1st, TAs
do not participate

NAs

After first simulation
without TAs

TA-m TA-r

Prices2nd, TAs participate using tm, tr optimized by 1st backtesting
NAs
Their parameters
are not changed
Prices are changed
from 1st backtestingby market impacts of TAs
3rd, TAs participate using tm, tr optimized by 2nd backtestingtm,tr are optimized
to earn the bestby backtesting
Using
PSO

tm,tr are optimized
to earn the bestby backtesting15

“Fixed” normal agents
1000 agentsj: agent number ordering in number ordert: tick time

Expected Returnof each NA

Here are changed
by changing time evolutionof market prices

𝑡−1
𝑃1𝑃𝑓𝑡
𝑟𝑒,𝑗=𝑤1,𝑗 log 𝑡−1 + 𝑤2,𝑗 log 𝑡−𝜏𝑗 + 𝑤3,𝑗 𝜀𝑗𝑡
σ𝑖 𝑤𝑖,𝑗𝑃
𝑃

Here are fixed

Including (𝜀𝑗𝑡), the parameters of normal agents are fixed.
However, their trades are changed
by changing time evolution of market prices.
16

PSO(Particle Swarm Optimization)-Profit(smallerbetter)

historically
best position
for iteach historically
best position
for alleach historically
best positionfor itx(tm, tr)“-Profit has very very complex dependency for tm, tr”-> Finding the minimum “-Profit” is very difficult -> PSO is good solution
In the PSO there are many “particles”, and they are pull to boththeir each historically best position and their all historically best.
Thanks to “many” particles, they are rarely trapped into local solution.

17

(1) Introduction(2) Our Model(3) Simulation Results(4) Conclusion

You can download this presentation material fromhttps://mizutatakanobu.com/2022CIFEr.pdf

18

Time evolution of the prices with TA-m and without it
10300
10200

Market prices

10100
10000
9900
9800
9700

18000

16000

14000

12000

10000

8000

6000

4000

2000

0

9600

Time/1000

Without TAs

With TA-m

The existence of the TA-m enlarged the price variation.
19

25000

1000

20000

800

15000

600

10000

400

5000

2000

Profittm

tm and profits of the TA-m with TA-m

0
1

11

21

31

41

Simulationtm

Profit of TA-m

tm never converged to a specific value but changed in a cyclic manner.
The optimization of TA-m strategy is unstable.
20

Time evolutionof market prices

1st simulation:
Withoutthe TA-m

Backtesting
tm is optimized

6th sim.

5th sim.

tm cycles
and neverconverges
4th sim.

2nd sim.:
Trades of TA-mchangesmarket prices

Backtesting
tm is re-optimized
to another value
3rd sim.:Market prices
are changed
again

Strategies of traders never reach the equilibrium, and theoptimized parameters of strategies are never fixed in time.
21

An investor selects
rational strategy
at that time

The rational strategy
is no longer rational

Instability ofan optimization

Trades

The tradeschangethe time evolutionof prices

Even if all other traders are fixed, only one investor optimizing his/her strategy
using backtesting leads to time evolution of market prices becoming unstable.
Financial markets are essentially unstable, and naturally, investment strategies are not able tobe fixed. The reason is that even when one investor selects a rational strategy at that time, itchanges the time evolution of prices, it becomes no longer rational, another strategy becomes
rational, and the process repeats.
22

tm, tr with both the TA-m and TA-r
25000

tm

300000tr25000020000

tm

15000010000

tr20000015000

100000

5000

50000

00
1

11

21

3141Simulation

The changes of tm, tr were irregular and unexpected
The time evolution of market prices produced by investment strategies having such unstableparameters is highly unlikely to be predicted and have stable laws written by equations. Thisnature makes us suspect that financial markets include the principle of natural uniformity andindicates the difficulty of building an equation model explaining the time evolution of prices.
23

Time evolutionof market prices

Backtesting

1st simulation:
tm&tr are optimized
Withoutthe TAs
2nd sim.:
Backtesting
Trades of TAschangesmarket prices tm&tr are re-optimized
tm&tr are?

to other values

irregularly andunexpectedly

3rd sim.:Market prices
are changedagain

5th sim.
6th sim.
4th sim.

Both tm and tr do not return to certain historical values,
so the changes of tm, tr are irregular and unexpected.

24Profits of TA-m with only TA-m and with both TA-m TA-r
1500

Profit

1000

500

01

11

21

31

41

Simulation
With both TA-m and TA-r

With TA-mTA-m earned more than that without TA-r. A profit of one strategy is notstolen by the another strategy, but both strategies increase their profits.
The result is consistent with [Mizuta 2021]

25

(1) Introduction(2) Our Model(3) Simulation Results(4) Conclusion

You can download this presentation material fromhttps://mizutatakanobu.com/2022CIFEr.pdf

26

Conclusion (1/2)✓ In this study, we built an artificial market model by adding technicalanalysis strategy agents (TAs), which search one optimized parameter ina whole simulation run, to the prior model of [mizuta 2016]. The TAs area momentum TA (TA-m) and reversal TA (TA-r), and we investigatedwhether investors' inability to accurately estimate market impacts in theiroptimizations leads to optimization instability.
✓ When both the TA-m and TA-r exist, the parameters of investment
strategies were changing irregularly and unexpectedly. This means thateven if all other traders are fixed, only one investor optimizing his/her
strategy using backtesting leads to the time evolution of market prices
becoming unstable. Financial markets are essentially unstable, andnaturally, investment strategies are not able to be fixed. The reason isthat even when one investor selects a rational strategy at that time, itchanges the time evolution of prices, it becomes no longer rational,
another strategy becomes rational, and the process repeats.
You can download this presentation material fromhttps://mizutatakanobu.com/2022CIFEr.pdf

27

Conclusion (2/2)✓ Optimization instability is one level higher than ``non-equilibrium ofmarket prices.'' Therefore, the time evolution of market prices produced
by investment strategies having such unstable parameters is highly
unlikely to be predicted and have stable laws written by equations. Thisnature makes us suspect that financial markets include the principle ofnatural uniformity and indicates the difficulty of building an equation
model explaining the time evolution of prices.

You can download this presentation material fromhttps://mizutatakanobu.com/2022CIFEr.pdf

28

Reference⚫ [Mizuta 2016] Mizuta, T., Kosugi, S., Kusumoto, T., Matsumoto, W., Izumi, K., Yagi, I., andYoshimura, S., “Effects of Price Regulations and Dark Pools on Financial Market Stability: An
Investigation by Multiagent Simulations”, Intelligent Systems in Accounting, Finance andManagement, Vol. 23, No. 1-2, pp. 97-120, 2016, https://doi.org/10.1002/isaf.1374⚫ [Mizuta 2021] Mizuta, T., “Do new investment strategies take existing strategies' returns -An
investigation into agent-based models-”, BESC 2021, October 29 to 31, 2021
https://doi.org/10.1109/BESC53957.2021.9635097
Review of an agent-based model for designing a financial market
Mizuta (2020) An agent-based model for designing a financial market that works well, CIFEr 2020
arXiv https://arxiv.org/abs/1906.06000
Slide: https://mizutatakanobu.com/2021kyushu.pdf
YouTube: https://youtu.be/rmlb72ykmlE
Citing many previous studies
Mizuta (2016) A Brief Review of Recent Artificial Market Simulation Studies for Financial MarketRegulations And/Or Rules, SSRN Working Paper Series
https://ssrn.com/abstract=2710495

You can download this presentation material fromhttps://mizutatakanobu.com/2022CIFEr.pdf

29

Appendix

You can download this presentation material fromhttps://mizutatakanobu.com/2022CIFEr.pdf

30Order Price and Buy or Sell
Price

Order Price of each NAto, jPSell(one unit)
Random(GaussDistribution)

Expected Price of each NAttte, je, jP= P exp(r)Buy(one unit)

To replicate many waiting limit orders,
order price is scattered around expected price
NA places one buy order when order price > expected price
NA places one sell order when order price < expected price31Verification: Stylized Facts
The purpose of simulation is understanding the reasons and mechanism,
not replicating ALL Stylized Facts
The simplicity of the model is very important because unnecessary replication of macro phenomena
leads to models that are overfitted and too complex. Such models prevent understanding anddiscovery of mechanisms affecting price formation because of the increase in related factors.
Many empirical studies, e.g., Sewell 2006 have shown that both stylized facts (fat-tail and volatilityclustering) exist statistically in almost all financial markets.
Conversely, they also have shown that only the fat-tail and volatility-clustering are stable for any asset
and in any period because financial markets are generally unstable.

Fat-tail

1 to 100

kurtosis of price returns is positive
Volatility-clustering 0 to 0.2
square returns have a positive auto-correlation

The magnitudes ofthese values areunstable and vary
greatly depending on
the asset and/orperiod.

For the above reasons, an artificial market model should replicate these values as significantly positive
and within a reasonable range as I mentioned. It is not essential for the model to replicate specificvalues of stylized facts because the values of these facts are unstable in actual financial markets.
32

Stylized Facts

The model of Chiarella (2002) is very simple but replicates long-term statistical characteristics observed in actualfinancial markets: a fat tail and volatility clustering.
In contrast, Mizuta (2013) replicates high-frequency micro structures, such as execution rates, cancel rates, andone-tick volatility, that cannot be replicated with the model of Chiarella (2002).
The simplicity of the model is very important for this study, because unnecessary replication of macro phenomena
leads to models that are overfitted and too complex. Such models prevent understanding and discovery ofmechanisms affecting price formation because of the increase in related factors.

33

Why the two strategy?
efficient market hypothesis
Not always
neededonlyexist

Fundamentalstrategy

EmpiricalQuestionnaire*1
Main
Strategy

Shouldnot exist

AbsolutelyneededTechnicalstrategy

AbsolutelyNotneeded Nature ofShould needed Econophysics*2
Human being
exist
Replicate Stylized
Experimental
Facts
Definition of Stock
Economics*3
If you hold all stocks
Laboratory
You are owner of company
Market*1 Menkhoff, L. and Taylor, M. P. (2007): The Obstinate Passion of Foreign Exchange Professionals: Technical Analysis, Journal of Economic Literature
Yamamoto, R. (2021): Predictor Choice, Investor Types, and the Price Impact of Trades on the Tokyo Stock Exchange, Computational Economics
https://arxiv.org/abs/1906.06000*2 Lux, T. and Marchesi, M.(1999) Scaling and criticality in a stochastic multi-agent model of a financial market, Nature*3 Haruvy and Noussair (2006): The Effect of Short Selling on Bubbles and Crashes in Experimental Spot Asset Markets
https://doi.org/10.1111/j.1540-6261.2006.00868.x

34

Laboratory Market vs. Artificial Market

Sorry, the figure from Japanese bookhttps://www.coronasha.co.jp/np/isbn/9784339028164/

Fundamental Price
Artificial Market
Laboratory Market

Haruvy and Noussair (2006): The Effect of Short Selling on Bubbles and Crashes in Experimental Spot Asset Markets
https://doi.org/10.1111/j.1540-6261.2006.00868.x

Parameter fitting of the artificial market model including fundamental andtechnical strategies leads to similar results with the laboratory market.
This means that both strategies are needed to replicate the laboratory
market, and they may also be needed to replicate real markets.

35

A mathematical model
An empirical study

An Agent-Based Model

Macro Phenomena

Macro Phenomena
Price Formation
Simulation Feedback

As a resultTreat
Directly &Interactively

Micro Process
Agents Behavior

Simple Modelling

can directly treat andclearly explain the interactions

Price Formation
Simple summation
cannot explain

PreciousModelling

Treat
Separately

Micro Process
Traders Behavior

PreciousModellingcannot directly treat nor
clearly explain the interactions

36