# Fuzzy Logic Momentum Analysis System For Financial Brokerage Accounting Essay

**Published:** **Last Edited:**

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

Abstract- 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.

Keywords; Finacial brokerage; fuzzy logic; high frequency trading.

Introduction

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. [7] 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 [4].

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 [6]. 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 [10], railway control systems [2] and computer game design [11]. 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 [12] and has since received much attention [3]

Time series models were first combined with fuzzy theory by [5] 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, [1] 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.

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

(1)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 Fig. 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 [13].

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 [14] 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.

Fuzzy Inference

## 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:

Rallying

Strong up

Slightly up

Average

Slightly down

Strong down

Crashing

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:

where is the current price, is the previous price, and 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:

(2)

where 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 Fig. 2.

Membership functions for the linguistic variable of market conditions

The same procedure is applied for calculating the linguistic variable volatility, where the linguistic values are as follows:

Very fast

Fast

Medium

Slow

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.

## 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. Fig. 3 shows how the data is split after each simulation in order to avoid any possible similarities or autocorrelation in the price.

FL-MAS for brokerage

tick data

discarded

tick data

High frequency tick by tick data

Sim 1

Sim 2

Sim n

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 [15]. 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.

Tick data splitting mechanism

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

(3)

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.

## FL-MAS

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.

Participation rates for buy side and the sell side of FL-MAS

Market Condition

Buying PR

Selling PR

Rallying

10%

40%

Strong up

15%

35%

Slightly up

20%

30%

Average

25%

25%

Slightly down

30%

20%

Strong down

35%

15%

Crashing

40%

10%

## 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. TheÂ basis 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 orÂ 0.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 :

## ï€¨ï€´ï€©

For the Sell Side the improvement in basis points is:

## ï€¨ï€µï€©

Where is the total cost of buying x amount of shares using FL-MAS, and is the total cost of buying the same number of shares using the traditional SVS.

Results

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 Fig.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 Simulations.

Comparing the performance of FL-MAS against SVS for buying 1M shares of NOK

Average

Price

Cost of buying

1m NOK Shares

using FLMAS

Cost of buying

1m NOK Shares

using SVS

Improvement

in basis points

11.55

11278964

11285761

6.02

12.19

11581642

11572708

-7.72

11.57

11904468

11910571

5.12

11.12

11610312

11581174

-25.16

11.45

11076799

11087759

9.88

11.36

11456338

11452293

-3.53

11.03

11390049

11404634

12.79

10.89

10947120

10956223

8.31

10.45

10923870

10950576

24.39

10.31

10373596

10377899

4.15

10.63

10354815

10367941

12.66

10.78

10655795

10644194

-10.90

10.70

10816236

10814437

-1.66

10.45

10723627

10737409

12.84

10.24

10281461

10286957

5.34

10.48

10214443

10205979

-8.29

9.67

10553155

10547707

-5.17

9.67

9581014

9602197

22.06

9.40

9754339

9740190

-14.53

9.22

9521736

9544895

24.26

9.10

9282640

9280416

-2.40

9.38

9135088

9149560

15.82

9.27

9434147

9457587

24.78

9.42

9262702

9272236

10.28

9.77

9439104

9430047

-9.60

9.87

9807817

9799844

-8.14

9.49

9880881

9885421

4.59

9.58

9585207

9580119

-5.31

9.48

9619778

9624263

4.66

9.40

9556780

9555829

-1.00

9.67

9350444

9359424

9.59

9.98

9724834

9707290

-18.07

9.94

9869580

9869177

-0.41

Analysis of results of buying 1m shares of NOK and VOD

Mean(imp)

Median(imp)

Total(imp)

Buying NOK

2.98

4.63

101.18

Buying VOD

12.48

1.58

374.53

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.

Buying 1m shares of 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. Fig. 5 displays the selling of 1m shares of VOD.

Comparing the performance of FL-MAS against SVS for selling 1M shares of VOD

Average

Price

Cost of selling

1m VOD Shares

using FLMAS

Cost of selling

1m VOD

Shares using SVS

Improvement

in basis points

139.75

138379831

138304137

5.47

142.10

141880579

141466276

29.20

147.30

145752861

145974583

-15.21

145.70

147127925

147242618

-7.80

144.50

145284236

145840646

-38.30

148.30

141887321

141926909

-2.79

138.30

138593022

138540789

3.77

137.60

138159371

138119542

2.88

138.45

137192635

137152512

2.92

138.80

136243869

137297036

-77.30

138.70

138854269

138889050

-2.50

135.95

134818894

134622571

14.56

133.85

135551066

135198498

26.01

136.50

133744440

133824812

-6.01

135.55

136450408

136384280

4.85

139.50

136381824

136248448

9.78

138.30

138364382

138217262

10.63

136.85

136263730

136277519

-1.01

134.20

133894601

133855738

2.90

134.56

133894289

132534941

101.52

127.10

129477007

129129593

26.83

128.90

127159502

127174918

-1.21

130.85

129889373

129821846

5.20

135.50

130203793

130019981

14.12

136.85

135468629

135441956

1.97

136.45

136622702

136595289

2.01

138.05

136719313

136746751

-2.01

136.65

134943043

135082269

-10.32

132.15

133857223

134159108

-22.55

Analysis of results of Selling 1m shares of NOK and VOD

Mean(imp)

Median(imp)

Total(imp)

Selling NOK

1.6812

2.9291

57.16

Selling VOD

2.73

2.46

81.83

Selling 1m shares of VOD

Conclusion

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.