500 likes | 663 Views
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: Khoosc@comp.nus.edu.sg.
E N D
FinDELA 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: Khoosc@comp.nus.edu.sg
Temporal Domain Time-series information are expressed using patterns Financial Forecasting Medical Informatics Weather Forecasting etc.
Financial Patterns sell sell Head & Shoulder Flag Technical Analysis More on stock chart patterns: http://www.incrediblecharts.com/technical/chart_patterns.htm
Medical Patterns buy Vitamin B12 Weekly Repeating Anemia Anemia Anemia Anemia Anemia Hemoglobin Week 1 Week 2 Week 3 Week 4 Abstracting Patterns of Anemia level from series of hemoglobin tests More on medical patterns: http://smi-web.stanford.edu/projects/resume/
Control Chart Patterns System out of control More on process control chart patterns: http://deming.eng.clemson.edu/pub/tutorials/qctools/ccmain1.htm
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.
Opportunities (User Perspective) A user-centered technology can bring the power of exploratory information extraction to domain experts and users The technology should speak the same jargon as the domain experts. The technology should emphasize on problem description rather than solution prescription.
Opportunities (Technology Perspective) Technology can be reused over a broad range of temporal domains: financial forecasting medical informative weather forecasting Unified base that can easily accommodate the advancement in technology neural network pattern recognition data mining
Research Objective of FinDEL Using programming language technology to provide a unified framework for Supporting user-centered tools for extracting information from financial domains Ensuring the adaptability of existing domain solutions to technology advances.
Roles of a Language Domain Experts Users Language Constructs Algorithms Compilers
Why is Language Important? It defines a representation (temporal abstract) that is: Abstract enough to capture user-defined patterns Concrete enough for numerous techniques to manipulate It defines a set of terminologies that is: Abstract enough to match domain jargons Accurate enough to ensure meaningful manipulations
Embedded Language What Kind of Language is Good? Simple Elegant Extensible Manipulative
Business Opportunities We 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
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
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
Outline • Introduction • Specifying Technical Indicators • Specifying Patterns • Simple Patterns • Composite Patterns • Pattern Definitions • Conclusion
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.
Outline • Introduction • Specifying Technical Indicators • Specifying Patterns • Simple Patterns • Composite Patterns • Pattern Definitions • Conclusion
Technical Indicator • A mathematical formula that quantifies the market behavior. • It is a time-series data. • Basics indicators: Low, high, close, open of a day Transaction volume of a day • open, low, high, close, volume
Day 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 low 4.5 4.0 3.8 3.9 3.7 3.5 3.6 3.9 4.0 4.1 4.2 4.2 4.1 4.4 4.5 High 4.7 4.4 4.0 4.1 3.9 3.6 3.8 4.3 4.5 4.3 4.3 4.6 4.5 4.9 4.9 low 15 = Nothing low 3 = Just 3.9 high 10 = Just 4.3 Using Technical Indicators
Composing Indicators Typical Price: tPrice :: Indicator Price tPrice = (high + low + close) / 3.0 tprice t gives value of typical price for t Indexing into price History: (#) operator: (high # 10) t = high (t-10) avgOfLast3 = (high#2 + high#1 + high)/3.0
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
Day 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 low 4.5 4.0 3.8 3.9 3.7 3.5 3.6 3.9 4.0 4.1 4.2 4.2 4.1 4.4 4.5 High 4.7 4.4 4.0 4.1 3.9 3.6 3.8 4.3 4.5 4.3 4.3 4.6 4.5 4.9 4.9 Example 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 movingAvg 10 11 = sum(…)/10 = Just 4.15 movingAvg 108 = Nothing
Moving average Microsoft stock price cross below mvAvg SELL BUY price cross above mvAvg
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)
Outline • Introduction • Specifying Technical Indicators • Specifying Patterns • Simple Patterns • Composite Patterns • Pattern Definitions • Conclusion
Patterns • Simple Patterns • Bar, Up, Down, Horizontal, Support Line, Resistance Line
Landmarks & sub-Components Landmarks are critical points of a pattern. returns the landmarks for e.g. a, b, c, d, e, f, g lms :: Patt -> [Bar] sub :: Patt -> [Patt] returns the sub-components for e.g. ab, bc, cd, de, ef, fg
Operations on Patterns • Imposing constraints • Composing horizontally • Overlaying patterns
Inside day t insideDay = bar ∞ u. let [t] = lms u in [ low t > low (t-1), high t < high (t-1) ] ∞ : Imposing Constraints ∞ :: Pattern -> Constraints -> Pattern
Yesterday was an inside-day Inside Days Buy 1Million stocks
u. let [a,b] = lms u bigDown = down ∞ in [ high a – low b >F 10 ] Fuzzy Constraints Eg : ‘bigDown’ is a primitive down pattern, with the decrease in price being usually greaterthan 10 units. a b <F, >F ,=F are the fuzzy comparison operators
hill = (up » down) ∞ h . let [a,b,c] = lms h in [low a =F low c] b c a Followed-By composition p1 p2 » :: Pattern -> Pattern -> Pattern
Head & Shoulder head_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 ]
p s Overlay Composition ◇ :: Pattern -> Pattern ->Pattern
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 breakout s
Diamond diamond = ((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]
Outline • Introduction • Specifying Technical Indicators • Specifying Patterns • Simple Patterns • Composite Patterns • Making Patterns Reusable • Conclusion
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
Business Opportunities We believe our solution is unique in the marketplace technically advantageous more expressive than existing tools
Research Opportunities • Efficient implementation • From graphical patterns to language • Pattern Mining • Similarity Pattern matching • Other domain applications
User-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 Related Mini-Projects
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
Trading Strategy • To enable user to make trading decision • Two phases: • On historical data • Real-time data • Tools required: • Extended CPL with trading operators
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
Optimizing use of Patterns • To improve the efficiency of pattern matching • Tools required: • Constraint solving • Meta-Haskell for the purpose of meta-programming
Discovery of Patterns • To discover profitable patterns automatically • Tools required: • Genetic programming • Neural network • Machine learning • Statistical testing
Refinement of Patterns • To refine a pattern so as to increase its predictive power • Tools required: • Machine learning • Statistical testing
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
Thank you Contact: Khoosc@comp.nus.edu.sg