Understanding the dynamics of stock prices is a significant challenge, approached through random walk models, agent-based models, and technical analysis. This paper leverages fuzzy systems theory to transform technical trading rules into excess demand functions, driving price dynamics.
-
Fuzzy Systems Theory : Used to model technical trading rules expressed in natural language.
-
Excess Demand Functions : Derived from fuzzy systems to drive stock price dynamics.
-
Price Dynamics : Explores how various technical trading heuristics create complex and chaotic price movements.
The general form of the price dynamics model is given by:
-
Buy Signal : When a shorter moving average crosses a longer moving average from below.
-
Sell Signal : When a shorter moving average crosses a longer moving average from above.
-
Fuzzy Sets : Define linguistic terms like "Positive Small (PS)," "Positive Medium (PM)," etc.
-
Fuzzy IF-THEN Rules : Transform trading heuristics into fuzzy rules:
-
Rule 1: IF
$$\Delta MA$$ is PS, THEN demand is Buy Small (BS). -
Rule 2: IF
$$\Delta MA$$ is PM, THEN demand is Buy Big (BB). -
Rule 3: IF
$$\Delta MA$$ is PL, THEN demand is Sell Medium (SM). -
Rule 4: IF
$$\Delta MA$$ is NS, THEN demand is Sell Small (SS). -
Rule 5: IF
$$\Delta MA$$ is NM, THEN demand is Sell Big (SB). -
Rule 6: IF
$$\Delta MA$$ is NL, THEN demand is Buy Medium (BM). -
Rule 7: IF
$$\Delta MA$$ is AZ, THEN demand is Neutral (N).
-
The fuzzy system combining the rules is given by:
The price dynamic equation incorporating the moving average rules is:
-
Buy Signal : When the current price breaks above a resistance point.
-
Sell Signal : When the current price breaks below a support point.
-
Resistance Point
$$R_t$$ : Highest peak in the interval$$[t-n, t-1]$$ . -
Support Point
$$S_t$$ : Lowest trough in the interval$$[t-n, t-1]$$ .
-
Fuzzy Sets : Define terms for price changes relative to support and resistance points.
-
Fuzzy IF-THEN Rules :
-
Rule 1: IF
$$\Delta R$$ is PS, THEN demand is Buy Small (BS). -
Rule 2: IF
$$\Delta R$$ is PM, THEN demand is Buy Big (BB). -
Rule 3: IF
$$\Delta R$$ is PL, THEN demand is Sell Medium (SM). -
Rule 4: IF
$$\Delta S$$ is NS, THEN demand is Sell Small (SS). -
Rule 5: IF
$$\Delta S$$ is NM, THEN demand is Sell Big (SB). -
Rule 6: IF
$$\Delta S$$ is NL, THEN demand is Buy Medium (BM).
-
The fuzzy system for support and resistance rules is:
The price dynamic equation incorporating support and resistance rules is:
-
Uptrend Line : Buy if the price approaches from above.
-
Downtrend Line : Sell if the price approaches from below.
-
Uptrend Line
$$U_t$$ : Line connecting two lowest troughs. -
Downtrend Line
$$D_t$$ : Line connecting two highest peaks.
-
Fuzzy Sets : Define terms for price relative to trend lines.
-
Fuzzy IF-THEN Rules :
-
Rule 1: IF
$$\Delta U$$ is PS, THEN demand is Buy Medium (BM). -
Rule 2: IF
$$\Delta D$$ is NS, THEN demand is Sell Medium (SM).
-
The fuzzy system for trend line rules is:
The price dynamic equation incorporating trend line rules is:
-
Big Sellers : Sell if the price is increasing.
-
Big Buyers : Buy if the price is decreasing.
-
Manipulators : Use strategies like pump-and-dump.
-
Fuzzy Sets : For price changes and trading actions.
-
Fuzzy IF-THEN Rules :
-
Big Seller Rules:
-
Rule 1: IF
$$\Delta P$$ is PS, THEN demand is Sell Small (SS). -
Rule 2: IF
$$\Delta P$$ is PM, THEN demand is Sell Medium (SM). -
Rule 3: IF
$$\Delta P$$ is PL, THEN demand is Sell Big (SB). -
Rule 4: IF
$$\Delta P$$ is AZ, THEN demand is Neutral (N).
-
-
Big Buyer Rules:
-
Rule 1: IF
$$\Delta P$$ is NS, THEN demand is Buy Small (BS). -
Rule 2: IF
$$\Delta P$$ is NM, THEN demand is Buy Medium (BM). -
Rule 3: IF
$$\Delta P$$ is NL, THEN demand is Buy Big (BB). -
Rule 4: IF
$$\Delta P$$ is AZ, THEN demand is Neutral (N).
-
-
The fuzzy systems for big buyers and sellers are:
The price dynamic equations incorporating big buyers and sellers are:
-
Bands : Buy or sell when the price breaks out of the band.
-
Stops : Use protective and trailing stops to manage risk.
-
Bollinger Bands : Upper and lower boundaries around a moving average.
-
Protective Stop : Set limits to maximum losses.
-
Trailing Stop : Protect profits from deteriorating.
-
Fuzzy Sets : Define terms for price relative to bands and stops.
-
Fuzzy IF-THEN Rules :
-
Band Rules:
-
Rule 1: IF
$$\Delta B$$ is PS, THEN demand is Buy Small (BS). -
Rule 2: IF
$$\Delta B$$ is PM, THEN demand is Buy Big (BB). -
Rule 3: IF
$$\Delta B$$ is NS, THEN demand is Sell Small (SS). -
Rule 4: IF
$$\Delta B$$ is NM, THEN demand is Sell Big (SB).
-
-
Stop Rules:
-
Rule 1: IF
$$\Delta P$$ is NL and$$\Delta P_{\text{max}}$$ is NL, THEN demand is Sell Big (SB). -
Rule 2: IF
$$\Delta P$$ is P and$$\Delta P_{\text{max}}$$ is NL, THEN demand is Sell Big (SB).
-
-
The fuzzy systems for bands and stops are:
The price dynamic equations incorporating band and stop rules are:
-
Volume : Consider on-balance volume trends for trading decisions.
-
Relative Strength : Compare stock performance to the market.
-
On-Balance Volume (OBV) : Accumulated volume indicator.
-
Relative Strength (RS) : Ratio of stock performance to market index.
-
Fuzzy Sets : For volume and strength indicators.
-
Fuzzy IF-THEN Rules :
-
Volume Rules:
-
Rule 1: IF
$$\Delta P$$ is NS and$$\Delta OBV$$ is N, THEN demand is Sell Medium (SM). -
Rule 2: IF
$$\Delta P$$ is PS and$$\Delta OBV$$ is P, THEN demand is Buy Medium (BM).
-
-
Strength Rules:
-
Rule 1: IF
$$\Delta P$$ is NS and$$\Delta RS$$ is N, THEN demand is Sell Medium (SM). -
Rule 2: IF
$$\Delta P$$ is PS and$$\Delta RS$$ is P, THEN demand is Buy Medium (BM).
-
-
The fuzzy systems for volume and strength are:
Due to the lack of volume data, simulations for Rule 11 were not performed. For real stocks, these rules can be incorporated into the price dynamic model to study their effects.
The paper builds a bridge between technical analysis and nonlinear dynamic equations through fuzzy systems theory. The resulting models demonstrate complex price dynamics driven by technical trading rules. Future work includes detailed analysis and trading strategy development based on these models.
These models provide a framework to detect hidden market operations and develop trading strategies to outperform the benchmark Buy-and-Hold strategy. Future research will further analyze the properties of these models and test trading strategies in real market conditions.
Part II of the series extends the analysis of the price dynamical model based on moving average rules from Part I. This paper explores how the interplay between trend-following and contrarian actions generates price chaos. Key findings include the instability of all equilibrium points, short-term predictability of price volatility, and the derivation of the Lyapunov exponent. The study also examines return correlations and the fat-tailed distribution of returns.
-
Equilibrium : Infinite and unstable equilibriums in the price dynamical model.
-
Volatility : Fixed function of model parameters, revealing causes of phenomena like volatility clustering.
-
Return Predictability : Short-term predictability characterized by the Lyapunov exponent.
-
Return Independence : Analysis of return correlations changing from positive to negative.
The model is driven by Heuristic 1 (Rule-1-Group) from Part I:
The fuzzy system
The interplay between trend-followers and contrarians is analyzed by varying the strength parameter
-
Convergence : Small
$$a_1$$ leads to a convergent price series. -
Chaos : Intermediate
$$a_1$$ results in chaotic price behavior. -
Oscillation : Large
$$a_1$$ causes oscillatory price movements.
-
Figure 1 : Excess demand function
$$f(\Delta MA)$$ . -
Figure 2 : Price trajectories for different
$$a_1$$ values. -
Figure 3 : Parameter ranges for convergence, chaos, and oscillation.
An equilibrium point $$\mathbf{y}^$$ satisfies: $$\mathbf{y}_{t+1} = \mathbf{y}_t = \mathbf{y}^$$
-
Theorem 1 : Infinite equilibriums
$$\mathbf{y}^* = k \mathbf{1}$$ for any positive$$k$$ . -
Theorem 2 : All equilibriums are unstable.
-
Proof of Theorem 1 : Derived from the fixed points of the fuzzy system.
-
Proof of Theorem 2 : Using the Jacobian matrix and the Linearized Stability Theorem.
The instability of equilibriums suggests that the price series will not settle at a single point but may exhibit complex dynamics.
-
Chaos : Small changes in initial conditions lead to predictable short-term behavior.
-
Random : Immediate transition to steady-state behavior.
-
Figure 6 : Return trajectories for different initial volatilities.
-
Figure 7 : Corresponding volatilities.
Quantifies sensitivity to initial conditions:
-
Figure 8 : Volatilities plotted in log-t scale.
-
Figure 9 : Volatilities for different
$$a_1$$ values.
Approximate formula for Lyapunov exponent:
Volatility converges to a constant dependent on model parameters.
-
Figure 10 : Converged volatility as a function of
$$a_1$$ . -
Figure 11 : Converged volatility as a function of
$$w$$ .
Approximate formula for converged volatility:
Formula for volatility in oscillation mode:
-
Figure 12 : Drift for different
$$a_1$$ values. -
Figure 13 : Distance-to-uncorrelated as a function of
$$a_1$$ . -
Figure 14 : Distance-to-uncorrelated as a function of
$$w$$ .
Linear relation for uncorrelated returns:
-
Figure 15 : Auto-correlations for different
$$a_1$$ values.
- Figure 16 : Phase portrait of returns.
- Figure 17 : Return distribution compared to Gaussian.
The deterministic price dynamical models reveal insights into equilibrium, volatility, and return predictability in financial markets. The findings challenge classical concepts and suggest new stability definitions for social systems.
-
Equilibrium : Unstable equilibriums and set-stability.
-
Volatility : Deterministic function of model parameters.
-
Predictability : Short-term predictability defined by the Lyapunov exponent.
-
Return Correlation : Richer framework for analyzing return correlations compared to random walk models.
Part III of this study applies the price dynamical model with big buyers and big sellers, developed in Part I, to the daily closing prices of the top 20 banking and real estate stocks listed on the Hong Kong Stock Exchange. The study estimates the strength parameters of the big buyers and sellers to devise buy/sell decisions, proposing two trading strategies: Follow-the-Big-Buyer (FollowBB) and Ride-the-Mood (RideMood). The results demonstrate significant improvements over the benchmark Buy-and-Hold strategy.
-
Big Buyers and Sellers : Institutional investors who buy or sell stocks in large quantities.
-
Trading Strategies : Methods to leverage the estimated strength parameters of big buyers and sellers for profitable trading.
Using fuzzy systems theory, the Big Buyer and Big Seller Heuristics are transformed into a price dynamical model:
-
$$P_t$$ is the price of the stock at time$$t$$ . -
$$D_6$$ and$$D_7$$ are the excess demand functions for big sellers and big buyers, respectively. -
$$\alpha$$ is the price impact factor.
The excess demand functions
-
Buy : When big buyer is detected (
$$D_7 > 0$$ ) and no big seller is detected ($$D_6 \leq 0$$ ). -
Sell : When the big buyer stops buying (
$$D_7 \leq 0$$ ).
-
Buy : When the strength of big buyers surpasses that of big sellers (
$$D_7 - D_6 > 0$$ ). -
Sell : When the strength of big sellers surpasses that of big buyers (
$$D_7 - D_6 \leq 0$$ ).
To estimate the strength parameters of big buyers and sellers, the Recursive Least Squares Algorithm with Exponential Forgetting is used: $$\hat{\theta}_{t+1} = \hat{\theta}_t + K_t (y_t - \phi_t^T \hat{\theta}t)$$ $$K_t = \frac{P_t \phi_t}{\lambda + \phi_t^T P_t \phi_t}$$ $$P{t+1} = \frac{1}{\lambda} (P_t - K_t \phi_t^T P_t)$$ where:
-
$$\hat{\theta}_t$$ are the parameter estimates. -
$$y_t$$ is the observed data. -
$$\phi_t$$ is the regressor vector. -
$$\lambda$$ is the forgetting factor.
Simulations demonstrate the effectiveness of the parameter estimation algorithm under various noise conditions, indicating its robustness in detecting the strength of big buyers and sellers.
-
Algorithm :
-
Detect big buyers.
-
Buy when
$$D_7 > 0$$ and$$D_6 \leq 0$$ . -
Sell when
$$D_7 \leq 0$$ .
-
-
Algorithm :
-
Compare the strength of big buyers and sellers.
-
Buy when
$$D_7 - D_6 > 0$$ . -
Sell when
$$D_7 - D_6 \leq 0$$ .
-
- Algorithm :
-
Buy when a shorter moving average crosses a longer moving average from below.
-
Sell when the shorter moving average crosses the longer moving average from above.
-
- Algorithm :
-
Buy the stock on the first day.
-
Hold the stock until the last day.
-
The four trading strategies were applied to the top 20 banking and real estate stocks listed on the Hong Kong Stock Exchange over a seven-year period from July 3, 2007, to July 2, 2014. The daily closing prices were used for analysis.
The performance of each strategy was evaluated based on annual returns, standard deviations, and Sharpe ratios. The FollowBB and RideMood strategies significantly outperformed the Buy&Hold and TrendFL strategies.
A simple portfolio scheme was used, distributing initial money across the 20 stocks according to their weights in the Hang Seng Index (HSI). The trading strategies were applied independently to each stock.
The FollowBB and RideMood strategies showed superior performance compared to the TrendFL and Buy&Hold strategies. The portfolio with the RideMood strategy had the best overall performance, followed by FollowBB.
Detailed analysis of the buy/sell points for the FollowBB and RideMood strategies over a three-year period from January 3, 2011, to December 31, 2013, revealed that these strategies could effectively detect major trends and avoid significant losses.
-
Strengths : Major up-trends were detected and followed, leading to significant profits.
-
Weaknesses : Some negative return buy/sell cycles were observed, indicating areas for improvement.
The study demonstrates the effectiveness of the FollowBB and RideMood strategies in leveraging the strength of big buyers and sellers for profitable trading. These strategies outperformed traditional Buy&Hold and TrendFL strategies, providing a robust framework for trading in stock markets.
-
Profitability : FollowBB and RideMood strategies significantly increase net profits compared to Buy&Hold.
-
Risk Management : These strategies also reduce risk by avoiding major down-trends.
-
Market Conditions : The Hong Kong stock market provided a suitable environment for testing these strategies, given its characteristics and the presence of "hot money".
The Recursive Least Squares (RLS) algorithm is a well-established method in the field of system identification and control theory. It is particularly valued for its ability to recursively update parameter estimates as new data becomes available, making it suitable for online estimation in dynamic systems. The algorithm's foundational equations are: $$\hat{\theta}_{t+1} = \hat{\theta}_t + K_t (y_t - \phi_t^T \hat{\theta}t)$$ $$K_t = \frac{P_t \phi_t}{\lambda + \phi_t^T P_t \phi_t}$$ $$P{t+1} = \frac{1}{\lambda} (P_t - K_t \phi_t^T P_t)$$ where:
-
$$\hat{\theta}_t$$ are the parameter estimates at time$$t$$ . -
$$y_t$$ is the observed data (output). -
$$\phi_t$$ is the regressor vector (input). -
$$K_t$$ is the gain matrix. -
$$P_t$$ is the error covariance matrix. -
$$\lambda$$ is the forgetting factor.
These equations ensure that the algorithm adjusts the parameter estimates to minimize the weighted sum of squared prediction errors, with a preference for recent data due to the forgetting factor.
-
Adaptability : The RLS algorithm's ability to update estimates in real-time makes it particularly suitable for financial markets, where conditions can change rapidly. This adaptability allows the model to remain relevant even as market dynamics evolve.
-
Efficiency : Given that financial markets produce large volumes of data, the recursive nature of the RLS algorithm offers computational efficiency. It avoids the need to process the entire data set repeatedly, which would be computationally prohibitive.
-
Robustness : The forgetting factor
$$\lambda$$ helps the model to give more weight to recent observations, which is critical in financial markets where older data may become less relevant over time.
The application of the RLS algorithm to estimate the strength parameters of big buyers and sellers in stock markets represents a significant contribution to the field of financial modeling. Specifically:
-
Dynamic Modeling : By incorporating RLS, the study presents a dynamic modeling approach that can adjust to the continuous flow of new data, thereby capturing the ever-changing behavior of institutional investors.
-
Detecting Market Movers : The ability to identify big buyers and sellers in real-time provides a strategic advantage. This detection mechanism can inform trading strategies that leverage the presence of these market movers, enhancing the potential for profitability.
-
Improved Trading Strategies : The study's trading strategies (Follow-the-Big-Buyer and Ride-the-Mood) based on RLS-derived parameters outperform traditional strategies like Buy-and-Hold and Trend-Following. This demonstrates the practical utility of the approach in real-world trading.
Despite its advantages, the RLS algorithm is not without limitations:
-
Sensitivity to Noise : Financial data is often noisy, and while RLS is robust, extreme market events (e.g., crashes or surges) can still lead to significant estimation errors.
-
Parameter Selection : The choice of the forgetting factor
$$\lambda$$ and the initial values for$$P_t$$ and$$\hat{\theta}_t$$ can significantly impact the performance of the algorithm. Improper selection can lead to suboptimal parameter estimates. -
Model Assumptions : The effectiveness of RLS relies on the underlying model being an adequate representation of the real system. If the model is misspecified, the parameter estimates and resulting trading decisions may be flawed.
The use of the Recursive Least Squares algorithm in the context of the study is scientifically sound and aligns well with the requirements of dynamic financial modeling. The approach leverages the algorithm's strengths in real-time adaptability, computational efficiency, and robustness to provide valuable insights and improved trading strategies. The research contributes meaningfully to the understanding of market dynamics and the development of effective trading strategies, though attention must be paid to the choice of algorithm parameters and the potential impact of noise in financial data.
The Follow-the-Big-Buyer (FollowBB) strategy is designed to capitalize on the presence of large institutional investors—referred to as "big buyers"—who significantly influence stock prices due to their substantial buying power. The strategy operates based on the following rules:
-
Buy : Initiate a buy position when the strength of big buyers (
$$D_7$$ ) is positive and the strength of big sellers ($$D_6$$ ) is zero or negative. -
Hold : Maintain the position as long as the big buyers are actively purchasing (
$$D_7 > 0$$ ). -
Sell : Liquidate the position when the big buyers cease their activity (
$$D_7 \leq 0$$ ).
The strategy's scientific basis lies in the hypothesis that institutional investors have the power to drive stock prices due to their large trade volumes. By identifying and following these big buyers, smaller investors can potentially ride the price momentum generated by these large trades.
-
Market Influence : Institutional investors significantly influence stock prices.
-
Detectability : The activity of big buyers can be detected through price dynamics and excess demand functions derived from the Recursive Least Squares (RLS) algorithm.
-
Persistence : Once detected, big buyers will continue to influence the stock price in the same direction for a sufficient period to allow profitable trading.
-
Alignment with Market Movers : By focusing on the actions of big buyers, the strategy aligns with market forces that have a tangible impact on stock prices, increasing the potential for profitable trades.
-
Data-Driven Decisions : The use of RLS for parameter estimation provides a robust and adaptive mechanism to detect big buyers in real-time, ensuring the strategy remains responsive to market changes.
-
Reduced Risk : The strategy includes clear sell signals to exit positions when the big buyers are no longer active, helping to manage and mitigate risk.
Historical Performance
The strategy was tested on the top 20 banking and real estate stocks listed on the Hong Kong Stock Exchange over a seven-year period from July 3, 2007, to July 2, 2014. The evaluation criteria included annual returns, standard deviations, and Sharpe ratios.
-
Annual Returns : FollowBB consistently delivered higher annual returns compared to the Buy-and-Hold and Trend-Following strategies. For example, HSBC Holdings (HK0005) showed a 4.78% return with FollowBB compared to -1.82% with Buy-and-Hold.
-
Standard Deviation : The strategy demonstrated a manageable level of risk, with standard deviations comparable to or lower than other strategies.
-
Sharpe Ratio : FollowBB achieved higher Sharpe ratios, indicating better risk-adjusted returns.
Market Conditions
FollowBB performed well in various market conditions, including rising markets, declines, and periods of volatility. This robustness suggests that the strategy can adapt to different market environments, providing reliable signals across diverse scenarios.
-
Detection Lag : While RLS is efficient, there can be a lag in detecting big buyers, potentially leading to missed opportunities or late entries.
-
False Positives : In highly volatile markets, the algorithm may generate false signals, leading to unprofitable trades.
-
Dependency on Model Accuracy : The effectiveness of the strategy hinges on the accuracy of the RLS parameter estimates. Inaccurate estimates can undermine the strategy's performance.
The Follow-the-Big-Buyer (FollowBB) strategy presents a scientifically grounded approach to leveraging the influence of institutional investors in stock markets. By systematically identifying and following big buyers, the strategy aims to capture the price momentum created by these large trades, offering a higher potential for profit and better risk management compared to traditional strategies.
-
Effectiveness : The strategy has shown to outperform traditional Buy-and-Hold and Trend-Following strategies in historical tests, particularly in terms of annual returns and Sharpe ratios.
-
Adaptability : FollowBB adapts to changing market conditions through real-time parameter estimation, maintaining relevance and accuracy in various scenarios.
-
Risk Management : The strategy includes clear entry and exit rules based on the presence of big buyers, helping to manage and mitigate risk effectively.
Overall, FollowBB represents a valuable contribution to trading strategy development, providing a method to systematically exploit the market influence of institutional investors.
References: