50
1 FinDEL A Language-Based Approach to Financial Analysis Principal Investigator: A/Prof Khoo Siau Cheng Co-Principal Investigator: A/Prof Chin Wei Ngan School of Computing External Collaborator: Professor Ng Kah Hwa Centre of Financial Engineering Contact: [email protected]

FinDEL A Language-Based Approach to Financial Analysis

  • Upload
    jamal

  • View
    24

  • Download
    2

Embed Size (px)

DESCRIPTION

FinDEL A Language-Based Approach to Financial Analysis. Principal Investigator: A/Prof Khoo Siau Cheng Co-Principal Investigator: A/Prof Chin Wei Ngan School of Computing External Collaborator: Professor Ng Kah Hwa Centre of Financial Engineering Contact: [email protected]. - PowerPoint PPT Presentation

Citation preview

Page 1: FinDEL A Language-Based Approach to  Financial Analysis

1

FinDELA Language-Based

Approach to Financial Analysis

Principal Investigator: A/Prof Khoo Siau ChengCo-Principal Investigator: A/Prof Chin Wei Ngan

School of Computing

External Collaborator: Professor Ng Kah HwaCentre of Financial Engineering

Contact: [email protected]

Page 2: FinDEL A Language-Based Approach to  Financial Analysis

2

Temporal Domain

Time-series information are expressed using patterns

Financial Forecasting

Medical Informatics

Weather Forecasting

etc.

Page 3: FinDEL A Language-Based Approach to  Financial Analysis

3

Financial Patterns

sell

sell

Head & ShoulderFlag

More on stock chart patterns: http://www.incrediblecharts.com/technical/chart_patterns.htm

Technical Analysis

Page 4: FinDEL A Language-Based Approach to  Financial Analysis

4

Medical Patterns

Hemoglobin

Week 1 Week 2 Week 3 Week 4

Anemia Anemia Anemia Anemia

Weekly Repeating Anemia

buy Vitamin

B12

Abstracting Patterns of Anemia level from series of hemoglobin tests

More on medical patterns: http://smi-web.stanford.edu/projects/resume/

Page 5: FinDEL A Language-Based Approach to  Financial Analysis

5

Control Chart Patterns

More on process control chart patterns: http://deming.eng.clemson.edu/pub/tutorials/qctools/ccmain1.htm

System out of control

Page 6: FinDEL A Language-Based Approach to  Financial Analysis

6

Problem

Extracting useful information/patterns from temporal domain can be non-trivial:

The “usefulness” can be user-dependent,intuitively simple, but hard to specify.

Extracting information for explorative purpose requires sophisticated IT skill.

Page 7: FinDEL A Language-Based Approach to  Financial Analysis

7

Opportunities (User Perspective)

A user-centered technology can bring the power ofexploratory information extraction to domain expertsand users

The technology should speak the same jargon as the domain experts.

The technology should emphasize on problemdescription rather than solution prescription.

Page 8: FinDEL A Language-Based Approach to  Financial Analysis

8

Opportunities (Technology Perspective)

Technology can be reused over a broad rangeof temporal domains:

financial forecastingmedical informativeweather forecasting

Unified base that can easily accommodate the advancement in technology

neural networkpattern recognitiondata mining

Page 9: FinDEL A Language-Based Approach to  Financial Analysis

9

Research Objective of FinDEL

Using programming language technology to providea unified framework for

Supporting user-centered tools for extractinginformation from financial domains

Ensuring the adaptability of existing domainsolutions to technology advances.

Page 10: FinDEL A Language-Based Approach to  Financial Analysis

10

Roles of a Language

Language Constructs

Domain Experts

Algorithms Compilers

Users

Page 11: FinDEL A Language-Based Approach to  Financial Analysis

11

Why is Language Important?

It defines a representation (temporal abstract) that is:

Abstract enough to capture user-defined patterns

Concrete enough for numerous techniques tomanipulate

It defines a set of terminologies that is:

Abstract enough to match domain jargons

Accurate enough to ensure meaningful manipulations

Page 12: FinDEL A Language-Based Approach to  Financial Analysis

12

What Kind of Language is Good?

Simple

Elegant

Extensible

Manipulative

Embedded Language

Page 13: FinDEL A Language-Based Approach to  Financial Analysis

13

Business OpportunitiesWe have not seen any commercial products that are as expressive and versatile as what we have suggested.

Some of the available products:

Chart Pattern Recognition plugin for MetaStock

