Behavioral agent-based framework for interacting ﬁ nancial markets

Purpose – This paper aims at developing a behavioral agent-based model for interacting ﬁ nancial markets. Additionally,theeffectof imposingTobin taxesonmarket dynamicsis explored. Design/methodology/approach – The agent-based approach is followed to capture the highly complex, dynamic nature of ﬁ nancial markets. The model represents the interaction between two different ﬁ nancial markets located in twocountries. The arti ﬁ cial markets are populated withheterogeneous,boundedly rational agents. There are two types of agents populating the markets; market makers and traders. Each time step, traders decide on which market to participate in and which trading strategy to follow. Traders can follow technical trading strategy, fundamental trading strategy or abstain from trading. The time-varying weight of each trading strategy depends on the current and past performance of this strategy. However, technical traders are loss-averse, where losses are perceived twice the equivalent gains. Market makers settle asset prices according to thenetsubmitted orders. Findings – The proposed framework can replicate important stylized facts observed empirically such as bubbles and crashes, excess volatility, clustered volatility, power-law tails, persistent autocorrelation in absolutereturns andfractal structure. Practical implications – Arti ﬁ cial models linking micro to macro behavior facilitate exploring the effect of different ﬁ scal and monetary policies. The results of imposing Tobin taxes indicate that a small levy may raisegovernmentrevenues without causingmarketdistortionorinstability. Originality/value – This paper proposes a novel approach to explore the effect of loss aversion on the decision-makingprocess in interacting ﬁ nancial markets framework.


Introduction
argues that imposing small, uniform taxes on all financial transactions would penalize short-term speculations and, hence, stabilize the financial market. Many European Union countries impose taxes on financial transactions. However, introducing financial transaction taxes in other financial markets is still under debate. Proponents believe that a levy of financial transaction taxes would provide sizeable revenues to governments. On the other hand, contrarians argue that introducing transaction taxes to financial markets would reduce market liquidity and a higher price volatility would be ensued. Additionally, the growing role of electronic brokering would increase tax evasion possibilities. This results in reducing the Tobin tax's ability to yield revenues.
Hesitation of imposing a levy could be due to the unexpected results of market crashes or instability. Collateral effects can be avoided by exploring the impact of regulatory policies on the dynamics of artificial financial markets. The effect of imposing Tobin taxes on the dynamics of artificial financial markets has been studied in many studies (Westerhoff and Dieci, 2006;Westerhoff, 2008;Stanek and Kukacka, 2017). However, none of these studies has considered the effect of behavioral biases on trader's decision-making process.
The expected utility theory has led the analysis of decision-making under uncertainty. Utility expectations was perceived as a normative model of rational choice (Eiselt and Marianov, 2011) and formulated as a descriptive model of economic behavior (Friedman and Savage, 1948;Neve et al., 2015). Therefore, it was assumed that all rational economic agent would follow the utility theory most of the time. Markowitz (1952) proposes that utility should be defined on gains and losses rather than on final wealth states. Later, Kahneman and Tversky described several choice problems in which preferences under uncertainty violate the axioms of the expected utility theory (Kahneman and Tversky, 1979, 1984, 1991Kahneman et al., 1990).
Kahneman and Tversky reveal that risk aversion in the positive domain is associated with risk-seeking in the negative domain; this effect is known as the reflection effect. These propositions establish an alternative description model for decision-making under risk, called the prospect theory. According to the prospect theory, people normally perceive outcomes as gains and losses, instead of final states of wealth. However, gains and losses are defined relative to some reference point, which may correspond to the current wealth position. Additionally, gains and losses could be defined as the actual received or paid amounts.
As proposed by Kahneman and Tversky (1979), a value function for changes of wealth is concave above a reference point and convex below it. Accordingly, the proposed S-shaped value function is defined on deviations from the reference point; concave for gains and convex for losses and steeper for losses than for gains. The main behavior affecting responses to changes in wealth is that the pain of losing a sum of money seems to be greater than the happiness associated with gaining the same amount. These findings have been supported by recent studies (McGraw et al., 2010;Neve et al., 2015).
Few efforts have been spent to introduce behavioral biases to agent-based models (Takahashi and Terano, 2003;Lovric et al., 2010;Li et al., 2014;Selim et al., 2015;Ezzat, 2016;Feldman and Lepori, 2016). For instance, Selim et al. (2015) investigate the effect of lossaversion behavioral bias on the switching behavior between technical and fundamental trading strategies, market stability and price distortions. The authors study market dynamics under two assumptions: (1) chartists are loss-neutral; and (2) chartists are loss-averse.
The results reveal that most of the traders prefer fundamental analysis over technical analysis. Henceforth, loss aversion improves the market by minimizing its volatility and distortion. Nevertheless, the above models are not designed to explore the dynamics of interacting financial markets. Studying the interaction between international financial markets is of crucial importance, especially after the recent global financial crisis (Westerhoff and Dieci, 2006;Schmitt and Westerhoff, 2014).

