A Dynamical Model for Financial Market: Among Common Market Strategies Who and How Moves the Price to Fluctuate, Inﬂate, and Burst?

: A piecewise linear dynamical model is proposed for a stock price. The model considers the price is driven by three rather standard demand components: chartist, fundamental and market makers. The chartist demand component is related to the study of differences between moving averages. This generates a high order system characterized by a piecewise linear map not trivial to study. The model has been studied analytically in its ﬁxed points and dynamics and then numerically. Results are in line with the related literature: the fundamental demand component helps the stability of the system and keeps prices bounded; market makers satisfy their role of restoring stability, while the chartist demand component produces irregularity and chaos. However, in some cases, the chartist demand component assumes the role to compensate the fundamental demand component, felt in an autogenerated loop, and pushes the dynamics to equilibrium. This fact suggests that the instability must not be searched into the nature of the different investment styles rather in the relative proportion of the contribution of market actors.


Introduction
Financial markets are complex systems whose functioning has been studied and discussed largely in literature. Conventionally, markets are seen as populated by rational investors that arbitrage away any possible predictable gain, thus what is left is just perturbation with null returns. However psychological forces unquestionably play a role in financial crashes, for example, it happened in 1929, on the Black Monday of October 1987, or in the dot.com bubble of 2001. Bubbles and crashes cannot be explained by an efficient market, where prices are supposed to reflect all the available information. Starting from empirical facts that cannot be explained by the efficient market hypothesis and observable features that can be seen as the outcome of speculative activities, a large stream of literature developed models in which prices are driven by the demand of heterogeneous market participants. The addressed issues consisted in understanding how irregular patterns, alternating periods of bull and bear markets, can be derivable from the way actors participate in the market. One of the first behavioral model in this direction was proposed in [1] with linear trading rules that were successively extended to non-linear versions in [2,3]. At the same time, imitative behavior and switching between investment styles have been also largely addressed to explain the emergence of fads, herding behavior, and financial bubbles [3][4][5]. Such a field intersects also with some empirical literature that looks at financial data searches for chaotic traces instead of randomity [6][7][8][9].
In the mentioned literature two rather standard approaches in terms of investment styles are considered: fundamental analysis and technical analysis. The fundamental analysis supports the trading through a deep analysis of the real economy behind the asset and evaluating the future earnings; in this respect, a fundamental value will summarize the outcome of such analysis and will drive the trader's order submission. The technical analysis, based on graphs and indices, return trends and the market sentiment, provides concise tools to understand where the market is going. Professional traders rely both on technical and fundamental analysis to determine whether and how to participate in the market. Hence the model considers the price driven by a composite demand in which fundamentals and indices contribute together to move the price. Moreover, the third typology of component is considered, hereafter referred to as market makers' demand: market makers are specific entrepreneurs who accomplish the task to absorb excess demand if any. The fundamental and chartist demand components are assumed piecewise linear, indeed it is quite common that an investor does not participate continuously in the market rather she enters (buy) or exits (sell) the market if something gives her a signal of unfair prices or trend inversion; in other words, an investor submits an order, whatever it is, when something happens to suggest the presence of earning opportunities. Thus the model belongs to that part of literature that sees markets as financial dynamical systems and applies continuous and discontinuous piecewise smooth maps in economics and finance, as [10][11][12]; in the specific financial markets, see [13] for a review. In the present model, the chartist demand component is given by a common chartist investment strategy that uses the difference of moving averages to catch trend inversions. From the mathematical point of view, this leads to a large first-order difference equation system whose study is not so straightforward. The equilibrium points and their stability can be studied only partially; the bifurcations that occur belong to the class of border collision bifurcations for which analytical results are still limited to low order systems [14][15][16].
The analytical and numerical analysis confirm that demand based on fundamental analysis keeps prices around the fundamental value even when chaos appears. Demand based on technical analysis can in large amount contribute to enhancing the chaos of the system and the price oscillations, while market makers assume the role to stabilize the market. The presence in the market of investors, those who try to speculate without caring about fundamentals, generates dynamics that remove the price from its fundamental value because their action drives the market in the same direction the market goes, giving strength to the trend. A clear example of such a phenomenon is represented by the financial bubble (see [17,18]): increasing prices lead investors to buy, which feeds the price increase far away from its fundamental. On the other hand, when the price is so pumped, it starts a period of instability, then a crash can occur, or a smooth deflation will bring back the price near its fundamental. In the model each demand component is weighted by a specific parameter, the ratios between these parameters give the balance between the investment styles relative dominance. Results are anything but surprising, and in line with the related literature, however, the emergence of a situation in which the fundamental demand component alone generates periodic prices and small amounts of chartist demand push prices to converge. How can chartist demand push to equilibrium a periodic dynamic triggered by the fundamentals? In an attempt to answer this question: while the fundamental demand component generates a loop that feeds a periodic up and down of prices, the chartist demand component that moves in an opposite direction operates as softening the fundamental force resulting in a convergent price. One could argue that the interaction of different investments styles in the market generates disequilibrium in prices when their contribution is out of proportion, otherwise, the market moves chaotic without spikes or anomalies, apparently in line with the efficient market hypothesis. In other words, one can conclude that the observed instability does not derive from the presence of some specific investment style in itself, rather from a disproportion of their reciprocal contributions to form the total demand.
The novelty of the model stays in introducing: (a) a common chartist investment strategy that sees applied the moving averages; in particular, the difference between two moving averages, as used by technical analysis, involves the use of past prices in the long and short term, leading to a high order system whose study is anything but trivial to face; (b) the market makers demand so far has not experienced enough attention in the related literature. Future investigations will move in the direction of studying deeply the border collisions bifurcation in high order system as it occurs here; adding sophistication to the market makers demand via a piecewise map, which would be more reasonable from the economic point of view; developing a stochastic version of the model to replicate more realistically the market and allowing for calibration on real data.
The rest of the paper is organized as follows: Section 2 presents the model with all its components in details; Section 3 presents the analytical study of the system in each component, in the limit of their tractability; Section 4 presents numerical examples with relative observations and results; in Section 5 a general discussion on the model is provided; finally Section 6 concludes.

