32
1 John Ehlers John Ehlers TAOTN 2002 TAOTN 2002 www.mesasoftware.com www.mesasoftware.com www.mesa-systems.com www.mesa-systems.com [email protected] [email protected]

TAOTN 2002

Embed Size (px)

DESCRIPTION

www.mesasoftware.com www.mesa-systems.com [email protected]. TAOTN 2002. Agenda. Theory Random Walk and the Basis for Market Modes Basic Tools - Averages and Momentums How MESA Trades the Market Modes How MESA can make good indicators better by making them adaptive Fisher Transform - PowerPoint PPT Presentation

Citation preview

Page 1: TAOTN 2002

1

John EhlersJohn Ehlers

TAOTN 2002TAOTN 2002

www.mesasoftware.comwww.mesasoftware.comwww.mesa-systems.comwww.mesa-systems.comehlers@[email protected]

Page 2: TAOTN 2002

3

John EhlersJohn Ehlers

AgendaAgenda

• TheoryTheory– Random Walk and the Basis for Market ModesRandom Walk and the Basis for Market Modes– Basic Tools - Averages and MomentumsBasic Tools - Averages and Momentums

• How MESA Trades the Market ModesHow MESA Trades the Market Modes• How MESA can make good indicators better How MESA can make good indicators better

by making them adaptiveby making them adaptive• Fisher TransformFisher Transform

– How to enhance your current indicatorsHow to enhance your current indicators

Page 3: TAOTN 2002

4

John EhlersJohn Ehlers

Drunkard’s WalkDrunkard’s Walk

• I relate the market to known physical I relate the market to known physical phenomenaphenomena– Smoke plume for Trend ModesSmoke plume for Trend Modes– Meandering river for Cycle ModesMeandering river for Cycle Modes

• Both randomness and short term cycles can Both randomness and short term cycles can arise from the solution to the random walk arise from the solution to the random walk problemproblem

• Solution is the “Diffusion Equation” for Trend Solution is the “Diffusion Equation” for Trend ModesModes

• Solution is the “Telegraphers Equation” for Solution is the “Telegraphers Equation” for Cycle ModesCycle Modes

Page 4: TAOTN 2002

5

John EhlersJohn Ehlers

Diffusion EquationDiffusion Equation

• ““Drunkard’s Walk” is a special form of the random walk Drunkard’s Walk” is a special form of the random walk problemproblem– The drunk flips a coin to determine right or left with each step The drunk flips a coin to determine right or left with each step

forwardforward– The random variable is directionThe random variable is direction

• The Diffusion equation is the solutionThe Diffusion equation is the solution– describes smoke coming from a smokestackdescribes smoke coming from a smokestack

• The smoke plume is analogous to market conditionsThe smoke plume is analogous to market conditions– Breeze bends the plume to an average trendlineBreeze bends the plume to an average trendline– Plume widens with distance - distant predictions are less Plume widens with distance - distant predictions are less

accurateaccurate– Smoke density is analogous to prediction probability - the best Smoke density is analogous to prediction probability - the best

estimator is the averageestimator is the average

Page 5: TAOTN 2002

6

John EhlersJohn Ehlers

Telegraphers’ EquationTelegraphers’ Equation

• Modify the “Drunkard’s Walk” problemModify the “Drunkard’s Walk” problem– Coin flip decides whether the drunk will reverse his Coin flip decides whether the drunk will reverse his

direction, regardless of the direction of the last stepdirection, regardless of the direction of the last step– The random variable is now momentum, not directionThe random variable is now momentum, not direction

• Solution is now the Telegrapher’s EquationSolution is now the Telegrapher’s Equation– Describes the electric wave on a telegraph wireDescribes the electric wave on a telegraph wire– Also describes a meandering riverAlso describes a meandering river

• A river meander is a short term cycleA river meander is a short term cycle– Random probability exists (Diffusion Equation) Random probability exists (Diffusion Equation) IF:IF:

• Individual meanders are overlaidIndividual meanders are overlaid• Or a long data span is takenOr a long data span is taken

Page 6: TAOTN 2002

7

John EhlersJohn Ehlers

The Market is similar to a meandering riverThe Market is similar to a meandering river

• Both follow the path of least resistanceBoth follow the path of least resistance• Rivers attempt to keep a constant water slope - Rivers attempt to keep a constant water slope -

maintains the conservation of energy.maintains the conservation of energy.• Conservation of Energy produces the path of least Conservation of Energy produces the path of least

resistanceresistance– Paths of uniform resistance look like pieces of sinewavesPaths of uniform resistance look like pieces of sinewaves

• Market Forces (greed, fear, profit, loss, etc.) are Market Forces (greed, fear, profit, loss, etc.) are similar to physical forces, producing paths of uniform similar to physical forces, producing paths of uniform resistance.resistance.

• Think about how the masses ask the question:Think about how the masses ask the question:Will the market change?Will the market change?

ORORWill the trend continue?Will the trend continue?

Page 7: TAOTN 2002

8

John EhlersJohn Ehlers

Market ModesMarket Modes

• My market model only has two modesMy market model only has two modes– Trend ModeTrend Mode– Cycle ModeCycle Mode