Agent-based framework
The main contributions of this paper are: introducing loss-aversion behavioral bias to the framework of interacting financial markets proposed by Westerhoff and Dieci (2006); investigating the dynamics of interaction between two financial markets populated with loss-averse agents; and examining the effect of levying transaction taxes on markets stability, price distortion and the switching behavior between interacting markets following two different trading strategies; fundamental and technical analysis.
The aforementioned models can replicate some important stylized facts, which are common statistical features observed in most financial markets. Significant stylized facts are usually formulated in terms of qualitative and quantitative properties such as price bubbles and market crashes, random-walk prices, clustered volatility, excess volatility and long memory (Mandelbrot, 1963;Fama, 1970;Guillaume et al., 1997;Cont, 2001;Cont, 2005;Haas and Bigorsch, 2011). A simple behavioral agent-based model of two interacting financial markets is developed. The model is structured as follows. The markets are populated with two types of agents; market makers and traders. At each time step, traders decide either to trade or to stay inactive. Active traders follow technical or fundamental trading strategy as suggested by previous surveys (Taylor and Allen, 1992;Menkhoff, 1997;Frankel and Froot, 1987a, 1987b and laboratory experiments (Hommes, 2011). Technical trading aims at exploiting price trends. Conversely, fundamental trading seeks to take advantage of mean reversion. Traders can participate in one market at a time. The attractiveness of a trading strategy is determined by the performance of this strategy in most recent past, which demonstrates a learning behavior. Trading-strategy weights are computed using the discrete-choice model proposed by Manski and McFadden (1981). However, traders following technical analysis are loss-averse, where losses loom larger than equivalent gains. Accordingly, weights of technical trading are expressed in terms of a piecewise linear function proposed by the prospect theory (Kahneman and Tversky, 1979, 1984, 1991. There is a market maker located in each market. Market makers set asset prices according to the net submitted orders. For this purpose, a linear impact function proposed by Farmer and Joshi (2002) is followed. Agents interact indirectly through their influence on price adjustment. This affects the attractiveness of trading rules, which turns to affect the belief adaptation process.
By simulation, the results show that the developed model can generate financial time series that exhibit important stylized facts observed empirically such as bubbles and crashes, volatility clustering, power-law tails, long memory and fractal structures. Thereafter, the proposed model serves as a test-bed for policy makers to investigate the effect of levying taxes on financial transaction. The impact of levying financial transaction taxes on the market dynamics is extensively investigated.
The rest of the paper is organized as follows. In Section 2, the proposed agent-based financial market model is presented. Asset pricing dynamics is investigated in Section 3. Furthermore, the results of extensive Monte Carlo simulation are displayed. In Section 4, the effect of imposing transaction taxes on market dynamics is investigated. Section 5 concludes the paper.

The model
There are two different stock markets, Market X and Market Z, located in two countries. It is assumed that the countries either share the same currency or have agreed upon a fixed exchange rate. For simplicity, the two stock markets are assumed to be symmetric. Thereby, REPS 5,2 traders have no preference for one market over the other. There are two types of agents; market makers and traders. In each time step t, t = 0, 1, [. . .], T, each trader decides either to submit orders or abstain from the market. If a trader chooses to submit an order, she/he can submit her/his order either to Market X or Market Z. In addition, the trader can follow either technical or fundamental trading rule. Therefore, if the trader decides to submit an order, she/he would choose between five trading alternatives (two different stock markets and three different trading actions).
Market makers settle asset prices following a log-linear price impact function suggested by Farmer and Joshi (2002). This function measures the relation between the orders quantity (demand/supply) and the price of the asset. Thus, asset log price in period t þ 1 for Markets X and Z, can be given by: (1) and: where p X t and p Z t are the log prices at time t in Markets X and Z, respectively, a is a positive price settlement parameter, D Xc t and D Zc t are the orders submitted at time t by chartists to Markets X and Z, respectively, D Xf t and D Zf t are the orders submitted at time t by fundamentalists to Markets X and Z, respectively, w Xc t and w Xf t are the weights of technical and fundamental strategy, respectively, in Market X at time t, and w Zc t and w Zf t are the weights of chartists and fundamentalists, respectively, in Market Z at time t. To make the assumptions close to the real markets, noise terms a X t and a Z t are added to catch any random factors affecting the price settlement process in Markets X and Z, respectively. It is assumed that a X t and a Z t , t = 1, 2, [. . .], T are independent, identically distributed (IID) normally distributed random variables with mean zero and constant standard deviations s X a and s Z a , respectively. Chartists follow technical analysis to exploit price changes (Murphy, 1999). Technical trading orders submitted to Markets X and Z, respectively, at time t can be written as: and: where b is a positive reaction parameter (also called extrapolating parameter) that captures the sensitivity of chartists to price changes. The first term at the right-hand side of equations (3) and (4) represents the difference between the current and last price, which indicates the exploitation of price changes. The second term captures additional random orders of technical trading rules. b X t and b z t ; t ¼ 1; 2; . . . ; T are IID normally distributed random variables with mean zero and constant standard deviation s X b and s Z b , respectively.

Agent-based framework
Fundamental analysis assumes that prices will revert to their fundamentals in the short run (Graham and Dodd, 2009). Orders submitted by fundamentalists to Markets X and Z at time t can be descried by: and: where c is a reaction parameter (also called a reverting parameter) that captures the sensitivity of fundamentalists to price mean reversion. f X t and f Z t are log-fundamental values (or simply fundamental values) (Day and Huang, 1990). The first term at the righthand side of equations (5) and (6) represents market distortion at time t, which computes the deviation of index prices from their fundamentals, dist t = f tp t . g X t and g Z t are introduced to capture additional random orders of fundamental trading rules. g X t and g Z t ; t ¼ 1; 2; . . . ; T are IID normally distributed random variables with mean zero and constant standard deviations s X g and s Z g , respectively. The log-fundamental values are assumed to evolve following a random walk such that: and: where h X t and h Z t are fundamental shock values in Markets X and Z, respectively. h X t and h Z t ; t ¼ 1; . . . ;T are IID normally distributed with mean zero and constant standard deviations s h X and s h Z , respectively. It is assumed that fundamental volatilities are equal in both markets. It is also assumed that fundamental traders can calculate the fundamental values.
The evolutionary part of the model depicts how beliefs are evolving over time (Brock and Hommes, 1998). That is, how agents adapt their beliefs and switch between strategies. Belief adaptation is mirrored in the strategy weights w t ; represents the weight of inactive agents and w Xc t ; w Zc t ; w Xf t ; w Zf t are as indicated in equations (1) and (2). Strategy weights are updated according to evolutionary fitness measures (or attractiveness of the trading rules) which can be presented as: REPS 5,2 (11) and: A Zf t and A 0 t are the fitness measures of following chartist strategy in Market X, chartist strategy in Market Z, fundamental strategy in Market X, fundamental strategy in Market Z and no-trade strategy, respectively. Inactive traders got zero attractiveness for abstaining from trading. The fitness measure of the other two trading rules, the technical and the fundamental analysis, depends on three components. The first term of the right-hand sides of equations (9)-(12) is the performance of the strategy rule in the most recent time. Notice that orders submitted in period t -2 are executed at the price declared in period t -1. Gains or losses are recognized according to prices announced in period t. The second term of the right-hand side of equations (9)-(12) represents the costs of trading in terms of transaction taxes, where tax X is the tax rate of Market X and tax z is the tax rate of Market Z. The third term of the right-hand side of equations (9)-(12) denotes agents' memory, where 0 # m # 1 is the memory parameter that measures the speed of recognizing current myopic profits.
Loss-aversion behavioral bias is proposed, inspired by Selim et al. (2015), where chartists evaluate their strategy fitness in terms of a value function of gains and losses (Tversky and Kahneman, 1991;Benartzi and Thaler, 1993). The proposed value function implies that the pain of losses is twice the satisfaction of equivalent gains. Therefore, the attractiveness of technical strategy is given by: where l > 1 is the parameter of loss aversion that measures the relative sensitivity to gains and losses. However, setting l = 1 reduces the value functions to v Xc t ¼ A Xc t and v Zc t = A Zc t ; this case can be called loss-neutral chartists (Selim et al., 2015).
Following Manski and McFadden (1981), the weight of each strategy can be obtained by the discrete-choice model as: Agent-based framework and: Trading strategy weights are proportional to strategy attractiveness. Parameter r in equations (16)-(19) is called the intensity of choice, and it measures the agent's sensitivity to select the trading strategy with higher fitness measure.

Simulation results and analyses 3.1 Calibration and simulation design
In this section, the model is validated by investigating the extent to which it is able to replicate the stylized facts observed empirically. The values of model parameters are chosen such that the model can mimic the dynamics of real financial markets. For the detailed declaration of the idea behind choosing specific values of the parameters, the reader can refer to Westerhoff and Dieci (2006). The proposed artificial financial market is implemented using NetLogo platform (Unsupported source type (ElectronicSource) for source Wilensky, 1999). At initialization, all parameters of the model are equal to the values defined in Table I. The performance of 1,000 simulation runs is investigated. Each run contains 5,000 daily observations. In the following, the evolutionary dynamics of the proposed model are discovered.

Stylized facts replication
Before engaging in a comprehensive Monte Carlo simulation, it is important first to observe a representative simulation run. Figures 1-8 depict the behavior of this specific run. Figure 1 illustrates the evolution of log-prices for the two markets. Note that the prices oscillate around their fundamental values. The average market distortion can be computed as dist ¼ 1 T P T t¼1 jdist t j, which exhibits a value of 11.49 per cent for dist X and a value of 8.54 per cent for dist Z . The two price series are random walk and display bubbles and crashes. These results are in good agreement with the stylized facts observed empirically. Figure 2 displays returns of the two markets. It can be observed that extreme returns reach up to 6 20 and 6 10 per cent for Market X and Z, respectively. Following Guillaume et al. (1997), volatility can be calculated as the average absolute returns (vol) vol ¼ 1 The computed average volatilities are 1.35 and 1.07 per cent for vol X and REPS 5,2 vol Z , respectively, indicating excess volatility feature (Shiller, 1981). Also, Figure 2 shows another stylized fact of asset markets, which is volatility clustering. Figure 3 depicts the weights of the five trading strategies. The first panel in Figure 3 displays the average weights, which are computed as 20, 25.6, 19.2, 20.4 and 14.8 per cent for w Xc t , w Xf t , w 0 t , w Zf t and w Zc t , respectively. Note the higher volatility in Market X than that in Market Z, which can be explained by the higher participation of chartists in Market X than that in Market Z. Additionally, these results show that 34.8 (46) per cent of the agents follow technical (fundamental) trading. The effect of loss-aversion behavioral bias can be explored by running a simulation using the same random seeds and the parameter setting illustrated
Another significant stylized fact is power-law tails, with a tail index somewhere in the region 2-5. The exponent a of the Pareto distribution for the tails can be expressed by the following inverse cubic law: with a r % 3 (Lux and Marchesi, 1999;Lux, 2009;Haas and Bigorsch, 2011). To check the power-law tails, the Hill index tail estimate is calculated for the smallest and largest 10 per cent of the observations. Figure 4 illustrates the Hill index tails estimation process (Hill, 1975;Huisman et al., 2001). Regression on the smallest (largest) 10 per cent of the observations yields a value of 2.85 6 0.049 (2.40 6 0.048) for Market X and a value of 4.09 6 0.079 (3.51 6 0.072) for Market Z. These results are in good accordance with the inverse cubic law of (21). Another astonishing stylized fact to be investigated is the absence of autocorrelation in raw returns. Figure 5 represents autocorrelations for the first 100 lags of raw returns for both markets. The dashed lines present 95 per cent confidence bands according to the Agent-based framework assumption of a white noise process. The raw returns for the two markets show autocorrelation coefficients, which are not significant over 100 lags. This implies the randomness of asset prices.
To study the predictability of asset volatility, autocorrelation in absolute returns is studied. The two panels in Figure 6 depict autocorrelations for the first 100 lags of absolute returns for the two markets. The dashed lines present 95 per cent confidence bands according to the assumption of a white noise process. The panels show that absolute returns are significantly autocorrelated for up to 100 (30) lags in Market X (Z). Thus, volatility can be partially predicted (with no significant prediction of the direction of price movements).
Another important fact of the financial markets is self-similarity as recognized by Mandelbrot (1983). To investigate self-similarity, detrended fluctuation analysis (DFA) is performed following Peng et al. (1994). Linear relationship on a log-log scale between the average fluctuation, F n , and the time scale, n, shows scaling structure of asset returns. Figure 7 depicts the estimation of the scaling exponent, H r , for raw returns of Markets X and Z. A value of H = 0.5 indicates a white-noise process, a value of 0.5 < H < 1 corresponds to long-range power-law autocorrelations and a value of 0 < H < 0.5 indicates that large and small oscillations of the time series are very likely to alternate. The scaling exponent H r yields a value of 0.50 6 0.029 for Market X and a value of 0.52 6 0.005 for Market Z. Consequently, estimated values of the scaling exponent show white-noise processes. Figure 8 presents the estimation of the scaling exponent, H |r| , for absolute asset returns. The scaling exponent H |r| yields a value of 0.89 6 0.090 for Market X and a value of Thereafter, the simulation run illustrated in Figures 1-8 imitates the behavior observed in real financial markets remarkably well. In what follows, the robustness of these results is Note: The slope of the line relating log (F(n)) to log (n) is the estimated scaling exponent, n = {2 3 ,…,2 10 } Agent-based framework investigated by performing a thorough Monte Carlo analysis. The analysis relies on 1,000 simulation runs, each comprising 5,000 observations. All simulation runs are executed with the parameter setting offered in Table I using different seeds of the random variables. Table II reports estimates of the mean and median of the mean, maximum, minimum, standard deviation, skewness and kurtosis for the two markets. Estimates of the mean and the median of the kurtosis for the two return series are all greater than 3, indicating leptokurtosis. Table III illustrates estimates of the mean and the median of the Hill tail index estimatorŝ a k for k [ {2.5, 5, 10} {2.5, 5, 10} per cent of the smallest (left tail) and largest (right tail) returns for the two assets. For example, considering the smallest (largest) 5 per cent of observations of r X , estimate of the tail index displays a value of 3.63 (3.09) for the median. The results show that the average Hill tail index estimates of the largest and smallest 10 per cent observations are in good agreement with the universal cubic law (see (21)). {1, 20, 50,100}. Estimates of the median of autocorrelation coefficients AC ' r indicate that price changes are mainly uncorrelated. For instance, the estimate of the median of autocorrelation coefficients AC 1 r reveals a value of 0.03 for r X and a value of 0.03 for r Z . This is in line with most real financial markets, where asset price evolves according to a random walk. Estimate of the median of autocorrelation coefficients AC 1 jrj reveals a value of 0.28 for r X and a value of 0.28 for r Z , indicating persistence in volatility.
Finally, the robustness of the scaling behavior and fractal structure is needed to be checked. Table V displays the estimates of the mean and the median for the scaling exponent of raw returns, H r , and the scaling exponent of absolute returns, H |r| . Estimate of the median of H r reveals a value of 0.50 for r X and a value of 0.49 for r Z . These figures indicate a small degree for predicting asset returns. Furthermore, estimate of the median of H |r| reveals a value of 0.79 for r X and a value of 0.78 for r Z . These values display long-range power-law autocorrelations in absolute returns.
Summing up, the model replicates the stylized facts of real financial markets remarkably well. Thereafter, the model can serve as a testbed to examine the effect of levying transaction taxes on the agents' switching behavior. For this purpose, two scenarios are to be investigated. First, the impact of imposing taxes in one market only. Second, the impact of imposing taxes in the two markets. The results of these scenarios are illustrated in the following section.

The dynamics with transaction taxes 4.1 Transaction taxes in one market
To explore the impact of imposing transaction taxes in one market only, a transaction tax of 0.25 per cent is imposed in one market, e.g. Market X (as the two markets are assumed to be symmetric, the results would not be changed if Market Z is selected). Figure 9 displays a simulation run using the same random seeds for the simulation presented in Figures 1-8. The simulation is executed based on the parameter setting presented in Table I, except for tax X = 0.0025. Thereafter, differences in the dynamics are merely due to taxation. Figure 9 can be compared directly with Figures 1, 2 and the first panel in Figure 3. The first two panels in Figure 9 show evolution of the log prices. Price bubbles and market crashes can be observed. Moreover, prices oscillate around their fundamentals. The third and fourth panels in Figure 9 show asset returns. The return series exhibit excess volatility and clustered volatility as observed in real financial markets. The last panel in Figure 9 illustrates the weights of the five trading strategies. No trading strategy dominates the others. Surprisingly, the average weights are computed as 20, 25.6, 19.2, 20.4 and 14.8 per cent for w Xc t , w Xf t , w 0 t , w Zf t and w Zc t , respectively. Additionally, the computed average volatilities are 1.35 and 1.07 per cent for vol X and vol Z , respectively, and the computed average market distortions are 11.49 and 8.54 per cent for dist X and dist Z , respectively. These are the same Notes: The first two panels show evolution of log prices in markets X and Z, respectively. The third and fourth panels display asset returns of markets X and Z, respectively. The last panel illustrates, from top to bottom, chartists in market X (black), fundamentalists in market X (white), no trading (grey), fundamentalists in market Z (white), and chartists in market Z (black) figures obtained from the simulation run presented in Figures 1-8. Thereafter, levying taxes in one market does not affect market dynamics in both markets.
To check the robustness of these results, a comprehensive Monte Carlo analysis is applied. The analysis relies on 1,000 simulation runs for each tax rate, which is increased from 0.05 to 0.5 in 20 steps. Each simulation is comprised of 5,000 observations. All simulation runs are executed based on the parameter setting offered in Table I using different seeds of the random variables. Figure 10 depicts the results of the Monte Carlo simulation for the first scenario. Figure 10 displays the average volatility for both markets, average price distortion for both markets and average weights of the five trading strategies. The first panel in Figure 10 depicts that volatility of both markets fluctuate around 1.18 per cent. Which tax rate would stabilize the markets? There is no specific tax rate that would decrease volatility in both markets at the same period. However, there is no tax rate that cause drastic increase in market volatility. The same result is observed from the second panel in Figure 10. No significant deviation in market  Agent-based framework distortion can be noticed. The last panel in Figure 10 indicate the weights of trading strategies, which are around 46, 34 and 20 per cent for fundamentalists, chartists and inactive traders, respectively, in both markets. In addition, chartists and fundamentalists are almost equally participated in both markets. Thereby, imposing transaction taxes in one market may not affect market stability or price distortion. Moreover, there is no strong evidence that traders would prefer trading in the market without transaction taxes. The traders also prefer fundamental trading over technical trading. However, this is the same result obtained from the model without introducing transaction taxes.

Transaction taxes in both markets
To explore the impact of imposing transaction taxes in the two markets, a transaction tax of 0.25 per cent is imposed in both markets. Figure 11 displays a simulation run based on the same random seeds of the simulation run depicted in Figures 1-8 using the parameter setting presented in Table I, except for tax X = 0.0025 and tax Z = 0.0025. Thereby, differences in the dynamics are only due to taxation. Figure 11 can be compared directly with Figures 1, 2 and the first panel in Figure 3. The first two panels in Figure 11 depict log-price evolution. The prices oscillate around their fundamentals and resemble the behavior of asset prices observed empirically. The third and fourth panels in Figure 11 illustrate asset returns, which exhibit excess volatility and volatility clustering as observed in real financial markets. The last panel in Figure 11 illustrates the weights of the five trading strategies. Amazingly, the average weights are computed as 20, 25.6, 19.2, 20.4 and 14.8 per cent for w Xc t , w Xf t , w 0 t , w Zf t , and w Zc t , respectively. Additionally, the computed average volatilities are 1.35 and 1.07 per cent for vol X and vol Z , respectively. The computed average market distortions are 11.49 and 8.54 per cent for dist X and dist Z , respectively. These are the same figures obtained from the simulation run presented in Figures 1-9. Thereafter, levying taxes in the two interacting markets does not affect market dynamics in both markets.
The robustness of these results is checked by applying a thorough Monte Carlo analysis. The analysis relies on 1,000 simulation runs for each tax rate, which is increased from 0.05 to 0.5 in 20 steps. Each simulation is comprised of 5,000 observations. All simulation runs are executed based on the parameter setting offered in Table I using different random seeds. Figure 12 depicts the results of the Monte Carlo simulation for the second scenario. Figure 12 shows average volatility for both markets, average price distortion for both markets and average weights of the five trading strategies. The first panel in Figure 12 depicts that volatility of both markets fluctuate around 1.18 per cent. In addition, different values of tax rates have slight effect on market volatilities in either direction. The same result is obtained for price distortions. No significant deviation in market distortion can be noticed from the second panel in Figure 12. As indicated by the last panel in Figure 12, the weights of trading strategies are around 46, 34 and 20 per cent for fundamentalists, chartists and inactive traders, respectively, in both markets. Furthermore, chartists and fundamentalists are almost equally participated in the two markets. Thus, imposing transaction taxes in two interacting markets may not cause instability or price distortion in both markets. Moreover, the traders prefer fundamental trading over technical trading. Nevertheless, this is the same result obtained in the artificial markets with zero taxes and with a levy in one market only.
It should be noted that the key difference between the proposed model and the model provided by Westerhoff and Dieci (2006) is the loss-aversion behavioral bias. Westerhoff and Dieci (2006) find that imposing Tobin taxes in one market will result in stabilizing this market at the cost of the other market's stability. Additionally, levying Tobin taxes in the two markets decreases volatility and distortion in both markets. The above authors report the average weight of 38, 45 and 17 per cent for fundamentalists, chartists and inactive traders, respectively. Note that the REPS 5,2 Figure 11. The impact of levying a transaction tax of 0.25 per cent in markets X and Z on both markets' log prices, asset returns and the weights of trading strategies Notes: The first two panels show evolution of log prices in markets X and Z, respectively. The third and fourth panels display asset returns of markets X and Z, respectively. The last panel illustrates, from top to bottom, chartists in market X (black), fundamentalists in market X (white), no trading (grey), fundamentalists in market Z (white), and chartists in market Z (black) main assumptions and parameter values followed in this research are similar to those of Westerhoff and Dieci (2006), except for the loss-aversion behavior. Thereby, the difference in results can mainly be attributed to loss-aversion behavior, which stabilizes the market by managing the speculative behavior. Additionally, governments could levy small transaction taxes to generate extra revenues without worrying about market stability.

Conclusions
In this paper, a behavioral agent-based model is proposed to provide a suitable testbed for policy makers. The proposed framework models the interaction between two different financial markets; Market X and Market Z. There are two types of agents populating the artificial markets; traders and market makers. Each time step, traders decide on one of the trading strategies: Figure 12.
The impact of imposing taxes in markets X and Z on the dynamics of the two markets The weight of each trading strategy is determined according to past and current performance of this strategy. As chartists are loss-averse, losses loom larger than equivalent gains. The discrete-choice model is followed to compute the weights of trading strategies. Market makers update asset prices according to the net submitted orders. A log-linear price impact function is followed to settle asset prices. The proposed model can replicate stylized facts observed empirically such as bubbles and crashes, excess volatility, volatility clustering, absence of autocorrelation in raw returns, persistence in volatility, power-law tails and fractal structures. Thereby, the model can be used as a test-bed to investigate the effect of applying regulatory policies. Furthermore, loss-aversion behavioral bias affects agent switching behavior among trading strategies, which consequently enhances market stability. This can be explained as follows. The increase in price distortion causes the chartists to become aggressive. The increasing switching behavior to technical strategy will increase market volatility. As the distortion approaches its maximum value, traders perceive fundamental analysis as the most appealing strategy to follow. The increasing switch to the fundamental analysis will drag asset prices to their fundamentals and reduce market volatility and price distortion. Tobin transaction tax is introduced and its impact on market dynamics is explored. For this purpose, two scenarios are considered: (1) levying a transaction tax in one market only; and (2) levying transaction taxes in the two markets.
The results show that imposing transaction taxes in either scenario would affect weights of trading strategies, distortion or volatility. As loss aversion manages the speculative behavior, imposing transaction taxes in markets populated with loss-averse chartists may not affect market stability and price distortions. Thereafter, imposing small transaction taxes would generate revenues and may not affect market dynamics. The results are in good agreement with Tobin's suggestions.