A Financial Market Model
The proposed model considers the price as moved by the market demand, driven by three rather standard components: a fundamental component, set according to a "fair" price deriving from fundamental analysis; a chartist component, that follows the market trend by using technical analysis, and a market makers component, that helps liquidity and price fluidity absorbing demand in excess.
Let x t and y t be the stock price and the demand at time t, respectively. They can be put in relation by a difference equation system of the type where y f t , y c t and y mm t are the fundamental, chartist and market makers demands, respectively. The price is driven by past prices, just one step before, and the demand y t−1 . The price dependence with respect to the past and the demand could be modeled in many different maps, for the sake of tractability the linear map remains one of the most adopted choices.
Under the action of the three market forces, prices will move up and down, showing stable, periodic, or chaotic behavior. Each market component can dominate more than others pushing the market to an equilibrium price or an erratic movement, that even in a stylized fashion can remind real market reproducing known stylized facts. Each component will be studied analytically and numerically, varying the specific parameters that balance the weight of each component. In the following, each component will be described in detail.

Fundamental Demand
The fundamental strategy is built around the fundamental price that each agent evaluates according to her perception and belief, selecting the relevant economic and financial factors which contribute to producing the supposed security's intrinsic value. For the sake of simplicity, we consider a demand driven by a unique fundamental price as all the investors agree on it. A heterogenous specification of the fundamental value could be adopted to incorporate heterogenous agents' beliefs; for example, we could select a fundamental value following a random walk which can incorporate also the effect of news arrival, as in [5,19], however, it would add more complexity to the model.
Given v the fundamental price, the stock results overvalued if x t > v, the stock is correctly valued if x t = v, and the stock is undervalued if x t < v; then an investor sells, holds her position, or buys, respectively, because she expects prices decreasing or increasing accordingly. In literature this has been often modeled by a linear function y f t ∼ (v − x), which can generate an unlimited demand; however limited money availability could suggest that a bounded function could fit better the bounded reality, for example, the following The Equation (2) owns the quality to be continuous and smooth, however its analytical tractability could be hard. Then a piecewise linearized version around v could be more suitable: Note that the map is continuous if d = cδ, discontinuous otherwise. This map can be written also as where χ A is the indicator function of set A. The dynamics of these maps will be analyzed in Section 3.1.

