It is generally considered difficult to forecast the behavior of stock prices, and thus many methods have been proposed. For example, fundamental analysis and technical analysis are widely used approaches. Fundamental analysis involves investigating any data that can be expected to impact the price of a stock. The advantage of this method is that the estimation is objective because the selected economic indicators such as future growth, return on equity, and profit margins are inputted into a particular relational expression to predict the stock price. However, because there is often a time lag prior to the release of economic indicators, one drawback of this approach is that the economic indicators may be outdated. In contrast, technical analysis focuses only on the trading and price history of a stock. The principle underlying technical analysis is that the market price reflects all available information that could affect the stock market. As a result, there is no need to take new economic developments into account because they are already priced into a given security. Technical analysts generally believe that prices move in trends, and that history tends to repeat itself. However, these trends may be a product of chance, and there may actually be a chance that large hill-like or valley-like fluctuations are also considered to be trends. It seems that the market fluctuates based on psychological aspects. There are two major types of technical analysis: chart patterns and technical indicators. Chart patterns are a subjective form of analysis wherein technicians attempt to identify areas of support and resistance on a chart by observing specific patterns. These patterns, identified based on experience and behavioral economics, are designed to predict where prices are headed following a breakout or breakdown from a specific price point. Technical indicators are a statistical form wherein technicians apply various mathematical formulas to prices and volumes. The most common technical indicators are moving averages, which smooth price data to make it easier to spot trends.
Difficulties arise in terms of predicting stock prices because daily changes in stock prices seem to be quite random. In particular, fluctuations in stock prices are considered to follow Brownian motion, fluctuating independently of past stock prices. The notion of using a Brownian motion process to explain the behavior of stock prices was first proposed by Black et al.  . A Brownian motion process has the property of independent increments. This means that the present price does not affect future prices. However, the present stock price may influence the stock price at some time in the future. Hence, a Brownian motion process is not suitable for explaining stock price movements. Subsequently, a fractional Brownian motion process, which exhibits the property of long-range dependence, was proposed  . Meanwhile, it is also considered that there is a relationship between stock price and volume   . Volume is an important aspect of technical analysis because it is used to confirm trends and chart patterns. Any price motion up or down with relatively high volume is seen as a stronger, more relevant move than a similar move with weak volume. Data that are available to general investors include time series of stock prices and volumes. As pointed out in the past, the trend of the stock price itself is random  , and using this data alone, it is completely unpredictable how the price will change in the near future. However, since volume is a measure of how much interest sellers and buyers have in the stock, volume data provide a better understanding of stock price fluctuations.
There is already a famous stochastic differential equation that attempts to mathematically elucidate the transition of one bond and one or more stock prices  , but the purpose of this study is to reveal the driving force behind sustainable fluctuations in the price of an arbitrary stock using a mathematical model. The rest of this paper is organized as follows. Sections 2 and 3 clarify the relationship between stock prices and volumes, Section 4 presents a model of the proposed relationship, Sections 5 and 6 present an interpretation of the simulation, and Section 7 discusses the effectiveness of the model by comparing the results of the simulation with real data.
2. Characteristics of the Real Data
It is possible to obtain time-series data (e.g., closing prices and volumes) in relation to stock prices for free via the Internet. Although it is acceptable to use data from any source, because the author lives in Japan, data for 50 stocks on the First Section of the Tokyo Stock Exchange were used. It is considered that the results will not lose generality outside Japan.
As an example, time-series data on the stock price of the Takeda Pharmaceutical Company Limited, one of the leading pharmaceutical companies in Japan, was examined.
Figure 1(a) shows the fluctuations in closing prices (abbreviated to prices hereafter) (pi; i = 1, 2, …, 9012) from 4 January 1983 to 20 March 2019. Figure 1(b) shows the difference, Dpi, between pi+1 and pi (i = 1, 2, …, 9011). Figure 1(c) shows the fluctuations in volume (vi; i = 1, 2, …, 9012). Figure 1(d) shows that the difference, Dvi, between vi+1 and vi (i = 1, 2, …, 9011) appears to be fluctuating periodically. Figure 1(e) shows the fluctuations in Dpi/loge(vi) (i = 1, 2, …, 9011). Since this is an indicator of how much the volume affects the change in stock prices compared with the previous day, I have introduced it anew. If Dpi is ³ 0, Bpi is represented as 1 (i = 1, 2, …, 9011), otherwise Bpi is represented as –1. Figure 1(f) shows the fluctuations in Bpi (i = 1, 2, …, 9011). Bpi indicates whether the price is rising or falling. The frequency of Bpi = 1 is 0.5461. If Dvi is ³ 0, Bvi is represented as 1 (i = 1, 2, …, 9011), otherwise Bvi is represented as –1. Bvi indicates whether the volume is rising or falling. The frequency of Bvi = 1 is 0.4924. Figure 1(g) shows the fluctuations in Bvi (i = 1, 2, …, 9011). From the frequency analysis of Dpi and Dvi, it can be seen that the power of Dpi is almost 0 compared with the power of Dvi, and Dpi has no characteristic period, but Dvi has a period of one to three days (see Figure 2). Figure 3 shows the autocorrelation function of pi, Rpp(τ) (=E[pi·pi+τ]), the autocorrelation function of vi, Rvv(τ) (=E[vi·vi+τ]), and the cross-correlation function, Rpv(τ) (=E[pi·vi+τ]), where τ represents the time lag in days. Although Rpp(τ) and Rpv(τ) are very small compared with Rvv(τ), and are almost zero, Figure 3 indicates that there is a significant correlation between vi and vi+1. The moving averages are computed: Mpi, the mean with a window of length 101 that includes the element in the current position, pi, and 100 elements backward, and Mvi, the mean with a window of length 101 that includes the element in the current position, vi, and 100 elements backward. These are then converted to logarithms: LMpi = loge(Mpi) and LMvi = loge(Mvi). Figure 4 shows the relationship between LMvi and LMpi. The relationship is significant, with a correlation coefficient of 0.7312 (at the 0.05 significance level).
Figure 1. (a) Stock prices (pi; i =1, 2, …, 9012) from 4 January 4 1983 to 20 March 2019; (b) The difference, Dpi, between pi+1 and pi (i =1, 2, …, 9011); (c) Volumes (vi; i = 1, 2, …, 9012); (d) The difference, Dvi, between vi+1 and vi (i = 1, 2, …, 9011); (e) Dpi/loge(vi) (i = 1, 2, …, 9011). If Dpi is ≥ 0, Bpi is represented as 1 (i = 1, 2, …, 9011), otherwise Bpi is represented as –1; (f) Bpi (i = 1, 2, …, 9011). If Dvi is ≥0, Bvi is represented as 1 (i = 1, 2, …, 9011), otherwise Bvi is represented as –1; (g) Bvi (i = 1, 2, …, 9011). The red lines in (a)-(e) represent the moving averages.
Figure 2. Frequency analysis of Dpi and Dvi. The two arrows indicate that the power of Dpi is extremely small compared with the power of Dvi.
Figure 3. The autocorrelation function of pi, Rpp(τ) (=E[pi·pi+τ]) (yellow line), the autocorrelation function of vi, Rvv(τ) (=E[vi·vi+τ]) (blue line), and the cross-correlation function, Rpv(τ) (=E[pi·vi+τ])(yellow line); t represents the time lag in days.
Figure 4. Plots of LMvi and LMpi. LMvi is the logarithm of moving averages of vi, while LMpi is the logarithm of moving averages of pi.
The following findings are based on the information presented in Figures 1-4.
1) Comparing Figure 1(a) and Figure 1(c), it can be seen that there are days when the volume has increased before a rise in the stock price, but it appears that the price is not always linked to a change in the volume.
2) Comparing Figure 1(b) and Figure 1(d), it can be seen that Dpi and Dvi appear to fluctuate independently. Close observation of the fluctuations in price and volume reveals that Dvi appears to change periodically. Figure 2 shows that Dvi has a period of one to three days. Figure 3 shows that the present price is not correlated with the past stock price, and the stock price is not correlated with the volume, although the present volume is related to the volume over several days, especially that of the previous day.
3) Figure 1(f) and Figure 1(g) show that Bpi and Bvi do not return to the origin again after having done so several times near the beginning (18 times for Dpi and 22 times for Dvi). It is understandable that a return to the origin is unlikely in the case of Brownian motion processes because of the arc sine law of last returns, but even if Bpi and Bvi follow a Brownian motion process, the number of returns to the origin is at most 22 and the probability of this occurrence is low (0.1820), as shown in the theorem presented in the Appendix. Therefore, neither Bpi nor Bvi may be considered to follow a Brownian motion process.
4) Figure 1(e) shows that, for example, even if Dpi rises by only a little, Dpi/loge(vi) will rise sharply when the volume is small. That is, Dpi/loge(vi) represents the degree of interest in the stock.
5) Since Figure 4 shows that LMpi and LMvi have a significant positive correlation, it follows that there is a positive correlation between the transition of prices and the transition of its volumes from the logarithm of moving average of 101 days in total.
The following points can be used to construct a mathematical model from the above findings.
a) From (2), fluctuations in price and volume seem to be random and independent, but Dvi appears to change periodically.
b) From (5), LMpi and LMvi have a significant positive correlation.
3. Behavioral Psychology of Investors Affecting Stock Prices
A high volume of turnover means that there are numerous buyers and sellers who are interested in the stock. It has become clear that the average price over the long term (101 days in the above example) is significantly correlated with the average volume during the same period. Therefore, it is essential to know the investors’ mindsets because the volume reflects the interest of buyers and sellers in the stock. Since Bvi indicates whether the volume is rising or falling, it reflects rising or falling interest on the part of buyers and sellers.
The prospect theory of behavioral finance suggests that investors who are overly preoccupied with the negative effects of losses in comparison to an equivalent amount of gains tend to take a short-term view of an investment  . This leads those investors to pay far too much attention to the short-term volatility of their stock portfolios. Thus, in general, investors tend to limit their losses by selling their stocks, being overly preoccupied with their latest losses, even though the price of their stock may have subsequently risen.
The gambler’s fallacy occurs when, during a series of coin tosses, the gambler thinks that a tail is due following a series of heads. This idea is often used in behavioral economics. In relation to investment, it is easy to become susceptible to the gambler’s fallacy. For example, when prices rise over several successive days, many investors will come to believe that, even if there is no rational reason to think so, they will soon fall again. They have various criteria that they use in their decision-making, and even if they are not actually selling, there is a significant possibility that this feeling will affect their judgment. Investors think that the stock price will go up as they go down on a daily basis, and if the stock is bought, it will often happen that the stock price will go down further and lose.
In summary, investors tend to sell in the short term to secure a slight profit because they dislike losses in accordance with the loss avoidance aspect of prospect theory. Meanwhile, they tend to think that prices that are continuing to rise should fall soon, based on the gambler’s fallacy. However, there is also a tendency to think that prices will continue to rise. Then, the buying and selling behavior will be repeated periodically to some extent. This summary can be used to construct a mathematical model based on the following conditions. There are random fluctuations in relation to stock prices, the number of buy orders, and the number of sell orders. In particular, the number of buy orders and the number of sell orders fluctuate periodically.
4. Mathematical Model
Stock prices, the number of buy orders, and the number of sell orders are represented by P, B, and S, respectively. Figure 5 shows the interactions among P, B, and S. The formulations of these relationships are as follows:
where a, b, c, r1, r2, r3, t1, t2, and f are positive constants. sign(x) is 1 if x > 0, 0 if x = 0, and –1 if x < 0. RND1, RND2, RND3, and RND4 are uniformly distributed random numbers in the interval (0, 1), each of which changes every time step on solving these differential equations by using ode45 of MATLABÒ. In equation (1), B – S represents the volume. If , prices are increasing, if , prices display no trend, and if , prices are decreasing. In Equations (1), (2), and (3), - r1·RND1·P, -B, and -S are necessary to prevent these variables from diverging to infinity. A preliminary study indicated that RND1, RND2, RND3, and RND4 are required for P, B, and S to fluctuate randomly in various changes, similar to real data. This finding suggests that continuous up-and-down changes are the result of the randomness of prices.
Figure 5. Relationships among prices, buy orders, and sell orders. Arrows represent promotion, while blocked arrows represent suppression. The red lines represent random noise. A wave in the circle between prices and buy orders (or sell orders) indicates that the effect of promoting or suppressing the buy orders (or sell orders) on the stock price changes periodically.
The parameters are set as follows: a = 0.2, b = 2, c = 1, r1 = 0.4, r2 = 2, r3 = 4, and f = 0.2.
5.1. t1 = 0, t2 = 0
Regardless of , there are a couple of significant rises in prices, as if there was a trend (see Figure 6). However, the prices do not increase constantly. It can be seen from Figure 6(f) and Figure 6(g) that the number of times Bpi and Bvi cross the origin is extremely small. Figure 7 shows the relationship between LMvi and LMpi. The relationship is significant with a correlation coefficient of 0.7452 (at the 0.05 significance level).
Figure 6. Plots of P (=pi), Dpi, V (=vi), Dvi, Dpi/loge(vi), Bpi, and Bvi, which are calculated at t1 = 0, t2 = 0. The red lines in (a)-(e) represent the moving averages.
Figure 7. Plots of LMvi and LMpi, which are calculated at t1 = 0, t2 = 0.
5.2. t1 = 0.001, 0.005, or 0.01, t2 = 0
As t2 = 0, . When 0.001 < t1 < 0.005, prices do not necessarily show an upward trend. When t1 = 0.01, prices show a constant upward trend (see Figure 8). Thus, Bpi and Bvi are constantly increasing. Figure 9 shows the relationship between LMpi and LMvi. The relationship is significant with a correlation coefficient of 0.8778 (at the 0.05 significance level). The correlation between price and volume is stronger for the condition t1 = 0.01, t2 = 0 than for the condition t1 = 0, t2 = 0.
5.3. t1 = 0.01; t2 = 0.25, 0.5, or 0.75
When t2 = 0.25, with probability of 0.75. When t2 = 0.5, with probability of 0.5. When t2 = 0.75, with probability of 0.25, in other words, with probability of 0.75. When t2 = 0.25, prices show an upward trend. When t2 = 0.5, price fluctuations show various patterns. When t2 = 0.75, prices are constantly decreasing (see Figure 10).
6. Mathematical Analysis
The parameters are the same as in Section 5.1, namely, a = 0.2, b = 2, c = 1, r1 = 0.4, r2 = 2, r3 = 4, f = 0.2, t1 = 0, and t2 = 0. Then the prices do not increase constantly, and are confined within a certain range. This can be confirmed by mathematical analysis as follows. The volume, B – S, is represented by V.
Figure 8. Plots of P (=pi), Dpi, V (=vi), Dvi, Dpi/loge(vi), Bpi, and Bvi, which are calculated at t1 = 0.01, t2 = 0. The red lines in (a)-(e) represent the moving averages.
Figure 9. Plots of LMvi and LMpi, which are calculated at t1 = 0.01, t2 = 0.
Figure 10. Plots of P and V, which are calculated at t1 = 0.01, t2 = 0.25, 0.5, or 0.75.
As t1 = 0, Equation (1) is expressed as follows.
Equation (2) minus Equation (3) is expressed as follows.
here are denoted as α, β, and γ, respectively. Since these parameters include random numbers or time variables, these parameters are considered below once as constants. Then Equations (4) and (5) are considered to be ordinary differential equations.
The characteristic polynomial of Equation (6) is given by
If . Then, one of the two eigenvalues is positive and the other is negative. Since α is distributed uniformly in (0, 0.4), .
If , one of the two eigenvalues is always positive.
As is , . Now, .
As RND2 and RND3 are distributed uniformly in (0, 1), the probability density function, f(β), of β (=RND2 - RND3) is expressed as shown in Figure 11. The probability of β < -1/4 is 9/32, and the probability of β > 1/4 is 9/32. The total time of is 50% in any observation time. Similarly, the total time of is 50% in any observation time. Hence, the total time of γ < -1/4 is at most 9/32 in any observation time. Conversely, if γ > 1/4, the two eigenvalues are always negative real numbers or complex numbers with negative real parts. In the same way as γ < -1/4, the total time of γ > 1/4 is at most 9/32 in any observation time. In the remaining time, when -1/4 < γ < 1/4, there are various combinations of the two eigenvalues: one positive and the other negative
Figure 11. Probability density function, f(β), of β (=RND2 - RND3). The area of each blue triangle is 9/32.
real numbers, two negative real numbers, and two complex numbers with negative real parts. In no cases do two positive real eigenvalues or two complex eigenvalues with positive real parts occur. P does not diverge to infinity or converge to zero because the two eigenvalues are not always positive real numbers (or complex numbers whose real parts are positive numbers) and not always negative real numbers. Hence, P fluctuates within a certain range.
In this study, the relationship between the price and trading volume of a stock is examined. Fluctuations in prices and volumes seem to be random and independent, but LMpi and LMvi have a significant positive correlation. In particular, Dvi appears to change periodically, based on frequency analysis. The present volume is related to the volume over the last few days, especially the previous day. A preliminary study indicated that RND1, RND2, RND3, and RND4 are required for P, B, and S to fluctuate daily in the same manner as real data. These findings suggest that fluctuations in stock prices are characterized by both randomness and periodicity. Although there is a tacit understanding that continual fluctuations in stock prices are the result of Brownian motion, Kong et al. reported the possibility that fractional Brownian motion is the driving force  . However, Brownian motion seems unlikely to be the only driving force based on the results for Bpi and Bvi obtained in Section 2. The prospect theory of behavioral finance suggests that investors who are overly preoccupied with the negative effects of losses tend to limit their losses by selling their stocks. Investors who have fallen into the gambler’s fallacy sell their stocks in the belief that prices are due to fall if they have been rising. However, when the stock price rises further, they then try to buy it back, thinking it will continue to rise. Thus, there is repeated buying and selling over a short period without sound underlying reasons. This is why stock prices include a periodic factor. Thus, the differential equations consist of a component for randomness, as well as one for periodicity (see Figure 5).
The prices of an arbitrary stock generally display up-and-down motions, but are generally confined within a certain range. Although technical analysts believe that prices generally move in trends and that history tends to repeat itself, the findings in Section 5.1 indicate that stock prices show large hill-like or valley-like fluctuations stochastically without any increasing or decreasing trend, and repeat themselves over a certain range. This seems to be natural at first glance, but the question arises as to what is the driving force.
From Section 5, it can be seen that the stock price increases almost monotonically if the change in the price of a certain stock is accompanied by an increasing trend without noise (as well as a decreasing trend). However, in reality, it seems that randomness mixes with this increasing or decreasing trend. Thus, stock prices can fluctuate unpredictably depending on the degree of this mixing, making it difficult to predict stock prices. From Section 5.2, it can be seen that if a noise-free increasing or decreasing trend is added to stock prices, LMpi and LMvi have a stronger positive correlation. Then, since the prices increase almost monotonically, they become predictable. In other words, if all of the information, including external factors, affecting stock prices is known, stock prices can be predicted. Otherwise, they are generally unpredictable.
The analysis of daily prices and volumes of a certain stock revealed the following findings: 1) price and volume fluctuations are random, 2) the difference between the volume on the previous day and that on the current day is periodic. Based on these findings, the differential equations of stock prices, the number of buy orders, and the number of sell orders were constructed. From simulation by these equations it is clear that both randomness and periodicity are essential for stock price fluctuations to be sustainable. In the future, I would like to clarify the conditions of the parameters in the mathematical model under which stock prices will continue to fluctuate within a certain range. This finding will reveal which parameters have a strong influence in order to make the stock price fluctuate continuously within the certain range.
We thank Geoff Whyte, MBA, from Edanz Group (www.edanzediting.com/ac) for editing a draft of this manuscript.
Theorem (normal approximation)
The length of paths is 2n. Suppose that n is large and α is a fixed positive number. The probability, f(α), that fewer than changes of sign occur tends to
 Kong, X., Jing, B. and Li, C. (2013) Is the Driving Force of a Continuous Process a Brownian Motion or Fractional Brownian Motion. Journal of Mathematical Finance, 3, 454-464.
 Chan, W.S. and Tse, Y.K. (1993) Price-volume Relation in Stocks: A Multiple Time Series Analysis on the Singapore Market. Asia Pacific Journal of Management, 10, 39-56.