john ehlers 1 anticipating turning points left-brained concepts for traders in their right minds

31
1 John Ehlers John Ehlers ANTICIPATING TURNING POINTS ANTICIPATING TURNING POINTS Left-Brained Concepts Left-Brained Concepts for Traders in for Traders in their Right Minds their Right Minds

Upload: nora-deal

Post on 13-Dec-2015

223 views

Category:

Documents


5 download

TRANSCRIPT

1

John EhlersJohn Ehlers

ANTICIPATING TURNING POINTSANTICIPATING TURNING POINTS

Left-Brained Concepts Left-Brained Concepts for Traders in their Right Minds for Traders in their Right Minds

2

John EhlersJohn Ehlers

This Webinar is an excerpt from my Runner Up Paper for the This Webinar is an excerpt from my Runner Up Paper for the 2008 MTA Charles H. Dow Award2008 MTA Charles H. Dow Award

www.mta.orgwww.mta.orgActivities Tab – Charles H. Dow AwardActivities Tab – Charles H. Dow Award

alsoalsowww.stockspotter.comwww.stockspotter.com

Help / FunStuff / For Math Geeks Only / Technical PapersHelp / FunStuff / For Math Geeks Only / Technical Papers

The webinar slides (including code) can be found at:The webinar slides (including code) can be found at:www.stockspotter.comwww.stockspotter.com

Help / FunStuff / For Math Geeks Only / WebinarsHelp / FunStuff / For Math Geeks Only / Webinars

3

John EhlersJohn Ehlers

• This webinar can be used at several levels:This webinar can be used at several levels:

1)1) Just apply the concepts to conventional indicatorsJust apply the concepts to conventional indicators

2)2) Gain a deeper understanding of how indicators Gain a deeper understanding of how indicators work.work.

3)3) Apply detailed code to improve the performance of Apply detailed code to improve the performance of your indicatorsyour indicators

4

John EhlersJohn Ehlers

Normal (Gaussian) Probability Distribution Function (PDF) Normal (Gaussian) Probability Distribution Function (PDF) is Commonly Assumed for Market Datais Commonly Assumed for Market Data

0

0.05

0.1

0.15

0.2

0.25

0.3

-3

-2.8

-2.6

-2.4

-2.2 -2

-1.8

-1.6

-1.4

-1.2 -1

-0.8

-0.6

-0.4

-0.2 -0 0.2

0.4

0.6

0.8 1

1.2

1.4

1.6

1.8 2

2.2

2.4

2.6

2.8 3

Normal PDF Cumulative Normal PDF

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

-3

-2.8

-2.6

-2.4

-2.2 -2

-1.8

-1.6

-1.4

-1.2 -1

-0.8

-0.6

-0.4

-0.2 -0 0.2

0.4

0.6

0.8 1

1.2

1.4

1.6

1.8 2

2.2

2.4

2.6

2.8 3

0 = 50%+1 = 85%+2 = 98%+3 = 99.9%

2

2

2

2

x

eP

Normal PDF is attractive because it can be achieved using several random variables due to the central limit theorem

But is Normal the right PDF for market data?

5

John EhlersJohn Ehlers

CONSIDER A THEORETICAL SQUAREWAVECONSIDER A THEORETICAL SQUAREWAVE

-1.5

-1

-0.5

0

0.5

1

1.5

Square Wave Binary PDF of Square Wave

A Square Wave cannot be traded with conventional indicators because the move is over before any indicator can show the move

6

John EhlersJohn Ehlers

NEXT - CONSIDER A SINEWAVENEXT - CONSIDER A SINEWAVE

-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Sine Wave Sine Wave PDF

The Probability Distribution of a Sinewave is similar to that of a Squarewave

This is why most traders have trouble trading with cycles

The cyclic turning point must be anticipated

7

John EhlersJohn Ehlers

How Do We Determine the Market PDF?How Do We Determine the Market PDF?

-1-0.9-0.8-0.7-0.6-0.5-0.4-0.3-0.2-0.1