Chartist Demand
The technical analysis attempts to interpret the evolution of the market by looking at charts, for this reason, the investors using such analysis are called often chartists. According to the technical analysis, the price charts present recurrent figures (head and shoulders, Elliot's wave, triangular forms, just for citing some examples); such figures can indicate evolution, persistence, or inversion of trend. If the market is in a down-trend (bearish) the technical analysis suggests selling, and if it is in an up-trend (bullish) to buy; price dynamics are often summarized by indicators as moving averages, those are built such that they can generate a signal of market changes.
Investment decisions in technical analysis are the result of complex evaluations based on market observation by means of charts, signals, oscillators involving prices, volumes, and any variable of interest. Among the most commonly used indicators, there are moving averages, that smooth the price dynamics, clearing it from temporary oscillations. The difference between two moving averages, a long and a short one is a common indicator sensible to a trend inversion. The moving average (ma) at time t on K days is defined by it is a smooth line of prices that shows the development of the price following it without anticipating. It is a popular practice to use and compare two moving averages, one on the long term, one on the short term; the former catches the main trend while the latter is more sensitive to short time fluctuations; their difference, called a difference of averages (doa), is such that it generates a signal as they cross each other; indeed, in the short term, ma is lower than the long-term ma and their position inverts, the short ma is catching an increasing trend inversion; while when the short term is greater than the long one and their position inverts, their intersection signals a decreasing trend beginning. Formally, let doa t be where S < L, i.e., ma S (t) is the short term moving average and ma L (t) is the long term moving average, briefly we have: In a few words, the signal is generated when the doa-line crosses zero, if it does from below, the signal is to buy, if it does from above is to sell. Introducing such an indicator in the chartist demand, we get where e is the specific chartist parameter and χ is the indicator function. Given (4), we have it results where

Market Makers Demand
Market makers clean the market by excess demand, so they buy or sell in opposition to the market behavior. For this reason, the easiest expression is where d m is the reaction parameter that balances the market makers' presence in the market.

The Analytical Study
Fundamental and chartist components are piecewise linear maps of first and L + 1 order. In the present section, fundamental and chartist demand components are first considered singularly and analytically studied to the limit of their tractability, then they will be studied together. The market makers' demand will not be considered alone because this lacks economic sense.

The Model with Fundamental Demand
Let us start with the map The system can be re-written in one equation which is a one-dimensional map but a second-order difference equation. This map admits a positive fixed point lower than v for 1−a bc > 0, a negative fixed point for 1−a bc < m * and one negative and two positive fixed points greater than v for m * < 1−a bc < 0, where m * is given by given x * s to be the solution of the equation The local/global stability of such points can be studied numerically; the trajectories appear in some cases non-trivial, but a full analytical study is hindered by the presence of the arctang. The map in (10) can be approximated by a two-dimensional piecewise smooth map, which shows interesting behavior, and it is more analytically tractable. Note that parameters in the piecewise smooth map can be set to have a continuous map that approximates (10), the calculation is straightforward. For the sake of simplicity, we use the same notations even if they might differ.
Let us consider now the piecewise linear map which can be written in a normal form where The phase space of this map is divided by the borderlines in each region the dynamics follows a linear map continuous in its relative region. The map is invertible if bc = 0. By a straightforward calculation we find that the map owns three fixed points O i ∈ L i with i = 1, 2, 3, Each of these three points exists in an own existence region according to parameters value (a, b, c, d, δ, v). In order to determine the stability, we need to calculate the eigenvalues of matrices A 1 and A 2 , where the characteristic polynomials are Since p 1 (λ) admits λ = 0 and λ = a as roots, O 1 and O 3 are stable if a < 1. The polynomial p 2 (λ) has discriminant ∆ = a 2 − 4bc that depicts different stability regions according to a, b, c values. The curve ∆ = 0 partitions the space R 3 into two regions where the eigenvalues are The bifurcation conditions are given by In Figure 1 (left) the stability regions and the bifurcation curves are represented in the (a, b) plane with c = 1, while in (middle) the stability regions and the bifurcation curves are represented in the (b, c) plane with a = 1. In Figure 2 (left:right) the bifurcation surfaces are shown in the (a, b, c) space. The conditions for the asymptotic stability are In Figure 1 the asymptotic stability region is highlighted by the striped area. Simulations and relative discussion of this case are reported in Section 4.

The Model with Fundamental and Market Makers Demands
In the following section, we consider fundamental demand together with market makers. Considering market makers alone have a poor economical meaning, for this reason, it is more of interest to the presented case. We have the following system which corresponds to a normal form as in (14) where Matrices A 1 and A 2 are invertible if ad m = 0 and −ad m + bc = 0, respectively. As in (13) the phase space is divided in 3 regions L i , with i = 1, 2, 3 and a straightforward calculation brings to the following fixed points Now the parameters set includes the new parameter d m . The characteristics of polynomials are In L 1 and L 3 eigenvalues are always real and fixed points are stable if a < 1 and d m < 1. Flip bifurcation occurs at a = 1 and d m = 1, fold bifurcation occurs at a = 1 and d m = −1, while Neimarck Sacker bifurcation occurs when a = − 1 d m . The stability region in L 2 is given by the conditions and bifurcation conditions are Assuming that d m ∈ [0, 1] which is economically reasonable, in Figure 3 stability regions and bifurcation curves are plotted with c = 1 (lhs) and a = 1 (rhs). The triangular region moves accordingly the effect of d m , while the hyperboles on the right-hand side moves up and down accordingly.

The Model with Chartist Demand
Considering only the chartist component, the model takes the form where It is a system of order L + 1, that can be transformed into a L + 2 system of first order as following Outside D the system collapses in x t = ax t−1 , which has the trivial solution x t = a t x 0 . The characteristic polynomial is given by where a 1 = (−1) L , a 2 = (−1) L+1 a, a 3 = (−1) L+1 b e S − e L , a 4 = (−1) L eb S , and a 5 = (−1) L+1 eb L . In this case the study of the stability region is not trivial.

The Complete Model
When all the components are considered the model takes a normal form Also, in this case, we can write the characteristic polynomial, however, the stability region study is not trivial, and it can be performed only partially. For this reason, in the following, we settle for numerical simulation to discuss the dynamics scenario and the economic implications.

Numerical Simulation
In the following, we study numerically all the presented cases. In detail, we start with the fundamental map; then we consider fundamental and market makers' demand together; as a third step we consider chartist demand firstly alone then jointly with fundamental demand and, finally, we combine all the demands. The market makers' demand is studied only associated with fundamental and chartist demands, indeed, as already mentioned, being thought to absorb excess demand, alone it loses reasonability from the economic point of view. In all the simulations it holds v = 5, δ = v 2 and d = 2. The main discussion is about parameters a, b, c, d m , e which give the impact of each demand and past prices on the dynamics.

Fundamental Demand
We investigate the dynamics starting from the analytical results. In the asymptotic stability region, prices go to one of the fixed points with speed according to the parameters. Closer the parameters to the border of the stability region slower the convergence, as it can be seen in Figure 4, comparing the scenario in the top with parameters a = 1, b = 1.9 and c = 0.4 to that in the bottom with a = 1, b = 0.7 and c = 1.4, where the value of c at the border would be 1 b = 1.4286. Each figure in the following shows price dynamics on the left-hand side and the phase space (x, y) on the right-hand side. Outside the stability region, the dynamic scenarios include periodic orbits and chaotic motion. Some examples of periodic orbits are reported in Figure 5, where on the top there is an orbit of period 6 to be read clockwise; note that in terms of price and demand the orbit is 3-period but they are combined giving 6 couples of price and demand. On the bottom a periodic elliptic orbit appears, this dynamics holds for any value of a ∈ (0, 1) when b and c are equal 1. In this case, the effect of the demand is fixed, while the price drift matters: the higher a the closer the ellipse center to the fixed point (v, 0) and the closer the amplitude to the range (v − δ, v + δ). Examples of chaotic motion are reported in Figures 6 and 7. In Figure 6 the plot on the top panel shows prices almost regularly oscillating in the range (v − δ, v + δ), since parameters are closed to the stability region border; while on the bottom panel parameters are far from the border and prices oscillate widely. In Figure 7, c is negative; being c the fundamental demand parameter, negative values mimic a trend follower demand, indeed the dynamics show bear and bull period (on the top), a wide range of prices (in the center) and price overvaluation (on the bottom). In Figure 8 bifurcation diagrams with respect c show the map behavior varying c.

Fundamental and Market Makers
As already discussed, stability regions, see again Figure 3, the presence of market makers tends to regularize prices enlarging the stability region. Outside of this region dynamics scenarios appear very similar to those in the already studied case with only the fundamental demand component. We focus on d m ∈ [0, 1] because values outside this interval own low interest from an economic perspective, indeed such a case complies with a reverse effect of market maker that rather absorbing amplifies the excess demand effect. Even if such dynamics could be interesting from the mathematical point of view, its absence of interest from the economical point of view suggests skipping this study. The simulation outcomes do not add any insight to those already discussed in the fundamental demand map, thus no figures about this case are reported.

Chartist Demand
It is of interest to see how the system behaves when only chartist demand is active. When a = 1 and b = 1, no matter the chartist contribution, the system converges to a fixed point determined by the initial conditions. When a < 1 and b = 1 the system shows a rough periodicity for small value of e, i.e., for small contribution of the chartist investment style, and a chaotic behavior for high values of e, see bifurcation diagrams in Figure 9. Lower the b later the chaos appears, since a low b reduces the amplitude of the chartist demand and hence its impact on prices, see Figure 9 in the center. Finally, if a is greater than 1, but still in that range in which prices do not explode, the contribution of the chartist leads directly to chaos, see Figure 9 (rhs).

Fundamental and Chartist Demand
Let us now consider the dynamics with the fundamental and chartist demands. In Figure 10 (lhs), a, b, c are the same as those in the bottom of Figure 5, while e ∈ [0, 7.6]. The bifurcation diagrams show that low values of e do not change the dynamics, then the presence of chartist investors stabilizes the price pushing it to converge to a slightly overvalued price. Increasing e the dynamics becomes chaotic with small intervals in which the contribution of chartist demand pushes prices to converge or to oscillate around the equilibrium, not far from the fundamental value. How and why chartist demand can do this is not straightforward to understand and appears counterintuitive. Note that when a = 1.1, b = 0.8 and c < 1 b the fundamental map converges and chartist investors do not affect the convergence, even a large amount of chartists do not change the dynamics. Similarly when a = 1 and b = 1.9 and c = 1 b chartist demand has no effect on the periodic dynamics of fundamental map. Differently, when a < 1, b < 1 and c < 1 b , such that the fundamental map dynamics is asymptotically stable, a small presence of chartist has no effect, while high values of e move the dynamics into chaos. Note that in Figure 10 (rhs) there is a range of e in which the price oscillates chaotic into the range (v − δ, v + δ), while for e approaching values near 7 prices move chaotic in a very large range. This fact suggests the following picture: prices oscillate in a reasonable range under the action of fundamental and chartist forces, for some reason, chartist investors increase in number till to surpass a certain threshold, after that, prices start to oscillate widely as it happens in case of market turbulence, with prices going up and down crazily. This confirms the belief that chartist investors participate in instability and bubble inflation. However, it appears that the responsibility of instability stays more in the unequal proportion of force pressures on the market than the specific action of an investment style itself. In other words, it is not the adoption of the technical analysis in itself the problem but their dominance in proportion. Figures 11 and 12 propose three dynamics with comparable parameters. On the left-hand side, only fundamental demand is considered, while in the center fundamental demand is coupled with chartist demand and on the right-hand side, all the components are effective. The dynamics changes according to the demand: with only fundamental demand, the price stays in a narrow neighborhood of O 2 , when chartist demand intervenes, the regular dynamics moves into a chaotic elliptic attractor (see the plot in the center), while the intervention of market maker regularizes and pushes the price to converge fast (see rhs). In this case, chartist demand moves prices to chaos, and market makers restore the convergence. Differently in Figure 12, fundamental parameters are set to generate a periodic elliptic attractor (lhs), chartist demand has the effect to shrink the price to the fixed point O 2 (see in the center) and again the market makers accelerate the convergence (rhs). In this example, chartist demand has the effect to push prices to equilibrium.

Further Discussions
The present section addresses a general discussion about the model, its limits, and some possible future evolutions. The presented model is deterministic and pointed toward considering how market participants, their styles, and their attitudes have an impact on prices and market instability. The model considers three rather standard strategies and provides stylized explanations of empirical market features. Thanks to its simplicity the model is flexible with respect to many future variations. One could include the possibility to have fundamental value varying over time, following for example a random walk as in [4]. This can be done substituting in Equation (10) Another variation could consider the switching between investment styles; this can be done by allowing the reaction parameters c, d, e, and d m also including the tolerance δ to change in time as in [19]. Indeed, in the full demand, we can see the contribution of investment styles accounted by traders simultaneously in the proportion given by the reaction parameters. Traders can consider differently the misalignment by fundamentals or the trend, thus reaction parameters can vary according to the strength of the investors' belief in each specific investment style. In other words, there could be phases in the market in which investors believe and adopt more fundamental analysis than technical one or vice versa. For doing so a mechanism of imitation and profitability evaluation must be implemented. Alternatively, although more simplistic it could be done by considering parameters varying randomly in time. A stochastic version of the model can also be considered, including a random perturbation of prices to incorporate the effect of traders moved by liquidity needs or the effect of exogenous news arrival on the market. The stochastic version has the advantage to replicate more realistically the market features. Indeed, a deterministic model has mainly the aim to offer a stylized explanation of market features and not the presumption to be completely realistic as it is needed to be used for forecasting purposes for example. The stochastic version could be also subjected to a calibration procedure following the simulated method of moments as in [20,21]. Although the undeniable value of work pointed towards the reproduction of real market dynamics in its entirety, such an issue is outside the aims of the present paper and left for future investigations.

Conclusions
In the present model, a simple financial market model is considered with three rather standard market forces contributing simultaneously to the total demand: fundamental, chartist, and market makers. The model is given by a discrete difference equation system with a piecewise linear map of a high order. Each component has been studied separately to understand and highlight its contribution to the dynamics. Results are not surprising and in line with the related literature [1,4,12,13]: fundamental demand helps the stability of the system and keeps prices bounded; market makers satisfy their role of restoring stability, while the chartist demand component adds instability and chaotic movement to prices. However, we see that in some cases chartist demand can compensate for fundamental demand, felt in the loop, and pushes the dynamics to equilibrium. The lesson we can take from this fact is that the instability does not stay intrinsically in the nature of the demands but their combination and proportion. Indeed, markets are places where a mix of different beliefs and attitude meets. The market dynamics cannot be anything else than the outcome of such a variety of agents. In the market, the heterogeneity of actors finds an equilibrium that can show regular dynamics and smooth oscillations coherent with the efficient market hypothesis. Nevertheless, if any kind of disequilibrium occurs in the market forces, prices can oscillate widely, bear and bull periods can arrive, and bubbles can inflate and explode.
The contribution of the paper goes in three directions: (1) it considers a common, rather so far unstudied, chartist demand implying moving averages difference; (2) the model includes market maker participation, so far that it has not received so much attention; (3) the model uses a high order piecewise linear map that provides interesting bifurcation diagrams belonging to the class of border collision bifurcations but those deserve much attention for the future, also for their economic implications.
Future investigations can move in the following directions: (1) the study of border collisions bifurcations in high order systems as the one proposed here; (2) the sophistication of the market maker demand via a piecewise map; (3) the implementation of a stochastic version of the model with a mechanism of changing the weight of each investment style; (4) the calibration of a stochastic version of the model to reproduce real markets dynamics. Data Availability Statement: Data were generated during the study. The paper presents any information needed to replicate the study.

Conflicts of Interest:
The author declares no conflict of interest.