Patterns (http://www.marketsonline.com/software/patterns.htm)

Bull’s-Eye Broker (http://www.archeranalysis.com/beb/index.html)

Please refer to slide 39 for more information

Page 14: FinDEL A Language-Based Approach to  Financial Analysis

14

Research Collaboration

We need domain experts to help us in defining the problem, and in perfecting the techniques and solutions.

Financial experts Researchers from the Centre of Financial Engineering

Page 15: FinDEL A Language-Based Approach to  Financial Analysis

15

A Prototype of FinDEL

The following slides (16 – 38)Demonstrates how financial chart patterns can be effectively specified and manipulated by an elegant, concise, and yet “high-level” programming language.

Technical detail is available the paper “Charting Patterns on Price History”,downloadable in http://www.comp.nus.edu.sg/~khoosc/research.html

Page 16: FinDEL A Language-Based Approach to  Financial Analysis

16

Outline Introduction Specifying Technical Indicators Specifying Patterns

Simple Patterns Composite Patterns

Pattern Definitions Conclusion

Page 17: FinDEL A Language-Based Approach to  Financial Analysis

17

Design Objectives of aChart Pattern Language Define patterns with the help of

constraints and technical indicators. The language should be “high-level ”. It should be complete enough to

specify all the well-known patterns. Pattern definitions should be reusable

and composable.

Page 18: FinDEL A Language-Based Approach to  Financial Analysis

18

Outline Introduction Specifying Technical Indicators Specifying Patterns

Simple Patterns Composite Patterns

Pattern Definitions Conclusion

Page 19: FinDEL A Language-Based Approach to  Financial Analysis

19

Technical Indicator A mathematical formula that

quantifies the market behavior. It is a time-series data. Basics indicators:

Low, high, close, open of a dayTransaction volume of a day open, low, high, close, volume

Page 20: FinDEL A Language-Based Approach to  Financial Analysis

20

Using Technical Indicators

4.94.94.54.64.34.34.54.33.83.63.94.14.04.44.7High

low

Day

4.54.44.14.24.24.14.03.93.63.53.73.93.84.04.5

14131211109876543210

low 3 = Just 3.9 high 10 = Just 4.3

low 15 = Nothing

Page 21: FinDEL A Language-Based Approach to  Financial Analysis

21

Composing Indicators

tPrice :: Indicator PricetPrice = (high + low + close) / 3.0

Typical Price:

(#) operator: (high # 10) t = high (t-10)

avgOfLast3 = (high#2 + high#1 + high)/3.0

tprice t gives value of typical price for t

Indexing into price History:

Page 22: FinDEL A Language-Based Approach to  Financial Analysis

22

Moving Average Denotes the trend of the market. “n days moving Average” is

calculated by averaging the prices of last n days.

mvAvgt = (hight+hight-1+hight-2+…+hight-n+1)/n

Page 23: FinDEL A Language-Based Approach to  Financial Analysis

23

Example

4.94.94.54.64.34.34.54.33.83.63.94.14.04.44.7High

low

Day

4.54.44.14.24.24.14.03.93.63.53.73.93.84.04.5

14131211109876543210

movingAvg 10 11 = sum(…)/10 = Just 4.15

movingAvg 10 8 = Nothing

movingAvg n = (high + high#1 + high#2 + …. + high#n)/n

“10 days moving average” is, movingAvg 10“10 days moving average” for 11th day is, movingAvg 10

11

Page 24: FinDEL A Language-Based Approach to  Financial Analysis

24

Microsoft stock

Moving average

price cross below mvAvg

SELL

price cross above mvAvg

BUY

Page 25: FinDEL A Language-Based Approach to  Financial Analysis

25

Buy and Sell signals buy = close `riseAbove` (movingAvg 14)sell = close `fallBelow` (movingAvg 14)

f1 `riseAbove` f2 = (f1 > f2) && (f1 # 1) < (f2 # 1)f1 `fallBelow` f2 = (f1 < f2) && (f1 # 1) > (f2 # 1)

Page 26: FinDEL A Language-Based Approach to  Financial Analysis

26

Outline Introduction Specifying Technical Indicators Specifying Patterns

Simple Patterns Composite Patterns

Pattern Definitions Conclusion

Page 27: FinDEL A Language-Based Approach to  Financial Analysis

27

Patterns Simple Patterns

Bar, Up, Down, Horizontal, Support Line, Resistance Line

Page 28: FinDEL A Language-Based Approach to  Financial Analysis

28

Landmarks & sub-Components

Landmarks are critical points of a pattern.

lms :: Patt -> [Bar]

sub :: Patt -> [Patt]

returns the landmarks for e.g. a, b, c, d, e, f, g

returns the sub-components for e.g. ab,

bc, cd, de, ef, fg

Page 29: FinDEL A Language-Based Approach to  Financial Analysis

29

Operations on Patterns Imposing constraints Composing horizontally Overlaying patterns

Page 30: FinDEL A Language-Based Approach to  Financial Analysis

30

∞ : Imposing Constraints

∞ :: Pattern -> Constraints -> Pattern

in [ low t > low (t-1), high t < high (t-1)

]

insideDay = bar ∞ u. let [t] = lms u

Inside day

t

Page 31: FinDEL A Language-Based Approach to  Financial Analysis

31

Inside Days

Yesterday was an

inside-day

Buy 1Million stocks

Page 32: FinDEL A Language-Based Approach to  Financial Analysis

32

Fuzzy ConstraintsEg : ‘bigDown’ is a primitive down pattern, with

the decrease in price being usually greater than 10 units.

a

b

bigDown = down ∞ u. let [a,b] = lms uin [ high a – low b >F 10 ]

<F, >F , =F are the fuzzy comparison operators

Page 33: FinDEL A Language-Based Approach to  Financial Analysis

33

Followed-By composition

p1 p2

hill = (up » down) ∞ h . let [a,b,c] = lms h

in [low a =F low c]

a c

b

» :: Pattern -> Pattern -> Pattern

Page 34: FinDEL A Language-Based Approach to  Financial Analysis

34

Head & Shoulderhead_shoulder = hill » hill » hill ∞ hs. let [a,b,c,d,e,f,g] = lms hs in [

high d > high b, high d > high f, high b =F high f

]

Page 35: FinDEL A Language-Based Approach to  Financial Analysis

35

Overlay Composition

s

p

◇ :: Pattern -> Pattern ->Pattern

Page 36: FinDEL A Language-Based Approach to  Financial Analysis

36

Overlay Composition

rect = res ◇ sprt ∞ u. let [r,s] = sub u [m,n] = lms r in [slope r =F slope s, breakout r n]

r

s

breakout

Page 37: FinDEL A Language-Based Approach to  Financial Analysis

37

Diamonddiamond = ((res » res) ◇ (sprt » sprt)) ∞ u. let [rl,sl] = sub u

[m,n] = sub rl [p,q] = sub sl [c,d] = lms q in [diverge m p, converge n q, breakout q d]

Page 38: FinDEL A Language-Based Approach to  Financial Analysis

38

Outline Introduction Specifying Technical Indicators Specifying Patterns

Simple Patterns Composite Patterns Making Patterns Reusable

Conclusion

Page 39: FinDEL A Language-Based Approach to  Financial Analysis

39

Related Products Most popular one is,

John Murphy’s Chart Pattern Recognition plugin for MetaStock (http://www.murphymorris.com/products/cpr.html)

Others, Patterns

(http://www.marketsonline.com/software/patterns.htm) Bull’s-Eye Broker

(http://www.archeranalysis.com/beb/index.html) Fxtrek.com

(http://www.fxtrek.com/universityEN/ai/ai_stock_trading01.asp) http://www.pitstock.com/support/index.html http://www.tarnsoft.com/headandshoulder.html

Page 40: FinDEL A Language-Based Approach to  Financial Analysis

40

Business Opportunities

We believe our solution is

unique in the marketplace

technically advantageous

more expressive than existing tools

Page 41: FinDEL A Language-Based Approach to  Financial Analysis

41

Research Opportunities Efficient implementation From graphical patterns to

language Pattern Mining Similarity Pattern matching Other domain applications

Page 42: FinDEL A Language-Based Approach to  Financial Analysis

42

Related Mini-ProjectsUser-Centered

Tech: GUI Design Predictive Power

of Technical Patterns

Trading Strategy

Algorithmic Tech: Analyzing use of

patterns Optimizing use of

pattern Discovery of

Patterns Refinement of

Patterns

Page 43: FinDEL A Language-Based Approach to  Financial Analysis

43

Predictive Power of Patterns To determine the ability of a

pattern in determining the trend of the market performance

Tools required: Statistical testing Adjusting patterns and data for such

test

Page 44: FinDEL A Language-Based Approach to  Financial Analysis

44

Trading Strategy To enable user to make trading

decision Two phases:

On historical data Real-time data

Tools required: Extended CPL with trading operators

Page 45: FinDEL A Language-Based Approach to  Financial Analysis

45

Analyzing use of Patterns A type system to ensure the

correct use of patterns, and to identify potential optimization

Tools required: Type-based/Constrain-based analysis Possibly Cameleon system

Page 46: FinDEL A Language-Based Approach to  Financial Analysis

46

Optimizing use of Patterns To improve the efficiency of

pattern matching Tools required:

Constraint solving Meta-Haskell for the purpose of meta-

programming

Page 47: FinDEL A Language-Based Approach to  Financial Analysis

47

Discovery of Patterns To discover profitable patterns

automatically Tools required:

Genetic programming Neural network Machine learning Statistical testing

Page 48: FinDEL A Language-Based Approach to  Financial Analysis

48

Refinement of Patterns To refine a pattern so as to

increase its predictive power Tools required:

Machine learning Statistical testing

Page 49: FinDEL A Language-Based Approach to  Financial Analysis

49

Projects in the future: Inclusion of Financial Derivatives

Futures and Options Running FinDEL in different platform

.NET platform Compiled to FPGA Mobile Computing

Application to other temporal domains Medical Clinic tests

Page 50: FinDEL A Language-Based Approach to  Financial Analysis

50

Thank you

Contact: [email protected]