00.10.20.30.40.50.60.70.80.9

1

Create the waveform bystringing beads on a horizontal wire frame

Rotate wire frame toenable beads to stack up

Height of the beadstacks is the PDFof the Waveform

8

John EhlersJohn Ehlers

Channel Limited PDF Generator CodeChannel Limited PDF Generator Code

Inputs:Length(20);

Vars:HH(0),LL(0),I(0);

Arrays:Filt[2000](0),Bin[100](0);

HH = Close;LL = Close;For I = 0 to Length -1 Begin

If Close[I] > HH then HH = Close[I];If Close[I] < LL then LL = Close[I];

End;If HH <> LL Then Value1 = (Close - LL) / (HH - LL);Filt[CurrentBar] = (Value1 + 2*Value1[1] + Value1[2]) / 4;For I = 0 to 100 Begin

If Filt[CurrentBar] >= I/100 and Filt[CurrentBar] < (I + 1)/100 Then Bin[I] = Bin[I]+1;End;For I = 0 to 99 Begin

Print(File("c:\tsgrowth\pdf.csv"), I, ",", Bin[I]);End;Plot1(Filt[CurrentBar]);

9

John EhlersJohn Ehlers

Channel PDF for Treasury BondsChannel PDF for Treasury Bonds

Clearly, Channel Limited Detrending produces Sinewave-Like PDFs

20 Bar Channel over 30 Years

40 Bar Channel over 30 Years

10

John EhlersJohn Ehlers

SPY for Last Five YearsSPY for Last Five Years

MESA-Measured Cycles ExistMESA-Measured Cycles ExistCycle Periods VaryCycle Periods Vary

11

John EhlersJohn Ehlers

CONVINCED THERE ARE TRADEABLE CYCLES?CONVINCED THERE ARE TRADEABLE CYCLES?

• Market Cycles have been measuredMarket Cycles have been measured– With Probability Distribution FunctionsWith Probability Distribution Functions– With Spectral AnalysisWith Spectral Analysis

• Trading with Cycles is difficult because the Trading with Cycles is difficult because the turning points turning points MUSTMUST be anticipated be anticipated– Common Indicators applied with conventional Common Indicators applied with conventional

wisdom are basically useless because of lagwisdom are basically useless because of lag

12

John EhlersJohn Ehlers

Probability Distribution Varies with DetrendingProbability Distribution Varies with Detrending

• Channel Limited detrending (Stochastic) generally yields PDFs Channel Limited detrending (Stochastic) generally yields PDFs similar to the PDF of a Sine Wavesimilar to the PDF of a Sine Wave

• Two more detrending approaches will be described where that Two more detrending approaches will be described where that is not necessarily trueis not necessarily true

– HighPass FilteringHighPass Filtering

– RSI RSI

13

John EhlersJohn Ehlers

Highpass Filter PDF Generator CodeHighpass Filter PDF Generator Code

Inputs:HPPeriod(40);

Vars:alpha(0), HP(0), HH(0), LL(0), Count(0), Psn(0), I(0);

Arrays:Bin[100](0);

alpha = (1 - Sine (360 / HPPeriod)) / Cosine(360 / HPPeriod);HP = .5*(1 + alpha)*(Close - Close[1]) + alpha*HP[1];IF CurrentBar = 1 THEN HP = 0;If CurrentBar > HPPeriod Then Begin

HH = HP;LL = HP;For Count = 0 to HPPeriod -1 Begin

If HP[Count] > HH Then HH = HP[Count];If HP[Count] < LL Then LL = HP[Count];

End;If HH <> LL Then Value1 = 100*(HP - LL) / (HH - LL);Psn = (Value1 + 2*Value1[1] + Value1[2]) / 4;

For I = 1 to 100 BeginIf Psn > I - 1 and Psn <= I Then Bin[I] = Bin[I] + 1;

End;Plot1(Psn);

End;If LastBarOnChart Then Begin

For I = 1 to 99 BeginPrint(File("C:\TSGrowth\PDF_HP.CSV"), I, ",", Bin[I]);