• Market Cycles can be measuredMarket Cycles can be measured• If the cycles are removed from the data, the If the cycles are removed from the data, the

residual must be the Trendresidual must be the Trend

Page 8: TAOTN 2002

13

John EhlersJohn Ehlers

MESA Indicates and TradesMESA Indicates and TradesBoth Market ModesBoth Market Modes

Trade Trend when Kalman FilterLine fails to cross the InstantaneousTrendline within a half cycle

Trade the Sinewave Indicatorin the Cycle Mode

PredictionInstantaneous Trendlineis created by removing the dominant cycle

Page 9: TAOTN 2002

14

John EhlersJohn Ehlers

MESA Customer FeedbackMESA Customer Feedback

“ “The results I have achieved are very The results I have achieved are very impressive. In the course of my impressive. In the course of my investigations, I’ve discovered that most investigations, I’ve discovered that most stocks can be traded in the cycle-mode *OR* stocks can be traded in the cycle-mode *OR* trend-mode - rarely both.”trend-mode - rarely both.”

Peter S. CampbellPeter S. Campbell

Page 10: TAOTN 2002

15

John EhlersJohn Ehlers

MESA Can Improve Even the Best MESA Can Improve Even the Best Indicators by Making Them Adaptive Indicators by Making Them Adaptive

Page 11: TAOTN 2002

16

John EhlersJohn Ehlers

Basic Technical ToolsBasic Technical Tools

• Moving AveragesMoving Averages– Smooth the dataSmooth the data– Analogous to the Integral in CalculusAnalogous to the Integral in Calculus

• Momentum Functions (Differences)Momentum Functions (Differences)– Sense rate of changeSense rate of change– Analogous to the Derivative in CalculusAnalogous to the Derivative in Calculus

• All indicators are combinations of these toolsAll indicators are combinations of these tools

Page 12: TAOTN 2002

17

John EhlersJohn Ehlers

Moving AveragesMoving Averages

1. Moving Averages smooth the function1. Moving Averages smooth the function

2. Moving Averages Lag by the center of gravity of the 2. Moving Averages Lag by the center of gravity of the observation windowobservation window

3. Using Moving Averages is always a tradeoff between 3. Using Moving Averages is always a tradeoff between smoothing and lagsmoothing and lag

Moving AverageLag

c.g.

Window

CONCLUSIONS:

Page 13: TAOTN 2002

18

John EhlersJohn Ehlers

Momentum FunctionsMomentum Functions

1. Momentum can NEVER lead the function1. Momentum can NEVER lead the function

2. Momentum is always more disjoint (noisy)2. Momentum is always more disjoint (noisy)

CONCLUSIONS:

T = 0

RAMP

STEP

IMPULSE

JERK

FUNCTION

1st derivative(Momentum)

2nd derivative(Acceleration)

3rd derivative

Page 14: TAOTN 2002

19

John EhlersJohn Ehlers

FIR FiltersFIR Filters

Page 15: TAOTN 2002

20

John EhlersJohn Ehlers

Frequency is the Reciprocal of Cycle PeriodFrequency is the Reciprocal of Cycle Period

• Must have at least 2 samples per cycleMust have at least 2 samples per cycle– Nyquist CriteriaNyquist Criteria

• Shortest period allowed is a 2 bar cycleShortest period allowed is a 2 bar cycle– This is the Nyquist FrequencyThis is the Nyquist Frequency

• Normalized frequency is 2 / PeriodNormalized frequency is 2 / Period

AliasAlias

CorrectCorrect

Page 16: TAOTN 2002

21

John EhlersJohn Ehlers

FIR FiltersFIR Filters

Symmetrical FIR Filter Lag is (N - 1) / 2 for all frequencies

Simple 4 bar moving averagewhere a = [1 1 1 1] / 4

Delay is 1.5 barsNotches out 2 & 4 bar cycles

Tapering the coefficients reduces the sidelobe amplitude

For a 3 tap filterwhere a = [ 1 2 1] / 4

Delay is 1 barNotches out only a 2 bar cycle

Page 17: TAOTN 2002

22

John EhlersJohn Ehlers

Special FIR Filters of Interest to TradersSpecial FIR Filters of Interest to Traders

Four tap filtera = [1 2 2 1] /6

lag is 1.5 barsnotches 2 & 3 bar cycles

Five tap filtera = [1 2 3 2 1] /9

lag is 2 barsnotches only 3 bar cycle

Six tap filtera = [1 2 3 3 2 1] /12

lag is 2.5 barsnotches 2, 3, & 4 bar cycles

Page 18: TAOTN 2002

23

John EhlersJohn Ehlers

Isolating the Cycle ComponentIsolating the Cycle Component

Create a Bandpass filterLow Pass for SmoothingHigh Pass to remove the Trend

Method: Take a two bar momentum of a 6 bar Tapered FIR Filter

[1 2 3 3 2 1] / 12 -[1 2 3 3 2 1] / 12

[1 2 2 1 -1 -2 -2 -1] / 12

Page 19: TAOTN 2002

24

John EhlersJohn Ehlers

