64
Tutorial on Trading System Design & Implementation 1

Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

Tutorial on Trading System Design & Implementation

1

Page 2: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

Introduction

• After 30 years of trading and research, Sunny

Harris has developed many strategies both for

herself and for clients.

• More important than developing the strategies,

Sunny has developed testing methodologies that

have stood the test of time, and have become the

defacto standard in the trading community. In this

webinar Sunny will share some of her more

important testing strategies, and reveal some of the

tricks advertisers use to lure unsuspecting buyers

with backtesting.

2

Page 3: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

1996-2012 Sunny Harris Enterprises, Inc.

1547 Mission Meadows Dr., Oceanside, CA 92057

Phone 1.760.908.3070 • Fax 1.760.859.3057

email: [email protected]

skype: 1.760.444.4174

3

Page 4: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

Disclaimers

SUNNY J. HARRIS AND SUNNY HARRIS ENTERPRISES, INC. ACCEPTS NO LIABILITY

WHATSOEVER FOR ANY LOSS ARISING FROM ANY USE OF THIS INFORMATION. THIS

INFORMATION IS FOR EDUCATION ONLY.

This information is in no way a representation to buy or sell securities, bonds, options or futures.

ALWAYS CHECK WITH YOUR LICENSED FINANCIAL PLANNER OR BROKER BEFORE BUYING OR

SELLING ON ANY ADVICE WHETHER CONTAINED HEREIN OR ELSEWHERE.

It should not be assumed that the methods, techniques, or indicators presented in this book will be

profitable or that they will not result in losses. Past results are not necessarily indicative of future results.

Examples and methods in this book are for educational purposes only. This is not a solicitation of any

offer to buy or sell.

TRADING AND INVESTING ARE SPECULATIVE AND INCLUDE RISK OF LOSS. PAST

PERFORMANCE IS NO INDICATION OF FUTURE RESULTS.

HYPOTHETICAL OR SIMULATED PERFORMANCE RESULTS HAVE CERTAIN INHERENT

LIMITATIONS. UNLIKE AN ACTUAL PERFORMANCE RECORD, SIMULATED RESULTS DO NOT

REPRESENT ACTUAL TRADING. ALSO, SINCE THE TRADES MAY NOT HAVE BEEN EXECUTED,

THE RESULTS MAY HAVE UNDER- OR OVER-COMPENSATED FOR THE IMNPACT, IF ANY, OF

CERTAIN MARKET FACTORS, SUCH AS LACK OF LIQUIDITY. SIMULATED TRADING PROGRAMS

IN GENERAL ARE ALSO SUBJECT TO THE FACT THAT THEY ARE DESIGNED WITH THE

BENEFIT OF HINDSIGHT. NO REPRESENTATION IS BEING MADE THAT ANY ACCOUNT WILL OR

IS LIKELY TO ACHIEVE PROFITS OR LOSSES SIMILAR TO THOSE SHOWN.

Any statement of facts herein contained are derived from sources believed to be reliable, but are not

guaranteed as to accuracy, nor do they purport to be complete. No responsibility is assumed with

respect to any such statement, nor with respect to any expression of opinion herein contained. All trade

recommendations should be discussed with your broker and made at your own risk.

4

Page 5: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

1. Overview & Preparation

• Questionnaire

• Vocabulary

• Exchanges

• Psychology Questions

• Must Read Reading List

5

Page 6: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

MUST Reading List for Beginners

• Technical Analysis of the Futures Markets (by John Murphy)

• Technical Analysis from A to Z (by Steven Achelis)

• The Ultimate Mutual Fund Guide (by Warren Boroson)

• A Short History of Financial Euphoria (by John Kenneth Galbraith)

• Technical Analysis of Stock Trends

• The Encyclopedia of Technical Market Indicators

• Technical Analysis of Stocks, Options & Futures

• Options as a Strategic Investment (by Lawrence McMillan)

• Economics (A Self-Teaching Guide)

• Strategic Investment Timing (by Dick A. Stoken)

• Understanding Stock Options & Futures Markets

• Wall Street Journal Guide to Understanding Money & Markets

• The Great Crash 1929

• Computerized Investing

• Economic Analysis: Theory & Application

• The Intelligent Investor (by Benjamin Graham)

• Money Guide: The Stock Market

• Keys to Understanding the Financial News

• Contrary Investing

• Principles of Economics

6

Page 7: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

Let’s Discuss You Computer Know-How

• What is your level of expertise?

• What are your fears?

7

Page 8: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

Overview 1-10

1. OVERVIEW & PREPARATION

2. BASIC MATHEMATICS

3. CHARTING TECHNIQUES

4. SYMBOLIC LOGIC & PROGRAMMING SKILLS

5. TECHNICAL ANALYSIS

6. POTENTIAL HOURLY WAGE ANALYSIS

7. SOFTWARE FOR TRADING & TESTING

8. DESIGNING YOUR SYSTEM

9. SPECIFYING YOUR RULES

10. PROGRAMMING YOUR SYSTEM

8

Page 9: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

Overview 11-20

11. TESTING YOUR SYSTEM

12. OPTIMIZATION WITHOUT CURVE FITTING

13. EVALUATING YOUR SYSTEM’S POTENTIAL

14. MONEY & RISK MANAGEMENT

15. BUSINESS PLAN DEVELOPMENT

16. EASYLANGUAGE

17. STATISTICAL ASSURANCE

18. MONITORING YOUR PERFORMANCE

19. WHAT IF YOUR SYSTEM FAILS?

20. LET’S BEGIN TRADING

9

Page 10: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

2. Basic Mathematics

• Introduction

• Bar Formation

– Bars Ago

• Parentheses

• Order of Priority

• Decimals and Fractions

• Percentages

– PHW

• Ratios & Proportions

• Performance Summary

10

Page 11: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

2: Introduction

• What we’ll talk about

• I know you already know math

• This is different

• Please don’t think I’m trying to insult you,

just bare with me

11

Page 12: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

2: Bar Formation (Bars Ago)

12

0 1

2

3

5 4 6 7 8

Page 13: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

2. Bar Formation

• Close = Close[0] = C //all mean the

close of the bar in current formation

• C[2] = Close[2] //all mean the closing

price of 2 bars ago

13

Page 14: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

2: Parentheses

• X = 3 + 4 * 5

• X = ( 3 + 4 ) * 5 = 35

• X = 3 + ( 4 * 5 ) = 23

• True or False and True

• (True) or (False and True)

• (True or False) and True

• CLOSE + OPEN / 2

• ( CLOSE + OPEN ) / 2

14

Page 15: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

2: Order of Priority

• parentheses

• exponentiation

• multiplication and division

• addition and subtraction

• < , >, = , <= , >= , <>

• AND

• OR

15

Page 16: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

2: Decimals & Fractions

16

Page 17: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

2: Percentages

• If you are interested in futures trading, or if you have a

large equity account and want to trade it on margin,

you’ll want to know about percentages.

• If your equity account is backed by another account or

by a cash instrument, your broker may let you use that

cash value to leverage your equity account. You will

need to be able to figure percentages if you use

margin for your equity account.

• If the stock price goes up to $25 (and we’ll ignore

commission for this exercise), what percentage profit

have you made on your investment? We figure this

on the cash outlay, not on the total account value.

Thus, you would have made a $5 profit per share on

1,000 shares with a $10,000 investment.

• That’s ( 5 * 1,000 )/10,000 = 5,000/10,000 = 5/10 = ½

or 50%. Wow!

17

Page 18: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

2: Ratios & Proportions

• Formally, a ratio is the comparison by division of two

quantities expressed in the same units. That just

means that first of all, you can’t compare apples and

oranges. But, secondly that you divide one number by

the other to get a ratio. Why bother, when you could

just have easily stayed with percentages? Sometimes

ratios present the information to you more visually.

For instance, if you have a system where the ratio of

wins to losses is 4, you know right away that on

average each win will be 4 times as large as each

loss. Sure, you could have said you had a system

where each win was 400% of each loss, but it just

doesn’t ring as intuitively.

18

Page 19: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

2: Performance Summary

• View g Strategy Performance Report

19

Page 20: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

2: Strategy Performance Report

• Several Pages

20

Page 21: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

2: Strategy Performance Report

21

• There are (at this writing) 7 tabs in the

report.

• Each one shows you statistics from a

different perspective.

• Don’t be afraid to click on each one and

see what you get

Page 22: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

2: Interpret This

• INPUTS: FASTMA(9), SLOWMA(18);

• VALUE1=AVERAGE(C,FASTMA);

• VALUE2=AVERAGE(C,SLOWMA);

• VALUE2=VALUE2/3;

• VALUE2=INTPORTION(VALUE2);

22

Page 23: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

3: CHARTING TECHNIQUES

• Required Reading for this Lesson:

– John Murphy’s “Technical Analysis of the

Financial Markets”

– Edwards & Magee “Technical Analysis of

Stock Trends”

– Chart Patterns (Bloomberg)

– Steve Achelis’s “Technical Analysis from A to

Z”

– Perry Kaufman’s “New Trading Systems &

Methods”

23

Page 24: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

3. CHARTING TECHNIQUES

• Introduction

• Technical vs Fundamental Analysis

• What Is Your Goal?

• Specific Techniques

• Q1: 1-min, 5-min, 15-min, 30-min, 60-min,

daily charts Print Out – Mark the Technical Analysis patterns you see on each of the charts.

– Mark Support and Resistance on each of the charts

– Go back to TradeStation and put 3 different moving averages on each

chart:

• Simple

• Exponential

• Weighted

24

Page 25: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

3. Charting Techniques

• Q1 Continued:

– Then make notes of the differences between

the averages. Which one is more accurate?

– Does the more accurate average have any

disadvantages you can see?

– Mark the “perfect” entries and exits on each

chart

– Calculate the potential profit and loss from

each of the ideal trades on each chart

25

Page 26: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

3. Charting Techniques

• Q2: – Let’s go with the 15-minute chart for now, of the same

symbol you chose above.

– Print out charts for each of the following types of bars:

– Standard OHLC bar chart

– Candlesticks

– Point & Figure

– Line Chart

Line charts require only closing prices to plot, whereas Candlesticks require all

four pieces of pricing information--open, high, low, and close. And as their

names imply, Equivolume or Candlevolume incorporate volume into the price

plot. These last two kinds of chart are not available in TradeStation unless you

purchase a special indicator to display them. I have just such an indicator, called

SunnyBars, if you are interested. Check the Products page of

www.moneymentor.com to take a look at SunnyBars and how volume is

incorporated into the width of each bar.

26

Page 27: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

3: Support & Resistance

• Support is the level under current

market price where buyers come in and

cause prices to cease falling. Buyers

see the support level as a good price at

which to purchase (a good deal).

• Resistance is the level at which the

market is too expensive. Resistance is

the price level above current market

price where buyers hesitate to buy. At

this level selling pressure overcomes

buying pressure.

27

Page 28: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

3: Floor Trader Pivots

• Look at EasyLanguage Code for Floor

Trader Pivots

• In the standard package

• Be able to explain the essence of the code

to me on our next visit

28

Page 29: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

3: Channels

• Channels are formed when prices go

back and forth between loosely defined

price points. I say “loosely defined”

because in real life the channels are

not so clear to see. They tend to break

tops and bottoms and then return to the

channel anyway. And they are often

not horizontal, but are curved or

sloping.

29

Page 30: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

3: Attractors

• I coined my own term for areas where

price tends to come back to with

relative frequency. I call these areas

ATTRACTORS. Attractors can be

formed by moving averages, by

support and resistance, by channels,

etc.

30

Page 31: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

3: Attractors

• Horizontal Lines drawn carefully. Discuss.

31

Page 32: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

3: Attractors

• Moving Averages. Discuss.

32

Page 33: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

3: Attractors

• Fibonacci Retracements & Extensions.

33

Page 34: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

3: Triangles, Wedges, Pennants

• Read appropriate section of Perry

Kaufman

34

Page 35: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

3: More Congestion Patterns

35

Page 36: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

3: More Congestion Patterns

36

Page 37: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

3: More Congestion Patterns

37

Page 38: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

3: Sunny’s Pennants Indicator

• Shows Congestion of all kinds.

38

Page 39: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

3: After congestion comes the BIG move

• Take a look again

39

Page 40: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

3: Head & Shoulders

40

Page 41: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

4. SYMBOLIC LOGIC & PROGRAMMING

• Required Reading for this Lesson:

• Introduction to Symbolic Logic (Karl J.

Smith)

41

Page 42: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

Boolean Algebra

• Boolean Algebra

• AND and OR

– Link two or more comparisons

• Evaluating “truth tables”

• Mathematicians use shorthand

– ^ means AND

– v means OR

• Complex Expressions

– (( A ^ B ) v ( C v D)) ^ E

42

Page 43: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

Truth Tables

43

Page 44: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

5. Technical Analysis

44

Page 45: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

6. Potential Hourly Wage Analysis

45

Page 46: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

7. Software for Trading & Testing

46

Page 47: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

8. Designing Your System

47

Page 48: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

9. Specifying Your Rules

48

Page 49: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

10. Programming Your System

49

Page 50: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

11. Testing Your System

50

Page 51: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

12. Optimization Without Curve Fitting

51

Page 52: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

13. EVALUATING YOUR SYSTEM’S

POTENTIAL

• Statistics that matter

– Total net profit

– Drawdown

– Number of trades

– Profit per trade

• CPC Index Components

– %P

– R

– PF

• Equity Curve

• Drawdown

• Maximum Adverse Excursion

• VAMI

52

Page 53: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

13: Equity Curve

• How smooth is it?

• How is the

drawdown?

53

Page 54: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

54

Page 55: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

14. Money & Risk Management

55

Page 56: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

15. Business Plan Development

56

Page 57: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

16. EasyLanguage

57

Page 58: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

17. Statistical Assurance

58

Page 59: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

18. Monitoring Your Performance

59

Page 60: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

19. What If Your System Fails?

60

Page 61: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

20. Let’s Begin Trading

61

Page 62: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

APPENDIX

• Book List

• Glossary

• Exchanges

• Money Management

• Formulae

62

Page 63: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

Booklist

63

Page 64: Tutorial on Trading System Design & Implementation the Puzzle N… · – Standard OHLC bar chart – Candlesticks – Point & Figure – Line Chart Line charts require only closing

Glossary

64

Click to

download

the

Glossary in

pdf format.

You may

print it, or

save it.