A Fuzzy Logic Momentum Analysis System For Financial Brokerage
The modelling of financial systems continues to hold great interest for not only researchers but also investors and policymakers. Many of the characteristics of these systems, however, cannot be adequately captured by traditional financial modelling approaches. Financial systems are complex, nonlinear, dynamically changing systems in which it is often difficult to identify interdependent variables and their values. Financial brokerage is concerned with executing orders of buying and selling of certain amounts of shares at the best possible price. Many mathematical and algorithmic systems have been developed for this task, however they cannot seem to overcome a standard volume based system. This paper proposes a new framework for high frequency trading using an intelligent fuzzy logic based momentum analysis system. The system was applied to brokerage of financial stocks, and tested against the standard volume based brokerage system. The Fuzzy Logic Momentum Analysis System has proven to outperform the traditional and standard systems that are used in the industry.
Finacial brokerage; fuzzy logic; high frequency trading.
It is well known that a main inadequacy of much economic theory is that it postulates exact functional relationships between variables. On the other hand in financial time series analysis, data points rarely lie exactly on straight lines or smooth functions.  suggests that attempting to accommodate these nonlinear phenomena will introduce an unacceptable level of instability in models.
As a result of this intractability, researchers and investors are turning to artificial intelligence techniques to better inform their models, creating decision support systems that can help a human user better understand complex financial systems such as stock markets. Artificial intelligence systems in portfolio selection have been shown to have a performance edge over the human portfolio manager and recent research suggests that approaches that incorporate artificial intelligence techniques are also likely to outperform classical financial models .
Artificial intelligence approaches have recently been commonly adopted in financial modelling. Traditionally, stock market forecasting methodologies have been based on either fundamental or technical analysis. Fundamental analysis attempts to determine the intrinsic value of stocks based on extensive macroeconomic data, whereas technical analysis relies on studying market activity, particularly historic prices and volume. Whilst there is much supporting research for both strategies in financial theory we focus on systems using technical methodology as the subjective and complex nature of fundamental analysis means it has, to date, received little attention in artificial intelligence research.
Fuzzy logic was first introduced by . It is a form of multi-valued logic which, whilst retaining the deductive structure of classical symbolic logic, includes the concept of degree of truth. Rather than being either true or false, as in binary logic, statements in fuzzy logic have a membership function which defines a fuzzy set (as opposed to a crisp set in conventional set theory). Fuzzy logic is therefore an ideal approach to problems that require a representation that can deal with approximations, uncertainty and insufficient information and it has been applied to domains as diverse as pattern recognition , railway control systems  and computer game design . The rule base and inference engine of a fuzzy system is comparable to that of the knowledge base of an expert system. The application of fuzzy set theory in economics was first presented by  and has since received much attention 
Time series models were first combined with fuzzy theory by  giving rise to fuzzy time-series, the fundamental framework of all the investment systems. Researchers creating stock trading systems have implemented many variations of this model. Most recently,  has proposed the use of Adaptive Neuro Fuzzy Inference Systems (ANFIS), which combine the predictive properties of neural networks, with the reasoning mechanisms of fuzzy logic to create an automated trading and forecasting system that has been used for high frequency trading of foreign exchange currencies markets (FOREX).
This paper is outlined as follows. In section II we give a general overview about fuzzy logic inference systems. Section III introduces the fuzzy logic momentum analysis system (FL-MAS). Section IV explains the methodology of using FL-MAS for brokerage. Section V provides a performance analysis of the system. Finally, concluding remarks are given in Section VI.
II. Fuzzy inference Systems
Many types of fuzzy inference systems have been proposed in literature, however, in the implementation of an ANFIS for financial predictions and estimation, the most suitable model is the Sugeno model, which uses if-then-rules to produce an output for each rule which is the linear combination of the input variables plus a constant term, and the final output is the weighted average of each rule's output. The rule base in the Sugeno Model, has rules of the form:
If X is A1 and Y is B1 then f1 = p1* x + q1* y + r1
If X is A2 and Y is B2 then f2 = p2 * x + q2 * y + r2
where X & Y are predefined membership functions, Ai and Bi are membership values, and pi, qi, and ri are the consequent parameters that are updated in the forward pass in the learning algorithm. When we calculate the equation of "First order Sugeno" the degree of membership variable of X1 in membership function of Ai is multiplied by the degree of membership variable of X2 in membership function Bi and the product is deemed a first Liner Regression Weight (Wi). Finally the weighted average F1 and F2 is deemed the final output (Z) which is calculated as follows:
A fuzzy inference systems shown in 1 is a rule based fuzzy system that can be seen as an associative memory and is made of five components; rule base which consists of the fuzzy if-then rules, the data base which defines membership functions of the fuzzy sets used in the fuzzy rules, the decision making unit which is the core unit and is also known as the inference engine, the fuzzification interface which transforms crisp inputs into degrees of matching linguistic values, and finally the defuzzification interface which transforms fuzzy results into crisp output .
III. Fuzzy Logic Momentum Analysis System
Creating a fuzzy inference system to detect momentum is a complex task. The identification of various market conditions has been a topic subject to various theories  and suggestions. This paper proposes a fuzzy inference system which categorises the market conditions into 7 categories based on price movement, and will use the current volume to determine the participation rates (PR) of the trading system each time.
A. Momentum Analysis
The first step in designing the Fuzzy Logic Momentum Analysis System, FL-MAS, is defining the market conditions that the fuzzy system has to identify. In this paper we use the following 7 market conditions to cover all possible movements of the price series:
* Strong up
* Slightly up
* Slightly down
* Strong down
These conditions are considered as linguistic values for the fuzzy logic system, and will be used to determine the current state of the price formation and its momentum. As momentum is built up, the system looks at the previous x amount of ticks and performs an inference procedure by adding all the movements of the current price to the previous price to determine whether the general trend has been up or down after x points. In other words, momentum is detected by the following:
if Pi> Pi-1 then ki = 1
if Pi< Pi-1 then ki = -1
else ki = 0
where Pi is the current price, Pi-1 is the previous price, and ki is a fluctuating counter which goes up or down according to the movement of the price. whenever price goes up it adds 1, when the price goes down it subtracts 1, hence this can be used in identifying market conditions for x amount of points, where if the market is moving strongly upwards, it will be detected by having more ones than -1 or 0s. This can be explained in the following equation:
Momentum = i=1xki
where x is the period that we want to detect the momentum for. For example, if we want to detect the momentum of the last 100 ticks, we add all the up, down fluctuations and then feed the resulting number to the fuzzy system which would lie somewhere in the membership functions shown in 2.
The same procedure is applied for calculating the linguistic variable volatility, where the linguistic values are as follows:
* Very fast
* Very slow
The fuzzy logic system takes both market momentum and volatility in consideration; it generates the rules, and finally takes a decision based upon the amount of market participation.
B. The Data
Experiments in this paper have been carried out on high frequency tick-data of both Vodafone Group plc (VOD) and Nokia Corporation (NOK). For both stocks, 2 months of high frequency tick-data between 2nd Jan 2009 and 27th Feb 2009 has been obtained, and split into 30 sections each. This was done in order to avoid any auto correlation between the prices. In other words, the fuzzy logic system gets the first batch of data, performs all the actions of buys or sells on it, then the same is procedure repeated using the standard volume based system, finally comparing the performance of both systems. Once the observation is obtained, the system skips around 10000 ticks and performs the same operations again, for 30 times, each time noting the performance of both systems. It has to be mentioned that 2 months of high frequency tick data is a significantly large amount of data, taking in consideration that for each iteration the system takes the analysis of the momentum of the past 100 ticks. 3 shows how the data is split after each simulation in order to avoid any possible similarities or autocorrelation in the price.
IV. FL-MAS for brokerage
The main objective of the Fuzzy Logic Momentum Analysis System (FL-MAS) implemented in this paper is to outperform the industry standard volume system, that has been used by brokerage firms to execute large orders of buying or selling a certain stock. Many systems have used quantum modelling and analysis to determine the various participation rates (PR), however they usually fail to outperform the standard volume system in the long term . This paper uses FL-MAS presented in section 3, to determine the PR in the market according to the current momentum. In other words, if we are on a buy order, we would prefer to increase the PR (number of shares bought at that time), when the price is low, and decrease the participation when the price is high.
A. Standard Volume System (SVS)
A standard brokerage mechanism for executing large orders is a simple volume based system, which parses the volume being traded, whenever a certain amount of shares (a threshold) have been traded, the system would buy or sell (depending on the order) a certain percentage of that. In other words, if there is an order to trade 1 million shares of a certain stock. The threshold would be for e.g. 10,000 shares, and whenever 10,000 shares have been traded, if the PR is set to 25%, the system would buy or sell 25% of the average volume.
if sum(volume)> Threshold
amount of shares = ( % * Volumei)
Total SVS Cost = i=1nPricei*( amount of sharesi )
where n is the number of operations required to reach the target order for example 1 million shares, % is a fixed PR, for example, 25% whenever the threshold is exceeded. The above system has proved to be efficient and is being adopted by many brokerage firms around the world. The aim of this paper, is to prove that FL-MAS outperforms this type of system on the long run.
The idea here is to use the fuzzy logic momentum analysis system described in section 3, to identify what market condition we are currently residing in. This will allow us to vary the PR (%). This provides an advantage, since the system can trade aggressively when the condition is at an extreme. It would also minimise its trading when the condition is at another extreme. In other words, if we are selling million shares, the system will make a trade whenever the threshold of volume has been exceeded. However if the current market condition indicates that the price is very high or rallying then we know that this is a good time to sell a lot of shares, for example 40% of the current volume. The same thing applies for when the momentum indicates that the price is strong down which means that the system should sell less amounts of volume at this low price, for example 15%. The reverse mechanism applies for buying shares. When the market is crashing, this is a good indicator that we should buy a large chunk of volume (40 %), and when the price is at an average point, this means that it would behave like the SVS system i.e. buying 25% of Volume. This is shown in Table 1.
TABLE I. Participation rates for buy side and the sell side of FL-MAS
C. Performance Measures
After implementing both SVS and FL-MAS, the criteria at which both systems will be compared against each other will be the outperformance of FL-MAS on the SVS in basis points. Thebasis point is a unit of measure used often to describe the percentage at which a change in the value or rate of a financial instrument has occurred. One basis point is a1/100th of a percent or0.01% . It is also equivalent to 0.0001 in decimal form.
To calculate the improvement (imp) for the buy side in basis points we use the following formula :
impBuy = 1-FLMAS priceSVS price*104
For the Sell Side the improvement in basis points is:
impSell = FLMAS priceSVS price-1*104
Where FLMAS price is the total cost of buying x amount of shares using FL-MAS, and SVS price is the total cost of buying the same number of shares using the traditional SVS.
This section displays the results of using both FL-MAS and SVS to buy 1million shares of VOD and NOK. For each symbol 30 simulations have been carried on the tick-data set described in section 3. The data has been split as described in order to avoid any autocorrelations, both systems have been run and tested on the same data sets. Table 2 displays the cost at each simulation for buying 1million shares of NOK using both systems. The average price of the whole set is also displayed, and finally the improvement of FL-MAS against SVS is displayed. This improvement rate can be either positive; when FL-MAS has outperformed SVS or negative; when FL-MAS was outperformed by SVS.
Table 3 provides a full analysis of Table 2, by showing clearly the average outperformance rate of buying 1million shares of NOK using FL-MAS, which turns out to be a positive of 2.98 basis points, which means that on average using FL-MAS we save around 3 basis points whenever we buy 1 million share of NOK. Table 3 also displays the results of implementing both systems to buy 1 million shares of VOD. These results for VOD (also displayed on 4) show a much higher mean of around 12.5 basis points. Experiments have been performed again by reshuffling the data sets using the data slots that have not been used before, and the observations were very similar to these results. Hence another measurement mechanism was to observe the median of the results. The median is described as the number separating the higher half of a sample or distribution from the lower half. Both Medians for NOK, and VOD were positive, indicating that on average FL-MAS outperforms SVS for all the buying
TABLE II. Comparing the performance of FL-MAS against SVS for buying 1M shares of NOK
Cost of buying
1m NOK Shares
Cost of buying
1m NOK Shares
in basis points
TABLE III. Analysis of results of buying 1m shares of NOK and VOD
Also the total improvement of both is very high indicating that for both the 30 simulations, a 101.18 basis points was saved using FL-MAS on NOK, and a 374.53 on VOD.
Similarly, the sell side is displayed in Table 4, and analysed in Table 5. Similar to the buy side, all simulations and experiments using FL-MAS and SVS, have displayed that on average FL-MAS has proved to be the better system, and hence would increase the profitability of a financial brokerage firm that executes multiple large orders. 5 displays the selling of 1m shares of VOD.
TABLE IV. Comparing the performance of FL-MAS against SVS for selling 1M shares of VOD
Cost of selling
1m VOD Shares
Cost of selling
Shares using SVS
in basis points
TABLE V. Analysis of results of Selling 1m shares of NOK and VOD
The problem of order execution is a very complicated one. To be able to provide the best price, an execution system has to dynamically change the participation rates at each instance in order to cater for price changes, which are driven by momentum and volatility. This paper has introduced a system that makes use of fuzzy logic, in order to reason out the current market condition which is produced by the accumulation of momentum. FL-MAS is a fuzzy logic momentum analysis system that outperforms the traditional systems used in industry which are often based on executing orders based on the weighted average of the current volume. Results of the implemented system have been displayed and compared against the traditional system. The system proves that on average it increases profitability on orders both on the buy and sell sides. Further work and research has to be done to optimise the performance of the system. This could either include the use of a genetic algorithm to optimise the membership functions or the use of Adaptive Neuro Fuzzy systems which would produce all the possible rules for the system.
 A. Kablan. Adaptive Neuro Fuzzy Inference Systems for High Frequency Financial Trading and Forecasting. Proceedings of The Third International Conference on Advanced Engineering Computing and Applications in Sciences. 2009.
 Lootsma, F. A. (1997). Fuzzy logic for planning and decision making. Springer.
 M. Fedrizzi, W. Ostasiewicz. Towards fuzzy modelling in economics. Fuzzy sets and systems, vol. 54, Issue 3, pp 259-268, 1993.
 C. Tseng, Y. Lin. Financial Computational Intelligence. Society for Computational Economics. Computing in Economics and Finance no. 42. 2005.
 Q. Song, B. S. Chissom. Forecasting enrollments with fuzzy time-series. Part II. Fuzzy Sets and Systems 62, pp 1-8, 1994
 L. Zadeh, Fuzzy sets. Information and Control, vol. 8, pp 338-353, 1965.
 Ormerod, P. (2000) Butterfly economics: A new general theory of social and economic behaviour. Pantheon, New York.
 S. Banik. Modeling chaotic behavior of Dhaka Stock Market Index values using the neuro-fuzzy model, 10th international conference on Computer and information technology ICCIT. Issue , 27-29 Dec. pp 1- 6, 2007.
 S. Chabaa and A. Zeroual. Predicting Packet Transmission Data over IP Networks Using Adaptive Neuro-Fuzzy Inference Systems. Journal of Computer Science Vol. 5(2), pp 123-130, 2009.
 J. C. Bezdek, R. Krisnapuram, N. R. Pal. (1999). Fuzzy models and algorithms for pattern recognition and image processing. Springer.
 Li, Y., Musilek, P and Wyard-Scott, L. Fuzzy logic in agent-based game design. Annual Meeting of Fuzzy Information Processing 2004, vol. 2, pp734-739, 2004.
 Chang, S. S. L. Application of fuzzy set theory to economics. Kybernetes 6, pp 203-207, 1977.
 T. Takagi and M. Sugeno. Fuzzy identification of systems and its application to modeling and control, IEEE Transactions on Systems, Man and Cybernetics, Vol. 15, pp 116-132, 1985.
 JM. Griffin, F. Nardari, R. Stulz. “Stock market trading and market conditions”. NBER, Working Paper 10719, 1-48. 2004.
 E. Boehmer Dimensions of execution quality: recent evidence for U.S. equity markets. Journal of Financial Economics 78, 553–582, 2005.