How the Cycle Component LooksHow the Cycle Component Looks

Page 20: TAOTN 2002

25

John EhlersJohn Ehlers

Capture the Cycle Turning PointsCapture the Cycle Turning Pointswith the Cycle Delayed One Barwith the Cycle Delayed One Bar

Page 21: TAOTN 2002

26

John EhlersJohn Ehlers

Cycle Does Not Require Cycle Does Not Require Adjustable ParametersAdjustable Parameters

Page 22: TAOTN 2002

27

John EhlersJohn Ehlers

Fisher TransformationFisher Transformation

Page 23: TAOTN 2002

28

John EhlersJohn Ehlers

Many Indicators Assume a Many Indicators Assume a Normal Probability DistributionNormal Probability Distribution

• Example - CCIExample - CCI– by Donald Lambert in Oct 1980 Futures Magazineby Donald Lambert in Oct 1980 Futures Magazine

• CCI = (Peak Deviation) / (.015* Mean Deviation)CCI = (Peak Deviation) / (.015* Mean Deviation)• Why .015?Why .015?

– Because 1 / .015 = 66.7Because 1 / .015 = 66.7– 66.7 is (approximately) one standard deviation66.7 is (approximately) one standard deviation

• IF THE PROBABILITY DENSITY IF THE PROBABILITY DENSITY FUNCTION IS NORMALFUNCTION IS NORMAL

Page 24: TAOTN 2002

29

John EhlersJohn Ehlers

What are Probability Density Functions?What are Probability Density Functions?

A Square Wave only has two values

A Square Wave is untradeable with conventionalIndicators because the switch to the other value has occurred before action can be taken

A PDF can be created by making the waveformwith beads on parallel horizontal wires. Then,turn the frame sideways to see how the beadsstack up.

A Sinewave PDF is not much different froma Squarewave PDF

Probably one reason why trading cycles hassuch a bad reputation.

Page 25: TAOTN 2002

30

John EhlersJohn Ehlers

The Fisher Transform Generates Waves The Fisher Transform Generates Waves Having Nearly a Normal PDFHaving Nearly a Normal PDF

• Y = .5*ln((1 + X) / (1 - X))Y = .5*ln((1 + X) / (1 - X))

where -1 <= X <= 1where -1 <= X <= 1

Page 26: TAOTN 2002

31

John EhlersJohn Ehlers

Fisher Transform Converts a Fisher Transform Converts a Sinewave PDF to a Normal PDFSinewave PDF to a Normal PDF

Page 27: TAOTN 2002

32

John EhlersJohn Ehlers

Real World Fisher Transform PDFsReal World Fisher Transform PDFs

12 Year PDF ofTreasury Bond Futures

Fisher Transform PDF of12 Year Treasury Bond Data

Page 28: TAOTN 2002

33

John EhlersJohn Ehlers

Fisher Transform Code is SimpleFisher Transform Code is Simple

• Compute Normalized Price ChannelCompute Normalized Price Channel• Apply TransformApply Transform

Inputs: Price((H+L)/2),Len(5);

Vars: MaxH(0),MinL(0),Fish(0);

MaxH = Highest(Price, Len);MinL = Lowest(Price, Len);

Value1 = .33*2*((Price - MinL)/(MaxH - MinL) - .5) + .67*Value1[1];If Value1 > .999 then Value1 = .999;If Value1 < -.999 then Value1 = -.999;

Fish = .5*Log((1 + Value1)/(1 - Value1)) + .5*Fish[1];

Plot1(Fish, "Fisher");Plot2(Fish[1], "Trigger");

Page 29: TAOTN 2002

34

John EhlersJohn Ehlers

Fisher Transform Turning Points are Fisher Transform Turning Points are Sharper and Have Less LagSharper and Have Less Lag

Page 30: TAOTN 2002

35

John EhlersJohn Ehlers

Fisher Transform Channel Has Fewer Whipsaws Fisher Transform Channel Has Fewer Whipsaws Than StochasticRSIThan StochasticRSI

Page 31: TAOTN 2002

36

John EhlersJohn Ehlers

Fisher Transform Can Sharpen the Fisher Transform Can Sharpen the Real StochasticRSI Turning PointsReal StochasticRSI Turning Points

Page 32: TAOTN 2002

37

John EhlersJohn Ehlers

ConclusionsConclusions

• The Drunkard’s Walk is the underpinning for The Drunkard’s Walk is the underpinning for identifying inefficiencies in the Trend Mode and identifying inefficiencies in the Trend Mode and Cycle ModeCycle Mode

• You have seen how MESA trades both ModesYou have seen how MESA trades both Modes• Your indicators and systems can be improved by Your indicators and systems can be improved by

making them adaptive to the measured cyclesmaking them adaptive to the measured cycles• You have Simple FIR Filters for data smoothing in You have Simple FIR Filters for data smoothing in

your Toolboxyour Toolbox– You have a simple way to see the Cycle ComponentYou have a simple way to see the Cycle Component

• You can more accurately identify turning points by You can more accurately identify turning points by modifying the PDF using the Fisher Transformmodifying the PDF using the Fisher Transform