*2.1. 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 *xt* > *v*, the stock is correctly valued if *xt* = *v*, and the stock is undervalued if *xt* < *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<sup>f</sup> <sup>t</sup>* ∼ (*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

$$y^f = \varepsilon \arctan(V - x). \tag{2}$$

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:

$$y^f = \begin{cases} d & if \quad x < v - \delta \\ c(v - x) & if \quad v - \delta \le x \le v + \delta \\ -d & if \quad x > v + \delta \end{cases}.\tag{3}$$

Note that the map is continuous if *d* = *cδ*, discontinuous otherwise. This map can be written also as

$$y^f = c(v - x)\chi\_{[v - \delta, v + \delta]} - d\chi\_{(v + \delta, \infty)} + d\chi\_{(\infty, v - \delta)}\cdot \varepsilon$$

where *χ<sup>A</sup>* is the indicator function of set *A*.

The dynamics of these maps will be analyzed in Section 3.1.

#### *2.2. 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

$$ma\_K(t) = \frac{1}{K} \sum\_{i=t-K+1}^{t} x\_{i\prime} \tag{4}$$

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 *doat* be

$$
tau\_t = ma\_S(t) - ma\_L(t),
\tag{5}$$

where *S* < *L*, i.e., *maS*(*t*) is the short term moving average and *maL*(*t*) is the long term moving average, briefly we have:

$$\begin{array}{l}\text{if} \quad doa\_{t-1} < 0 < doa\_t \quad \text{then} \text{ buy}\_t\\\text{if} \quad doa\_{t-1} > 0 > doa\_t \quad \text{then} \text{ sell.}\end{array} \tag{6}$$

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

$$y^\varepsilon = e \cdot (do a\_t - do a\_{t-1}) \cdot \chi(do a\_t \cdot do a\_{t-1} < 0) \tag{7}$$

where *e* is the specific chartist parameter and *χ* is the indicator function. Given (4), we have

$$
tau\_t - 
tau\_{t-1} = \frac{1}{S}(\mathbf{x}\_t - \mathbf{x}\_{t-S}) - \frac{1}{L}(\mathbf{x}\_t - \mathbf{x}\_{t-L}),\tag{8}$$

it results

$$y\_t^\varepsilon = \varepsilon \cdot \left(\frac{1}{S}(\mathbf{x}\_t - \mathbf{x}\_{t-S}) - \frac{1}{L}(\mathbf{x}\_t - \mathbf{x}\_{t-L})\right) \chi(D),\tag{9}$$

where *D* = {*xi*, *i* = *t* − *L*,..., *t* | *doat* · *doat*−<sup>1</sup> < 0}.