End;End;

14

John EhlersJohn Ehlers

HP Filtered PDF for Treasury BondsHP Filtered PDF for Treasury Bonds

40 Bar Cutoff over 30 Years

PDFs produced by filtering have nearly uniform probability

15

John EhlersJohn Ehlers

MyRSI PDF Generator CodeMyRSI PDF Generator Code

Inputs:Length(10);

Vars:CU(0), CD(0), I(0), MyRSI(0), Psn(0);

Arrays:Bin[100](0),PDF[100](0);

If CurrentBar > Length Then BeginCU = 0;CD = 0;For I = 0 to Length -1 Begin

If Close[I] - Close[I + 1] > 0 Then CU = CU + Close[I] - Close[I + 1];If Close[I] - Close[I + 1] < 0 Then CD = CD + Close[I + 1] - Close[I];

End;If CU + CD <> 0 Then MyRSI = 50*((CU - CD) / (CU + CD) + 1);Psn = (MyRSI + 2*MyRSI[1] + MyRSI[2]) / 4;For I = 1 to 100 Begin

If Psn > I - 1 and Psn <= I Then Bin[I] = Bin[I] + 1;End;

End;If LastBarOnChart Then Begin

For I = 1 to 99 BeginPrint(File("C:\TSGrowth\PDF_RSI.CSV"), I, ",", PDF[I]);

End;End;

16

John EhlersJohn Ehlers

MyRSI PDF for Treasury BondsMyRSI PDF for Treasury Bonds

10 Bar RSI over 30 Years

RSI Detrending yields PDFs that appear Gaussian-Like

17

John EhlersJohn Ehlers

RSI PDF Suggests a Trading StrategyRSI PDF Suggests a Trading Strategy

• The RSI PDF appears to be Gaussian-LikeThe RSI PDF appears to be Gaussian-Like• Probability of events at the amplitude Probability of events at the amplitude

extremes are very lowextremes are very low• Strategy is based on the higher probability of Strategy is based on the higher probability of

prices reversing prices reversing – Sell Short when prices cross over some upper Sell Short when prices cross over some upper

thresholdthreshold– Buy when prices cross under some lower Buy when prices cross under some lower

thresholdthreshold

• Note! This strategy is NOT the same as Note! This strategy is NOT the same as conventional RSI trading systems – we are conventional RSI trading systems – we are anticipating the turning points before they anticipating the turning points before they happen.happen.

18

John EhlersJohn Ehlers

RSI StrategyRSI Strategy

• Compute RSICompute RSI• Buy when RSI crosses below 30%Buy when RSI crosses below 30%• Sell when RSI crosses above 70%Sell when RSI crosses above 70%

• Conventional RSI waits for confirmation:Conventional RSI waits for confirmation:– Buy when RSI crosses above 20% (delays entry)Buy when RSI crosses above 20% (delays entry)– Sell when RSI crosses below 80% (delays entry)Sell when RSI crosses below 80% (delays entry)

19

John EhlersJohn Ehlers

Fisher TransformFisher Transform

A PDF of virtually any processed data can be A PDF of virtually any processed data can be converted to a Normal PDF using the Fisher converted to a Normal PDF using the Fisher TransformTransform

20

John EhlersJohn Ehlers

Fisher TransformFisher Transform

A Fisher Transform has no lag – it expands range near the endpointsA Fisher Transform has no lag – it expands range near the endpoints

x

xy

1

1ln*5.0

21

John EhlersJohn Ehlers

Fisherized PDF for Treasury BondsFisherized PDF for Treasury Bonds

Fisherized Detrended Signal Over 30 Years

The Fisher Transform enables the use of the same kind of strategy as beforeWhere we reverse position when extreme amplitude thresholds are exceeded

(Slide 14)

22

John EhlersJohn Ehlers

Fisher Transform SystemFisher Transform System

• Highpass Filter pricesHighpass Filter prices• Normalize between -.999 and +.999 using a Normalize between -.999 and +.999 using a

