Predictive Indicators

Slides:



Advertisements
Similar presentations
ECE 8443 – Pattern Recognition EE 3512 – Signals: Continuous and Discrete Objectives: Response to a Sinusoidal Input Frequency Analysis of an RC Circuit.
Advertisements

Sharpen Your Trading with the Fisher Transform Presented by John Ehlers.
Copyright (c) 2004 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 13 Nonlinear and Multiple Regression.
Loop Shaping Professor Walter W. Olson
Filtering Filtering is one of the most widely used complex signal processing operations The system implementing this operation is called a filter A filter.
Ch11 Curve Fitting Dr. Deshi Ye
SPECTRAL DILATION Codifying the Fractal Nature of Market Data Impact on Technical Indicators StockSpotter.com John Ehlers
Techniques in Signal and Data Processing CSC 508 Fourier Analysis.
Time Series Analysis Autocorrelation Naive & Simple Averaging
Quiz: Find an expression for in terms of the component symbols.
Chapter 5 Time Series Analysis
Data Sources The most sophisticated forecasting model will fail if it is applied to unreliable data Data should be reliable and accurate Data should be.
Digital Image Processing Chapter 5: Image Restoration.
Transient and steady state response (cont.)
Statistics for Managers Using Microsoft Excel, 4e © 2004 Prentice-Hall, Inc. Chap 6-1 Chapter 6 The Normal Distribution and Other Continuous Distributions.
With technical analysis, timing is the critical success factor. Technical Analysis serves to determine "when to buy or when to sell" shares. It is concerned.
1. 2 LOOP DYNAMICS To keep track of deviations from the free-running frequency,
LINEAR PROGRAMMING SIMPLEX METHOD.
Demand Management and Forecasting
MOVING AVERAGES. MOVING AVERAGE METHOD IS THE MOST WIDELY USED METHOD OF IDENTIFYING TREND REVERSAL SINCE THEY DO A GOOD JOB AT ROUNDING UP THE FLUCTUATIONS.
CHAPTER 14 MULTIPLE REGRESSION
1 The Instantaneous Trendline AfTA 20 May 2003 John Ehlers.
IIR Filter design (cf. Shenoi, 2006) The transfer function of the IIR filter is given by Its frequency responses are (where w is the normalized frequency.
Forecasting to account for seasonality Regularly repeating movements that can be tied to recurring events (e.g. winter) in a time series that varies around.
Copyright © 2011 by Denny Lin1 Computer Music Synthesis Chapter 6 Based on “Excerpt from Designing Sound” by Andy Farnell Slides by Denny Lin.
Curve-Fitting Regression
Professor Walter W. Olson Department of Mechanical, Industrial and Manufacturing Engineering University of Toledo Loop Shaping.
Chapter 6. Effect of Noise on Analog Communication Systems
Signal Analyzers. Introduction In the first 14 chapters we discussed measurement techniques in the time domain, that is, measurement of parameters that.
ELECTRICAL ENGINEERING: PRINCIPLES AND APPLICATIONS, Third Edition, by Allan R. Hambley, ©2005 Pearson Education, Inc. CHAPTER 6 Frequency Response, Bode.
Demand Management and Forecasting Chapter 11 Portions Copyright © 2010 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin.
Chapter 11 – With Woodruff Modications Demand Management and Forecasting Copyright © 2010 by The McGraw-Hill Companies, Inc. All rights reserved.McGraw-Hill/Irwin.
 Analysis of statistics generated by market activity such as past price and volume to come up with reasonable outcome in future using charts as a primary.
Chapter 13 The Basic Elements and Phasors. Objectives Be able to add and subtract sinusoidal voltages or currents Use phasor format to add and subtract.
Ch7 Operational Amplifiers and Op Amp Circuits
IIR Filter design (cf. Shenoi, 2006)
Lesson 8: Basic Monte Carlo integration
CS 591 S1 – Computational Audio -- Spring, 2017
Chapter 7. Classification and Prediction
Regression Analysis AGEC 784.
TIME SERIES ANALYSIS.
Data Mining: Concepts and Techniques
Lattice Struture.
Vocoders.
Linear Prediction Simple first- and second-order systems
ALTERNATING CURRENT AND VOLTAGE
TOPIC 3: FREQUENCY SELECTIVE CIRCUITS
Digital Control Systems Waseem Gulsher
Instructor :Dr. Aamer Iqbal Bhatti
University of Virginia
HISTORICAL AND CURRENT PROJECTIONS
Quick Review of LTI Systems
Electric Circuits Fundamentals
Statistical Methods For Engineers
Introduction to Statistics
Fundamentals of Electric Circuits Chapter 14
Chapter 6 Discrete-Time System
Nonlinear regression.
Basic Image Processing
CHAPTER 14 MULTIPLE REGRESSION
Linear Prediction.
Principles of the Global Positioning System Lecture 11
8.5 Modulation of Signals basic idea and goals
Chapter 7 Finite Impulse Response(FIR) Filter Design
Principles of the Global Positioning System Lecture 13
9.5 Least-Squares Digital Filters
Momentum Momentum is used to indicate the speed with which prices are changing. When a change in direction occurs in a short-term trend, technicians say.
Laplace Transforms Important analytical method for solving linear ordinary differential equations. - Application to nonlinear ODEs? Must linearize first.
Laplace Transforms Important analytical method for solving linear ordinary differential equations. - Application to nonlinear ODEs? Must linearize first.
Demand Management and Forecasting
Presentation transcript:

Predictive Indicators MESA Software John Ehlers e-mail: ehlers@mesasoftware.com

AGENDA Exponential Moving Averages Higher order filters Why lag is important How to compute the EMA constant to produce a given lag Higher order filters Let your computer do a superior job of smoothing Essence of Predictive Filters Linear Kalman Filters Nonlinear Kalman Filters Theoretically Optimum Predictive Filters Zero Lag smoothing

Fundamental Concept of Predictive Filters In the trend mode price difference is directly related to time lag Procedure to generate a predictive line: Take an EMA of price (better, a 3 Pole filter) Take the difference ( delta) between the price and its EMA Form the predictor by adding delta to the price equivalent to adding 2*delta to EMA

A Simple Predictive Trading System Rules: Buy when Predictor crosses EMA from bottom to top Sell when Predictor crosses EMA from top to bottom Usually produces too many whipsaws to be practical

Secrets of Predictive Filters All averages lag (and smooth) All differences lead (and are more noisy) The objective of filters is to eliminate the unwanted frequency components The range of trading frequencies makes a single filter approach impractical A better approach divides the market into two modes Cycle Mode Trend Mode A Trend can be a piece of a longer cycle

Simple and Exponential Moving Averages EMA constant is usually related to the length of an SMA “Filter Price Data”, J.K. Hutson, TASAC Vol. 2, page 102 The equation is a = 2 / (Length +1) Only delay and amplitude smoothing are important Delay is the most important criteria for traders An EMA has superior rejection for a given delay

Relating Lag to the EMA Constant An EMA is calculated as: g(z) = a*f(z) + (1 - a )*g(z - 1) where g() is the output f() is the input z is the incrementing variable Assume the following for a trend mode f() increments by 1 for each step of z has a value of “i” on the “i th” day k is the output lag i - k = a *i + (1 - a)*(i - k - 1) = a *i + (i - k) - 1 - a *i + a *(k + 1) 0 = a *(k + 1) - 1 Then k = 1/a -1 OR a = 1/(k + 1)

Relationship of Lag and EMA Constant a k (Lag) .5 1 .4 1.5 .3 2.33 .25 3 .2 4 .1 9 .05 19 Small a cannot be used for short term analysis due to excessive lag

EMA is a Low Pass Filter g(z) = a*f(z) + (1 - a)*g(z - 1) Use Z Transform notation (unit lag = 1/z) g = a *f + (1 - a)*g/z Solving the algebra: g = a *f*z / (z - (1 - a)) Output is related to input by a first order polynomial Called 1 Pole filter because response goes to infinity when z = 1 - a Higher order polynomials produce better filtering Second order: g = kf / (z2 + az + b) Third order: g = kf / (z3 + az2 + bz +c)

Higher Order Filters Give Better Filtering Smoothing increases with filter order High Frequencies (short cycles) are more sharply rejected

Higher Order Filter Design Equations Delay = N * P / p2 (N is order, P is cutoff period) Second Order Butterworth equations: a = exp(-1.414*p/P) b = 2*a*Cos(1.414*p/P) g = b*g[1] - a*a*g[2] + ((1 - b + a*a)/4)*(f + 2*f[1] + f[2]) Third Order Butterworth equations: a = exp(-p/P) b = 2*a*Cos(1.732*p/P) c = exp(-2*p/P) g = (b + c)*g[1] - (c + b*c)*g[2] + c*c*g[3] + ((1 - b + c)*(1 - c) / 8)*(f + 3*f[1] + 3*f[2] + f[3]) where g is output, f is input

14 Bar Cutoff 1, 2, & 3 Pole LowPass Filters DM__94z.ttd 940922 1 Pole 2 Pole 3 Pole Increased Lag is the penalty for increased smoothing

1 & 3 Pole LowPass Filters Equalized for 2 Bar Lag DM___94z.ttd 940922 Three Pole Response Higher Order filters give better fidelity for an equal amount of lag

Linear Kalman Filters Originally used to predict ballistic trajectories Basic ideal is to correct the previous estimate using the current error to modify the estimate Procedure for a Linear Kalman Filter: Previous estimate is the EMA Estimate Lag error based on price change Multiply the price rate of change by the lag-related constant g(z) = a*f(z) + (1 - a)*g(z - 1) + g*(f(z) - f(z - 1))

Computing Kalman Coefficients As before, increment f() by 1 for each step of z i - k = a *i + (1 - a)*(i - k - 1) + g*(i - (i -1)) = a *i + (i - k) - 1 - a *i + a *(k + 1) + g 0 = a *(k + 1) - 1 + g g = 1 - a *(k + 1) ___K___ ___g__ 1 (Lag) 1 - 2*a 0 1 - a -1 (Lead) 1 -2 1 + a Now lag is under control for any EMA constant Leading functions are too noisy to be useful

Linear Kalman Filter 1 Day Lag GC___95Q.TTD 950728 Kalman g = .5 EMA a = .25

Nonlinear Kalman Filter Take EMA of price (better, a 3 Pole filter) Take the difference (delta) between Price and its EMA Take an EMA of delta (or a 3 Pole filter) Smoothing will help reduce whipsaws Ideally, smoothing introduces no major trend mode lag because delta is detrended Add the smoothed delta to EMA for a zero lag curve. Add 2*(smoothed delta) to EMA for a smoother predictive line

Zero Lag Nonlinear Kalman Filter Example GC___95Q.TTD 950728 Nonlinear Kalman Response EMA a = .25

Theoretically Optimum Predictive Filters Optimum predictive filters are solutions to the generalized Wiener-Hopf integral equation “Statistical Theory of Communication”, Y.W. Lee, John Wiley and Sons, 1960 Optimum Predictive filters pertain only to the market cycle mode (Must use detrended waveforms) Two solutions are of interest to traders Pure predictor (noise free case) See “The BandPass Indicator”, John Ehlers, TASAC, September 1994, page 51 Predicting in the presence of noise See “Optimum Predictive Filters”, John Ehlers, TASAC, June 1995, Page 38

Pure Predictor Calculations start by taking two 3 Pole Low Pass filters for smoothing Period1 = .707 * Dominant Cycle Period2 = 1.414 * Dominant Cycle Ratio of the two periods is 2:1 The second filter has twice the lag of the first Take the difference of the two filter outputs The difference detrends the information The resultant is in phase with the cycle component of the price A very smooth (noise-free) replica of the cycle component of the price is established. This is the BandPass Filter output.

Sinewave “momentum” phase leads by 90 degrees “Momentum” is similar to a calculus derivative. d (Sin(w*t)) / dt = w * Cos(w*t) 1/w = P/(2*p) must be used as an amplitude normalizer.

Computing the Noise-Free Predictor Take the “momentum” of the BandPass Filter output (simple one day difference). Normalize amplitude by multiplying the “momentum” by Po / (2*p ) Produce 30 degree leading function Multiply normalized “momentum” by .577 (tan(30) = .577) Add product to BandPass Filter output Reduce leading function amplitude Multiply by .87 to normalize vector amplitude Multiply again by .75 to reduce amplitude below BandPass amplitude. Crossover entry signal always leads by 1/8th of a cycle

Noise-Free Predictor Vector Construction

The Complete BandPass Indicator The BandPass Indicator is automatically tuned in: MESA for Windows 3D for Windows

BandPass Indicator Crossings Give Buy/Sell Signals GC___95J.TTD 950303

Optimum Predictive Filter in the Presence of Noise Start with RSI or Stochastic Indicator Provides detrended waveform Adjust length until the waveform resembles a sinewave Technique is useful only when the waveform has a Poisson probability distribution The midpoint crossings must be relatively regular Take an EMA of the RSI a = .25 is nominally correct (gives a 3 day lag) Subtract the EMA from the RSI to produce the predictor Remember the fundamental premise in constructing predictive filters?

RSI and Optimum Predictive Filter GC___95J.TTD 950303

Zero Lag Filters Zero Lag filters are constructed using cycle theory A phasor accurately depicts cyclic amplitude and phase characteristics Phasors ignore the cyclic rotation and examine only relative lead and lag relationships phasor q sinewave

Zero Lag Filter Construction Phasor A has a lag of DominantCycle/16 Phasor B has twice the lag of Phasor A Subtract B from A by reversing B and adding Resultant is detrended leading angle Phasor C Vector add C to A Resultant is zero lag, non-detrended Phasor D A B -B C A C D A

Zero Lag Filter Example GC___95Q.TTD 950728

A Zero Lag Filter Application Take a 3 Pole zero lag filter of price highs Take a 3 Pole zero lag filter of price lows Calculate statistics of the high and low variations Add 2 Standard Deviations to the Highs Zero Lag Filter Subtract 2 Standard Deviations to the Lows Zero Lag Filter Resultant channels can be used as stop values for a stop-and-reverse system Remove the +/- Std Deviations near cycle turns SUMMIT for Windows uses this procedure

SUMMARY What you have learned: How to relate filter lag to EMA constant How to compute Higher Order Butterworth Filters How to control lag using a Linear Kalman Filter How to compute a Nonlinear Kalman Filter Possible start for a crossover system How to compute Optimum Predictive Filters for the cycle mode Pure Predictor (Noise-Free, using higher order filters) With RSI or Stochastics How to compute a zero lag filter