Stochastic-like approachStochastic-like approach• Buy when transformed prices cross below an Buy when transformed prices cross below an

optimizable lower boundoptimizable lower bound• Sell when transformed prices cross above an Sell when transformed prices cross above an

optimizable lower bound optimizable lower bound

23

John EhlersJohn Ehlers

TRADING SYSTEM RESULTSTRADING SYSTEM RESULTS

24

John EhlersJohn Ehlers

RSI Trading System ResultsRSI Trading System Results

• @SP.P for the life of the contract (from April 1982)@SP.P for the life of the contract (from April 1982)• 745 Trades (about once every two weeks)745 Trades (about once every two weeks)• 65.4% Profitable Trades65.4% Profitable Trades• Profit Factor = 1.65Profit Factor = 1.65

The strategy is robust across the entire life of the contract!

25

John EhlersJohn Ehlers

CONVENTIONAL RSI @SP.P EQUITYCONVENTIONAL RSI @SP.P EQUITY

Waiting for confirmation is not a good plan!

26

John EhlersJohn Ehlers

Fisher Transform System ResultsFisher Transform System Results

• @SP.P for the life of the contract (from April 1982)@SP.P for the life of the contract (from April 1982)• 574 Trades (about 2.5 weeks per trade)574 Trades (about 2.5 weeks per trade)• 66.7% Profitable Trades66.7% Profitable Trades• Profit Factor = 1.55Profit Factor = 1.55

The strategy is robust across the entire life of the contract!

27

John EhlersJohn Ehlers

BandPass Filter Trading System ResultsBandPass Filter Trading System Results

The strategy is reasonably robustProving that anticipating turning points works

Bandpass Filtered Signal Anticipates Turning Points

28

John EhlersJohn Ehlers

TRADING STRATEGY COMMENTSTRADING STRATEGY COMMENTS

• The concepts are provided for educational The concepts are provided for educational purposes onlypurposes only

• There was no allowance for slippage and There was no allowance for slippage and commissioncommission

• Results were shown using in-sample Results were shown using in-sample optimizationoptimization

• No stops or disaster reversals were usedNo stops or disaster reversals were used• The strategies are not adaptive to current The strategies are not adaptive to current

market conditionsmarket conditions

29

John EhlersJohn Ehlers

REAL WORLD CONSIDERATIONSREAL WORLD CONSIDERATIONS

• Trading results must be viewed “out-of-sample” Trading results must be viewed “out-of-sample” to ensure realistic evaluationto ensure realistic evaluation

• No single trading strategy will work in all market No single trading strategy will work in all market conditionsconditions– A combination of strategies are needed to ensure A combination of strategies are needed to ensure

robustnessrobustness

• All entries and exits should be made on the All entries and exits should be made on the open of the bar following the signalopen of the bar following the signal– Stop and Limit orders give unrealistic expectations Stop and Limit orders give unrealistic expectations

due to slippagedue to slippage

30

John EhlersJohn Ehlers

WWW.STOCKSPOTTER.COMWWW.STOCKSPOTTER.COM

• StockSpotter uses these principles to StockSpotter uses these principles to generate daily trading signals for over 3000 generate daily trading signals for over 3000 stocksstocks

• StockSpotter uses an overarching algorithm StockSpotter uses an overarching algorithm to select only the highest probability trades.to select only the highest probability trades.

• All StockSpotter results are verifiable.All StockSpotter results are verifiable.• View StockSpotter results for FREE View StockSpotter results for FREE • I offer a “30 days for 30 dollars” introductory I offer a “30 days for 30 dollars” introductory

price. Use promo code MESA311 to get a price. Use promo code MESA311 to get a 20% discount thereafter ($95 per month).20% discount thereafter ($95 per month).– Seminar Promotion valid until 1 April 2011Seminar Promotion valid until 1 April 2011

31

John EhlersJohn Ehlers

THANK YOU FOR ATTENDING THIS WEBINARTHANK YOU FOR ATTENDING THIS WEBINAR

QUESTIONS?QUESTIONS?