Upload
others
View
0
Download
0
Embed Size (px)
Citation preview
Strategy Trading (In Four Parts)
SESSION 2
© 2012 Sunny J. Harris ALL RIGHTS RESERVED
Designing Your Strategy (or Evaluating Someone Else’s)
About Sunny Harris
• Trader for 30+ years
• BA, MS, PhD Mathematics
• Author of: – TradeStation Made Easy!
– Trading 101—How to Trade Like a Pro
– Trading 102—Getting Down to Business
– Electronic Day Trading 101
– Getting Started in Trading
• Working on Grading the Gurus
• See the Introduction in Session 1 for
more in-depth info
Designing Your Strategy
• or Evaluating Someone Else’s
• The BackTesting Engine
• What Is Possible?
• Can I Really Make That Much?
• Buying & Selling
• The Strategy Performance Report
Evaluating Someone Else’s
• Performance Statistics
• Testing by Thirds
• Optimizing
• Comfort Zones
• Log (or Lab) Book
• CPC Index
• Compare to Ideal PHW Indicator dots
Evaluating
• Doesn’t matter if it is Yours or
Someone Else’s
• The process is the same
Performance Summary Report
Solar_1 SP M7-15 min 04/16/97 - 05/14/97
Performance Summary: All Trades
Total net profit $ 22,200.00 Open position P/L $ 0.00
Gross profit $ 35,600.00 Gross loss $-13,400.00
Total # of trade 12 Percent profitable 50%
Number winning trades 6 Number losing trades 6
Largest winning trade $ 13750.00 Largest losing trade $ -3400.00
Average winning trade $ 5933.33 Average losing trade $ -2233.33
Ratio avg win/avg loss 2.66 Avg trade(win & loss) $ 1850.00
Max consec. winners 3 Max consec. losers 2
Avg # bars in winners 57 Avg # bars in losers 9
Max intraday drawdown $ -5700.00
Profit factor 2.66 Max # contracts held 1
Account size required $ 5700.00 Return on account 389%
Sunny’s CPC Index
• CPC Index =
Profit Factor *
Percent Profitable *
Ratio
• A “safe” system would have a CPC
Index >= 1.2
• Example from above SPR:
– CPC = 2.66 * 50% * 2.66 = 2.66
Measures of Risk
• Largest Winning Trade
• Largest Losing Trade
• Maximum Drawdown
• Time to Recovery
Drawdown
• High Water Marks
The BackTesting Engine
• BackTesting Assumptions
• LIBB: Look Inside Bar Backtesting
BackTesting Engine
BackTesting Engine
• Setting up an Optimization
Setting Up an Optimization
Setting Up an Optimization
Setting Up an Optimization
Setting Up an Optimization
Setting Up an Optimization
Setting Up an Optimization
• Set Final Value before Starting Value
Setting Up an Optimization
Setting Up an Optimization
Save the Optimization
• So it won’t disappear
• For use with Spreadsheet
• To find Comfort Zones
• Alligators and Islands
• As input to your LogBook
Thoroughness
• Can’t just try one dataset and one gigantic
optimization and that’s done
• No personal computer is large enough or
powerful enough to conduct millions of tests
• Doesn’t guarantee it will work in the future if
you have curve-fit the experiment
Testing By Thirds
• Conduct all tests on the middle third
• If it’s more data (farther back) still divide it
into thirds.
Testing by Thirds
• Once you find a RANGE of acceptable
results…
• Then, and only then, test the FIRST
third with those ranges of parameters,
• Then, apply those same ranges to the
LAST third of the data
• It seems tedious, but it is ESSENTIAL
• Applying your parameters to the LAST
third of the data is called FORWARD
testing
• Another way to forward test is…
Testing by Thirds
• Trade the system in real-time
• Or paper-trade (keep records) of how
the system works in real-time
• Wait 6 months and then test that
period with the identical parameters
Judicious Choice of Experiments
• Let’s say you have a system with
these input parameters, below
• (In fact, if you read
, by me, you will see this system
in the appendix)
• INPUTS: DATE1(960101),DATE2(1111231),Length1(3),Length
2(13), Leng(9), RSIleng(9),ADXswt(0), RSIswt(0),
jRSIOB(75), jRSIOS(25), xHR(180), yHR(60),
Dollars(100), LossL(100), LossS(100);
• There are 15 parameters in the input
list
Judicious Choice of Experiments
• To run an exhaustive test of these inputs,
using only 15 choices for each variable…
• We would have to run 15 quadrillion tests
• 15*15*15*15 … *15*15
• Is 1515
So what do we do?
• Take the most important input parameters
first
• Run an exhaustive test on those to find
acceptable ranges first
• Then try the next most important
parameters with only the range you found in
the first experiment
• And so on
• Or…
Genetic Testing
• Let MultiCharts make the decision of
what to test by checking the Genetic
Testing box
The first inputs
• Look at the inputs again • INPUTS:
DATE1(960101),DATE2(1111231),Length1(3),Length
2(13), Leng(9), RSIleng(9),ADXswt(0), RSIswt(0),
jRSIOB(75), jRSIOS(25), xHR(180), yHR(60),
Dollars(100), LossL(100), LossS(100);
• Date1 and Date2 are important
• They are for dividing tests into thirds
• It’s easier than changing the date
range of the symbol again and again
Tricks of the Trade
• In writing my next book ( ) I
recently bought a guru’s $500 system
• It was advertised to make something like
$10,000 in the last 4 months trading the
emini.
• Sounds great! Right?
• Wrong
• Here’s why…
Tricks of the Trade
• Here is the equity chart for the last 4
months:
• Looks pretty good!
Tricks of the Trade
• Here is the equity chart for the past 6
months:
Tricks of the Trade
• Here is the equity chart for the past
1 year:
Tricks of the Trade
• Here is the equity chart for the past 5
years:
Psychology Comes In
• Would you be able to trade a system
that made no money for 2 ½ years on end?
How About This Instead?
With This Kind of Equity Curve
Psychology
• A smooth equity curve makes the
psychology much easier to take
• Lee Gettes says, “If you have a losing
system, no amount of psychology will
help.” But when you have a winning
system, psychology becomes 100% of
the game.” (paraphrased).
Here’s Another Trick
• Many systems designers tout 80-90%
correct systems
• That is, systems where 80-90% of the
trades are winners.
• Designs like that are usually achieved
with very few trades, like 3-10, or with
systems that have very small wins
– For instance, see next slide
Here’s Another Trick
Looks Great! $500,000 profit.
Here’s Another Trick
Here’s Another Trick
How Much Is Enough?
• How Do You Know Whether Your Test
Generates Enough Profit?
• What is Possible?
• Should your chart generate $50,000 or
$100,000 or $500,000?
How Much Is Enough?
• That problem always perplexed me
• Until
• I invented an indicator to tell me
• On any chart, any time frame, any
symbol
• I call it PHW (for Potential Hourly
Wage)
• Here’s how it looks:
PHW Indicator at 0.01
How Much Is Enough?
• This is one of the most important
indicators in all of my work
• For 2 reasons
1. How Much Is Enough?
2. Does My System Match the Dots?
PHW Indicator at 0.02
Avoiding Curve-Fitting
• According to Ralph Vince
• “Optimizing is not the problem, over-
optimizing is.”
• When testing, as I said before
– Test only on the middle third of the data
– THEN, save the Optimization Report to
a spreadsheet
Saving the Optimization Report
Save Strategy
Optimization Report
Saving the Optimization Report
3-D Optimization Chart
• 3-D Optimization Chart
Opening the Saved Data
• From MS Excel
– File g Open
– Locate saved Report
– Open
– Accept delimited data
Sorting the Optimized Data
• Sort by Highest Net Profit
Sort the Optimized Data
• Sort the spreadsheet by Net Profit
Highlight Best 10% or so
Sorting the Optimization
• Then RE-SORT by the parameters
• i.e. Length1, Length2, Length3
• Look for thick yellow zones
• Should look like this:
Thick Yellow Zones
I call this:
• Looking for Islands
• And
• Alligators
• Let’s go back one slide and look again
Thick Yellow Zones
• Now highlight the center of each thick
zone with orange.
• You will want to keep your trading
parameters within the orange zone.
• That way, even if you’re a bit wrong
with your parameters, you’ll still be in
a zone of profit.
Orange Zone of Comfort
Marking Comfort Zones
• This is the Short Version
• Go to www.moneymentor.com, click
on Instructional Materials, click on
“Haps and Hazards of BackTesting” to
view a comprehensive slide show.
• This should be a 3-4 hour lesson
• I’m happy to teach you
How Much Is Enough?
• How Do You Know Whether Your Test
Generates Enough Profit?
• What is Possible?
• Should your chart generate $500,
$5,000, $50,000 or $100,000 or
$500,000?
• You better know this before you begin
• Don’t just trade something because
you “feel like it”
What Is Possible?
• IF You Don’t Have a Goal, You Won’t
Get There
• Turning Points
• ZigZag
• PHW Indicator
• CPC Index
Marking Turning Points
Highs and Lows
Fibonacci Retracements
Pivot Points
ZigZags
PHW
Can I Really Make That Much?
• Slippage
• Commission
• Whipsaw
– What is it?
– Ways to Avoid Whipsaw
• Linear Regression Lines
– Slope
– Angle
Strategy Properties
Commission & Slippage
Ways to Avoid Whipsaw
• Impose Filters
• Don’t take the system’s trade unless
Filter is True
• For instance:
– ADX Rising
– RSI not overbought or oversold
– RSI overbought or oversold
– Linear Regression Line NOT Flat
Looks like this, in Pseudo Code
• IF MACD > XAverage
• AND
• ADX rising
• THEN take trade
• Of course this means that if ADX is
not rising, you will NOT take the trade
Or it could look like this:
• IF MACD > XAverage
• AND
• AbsValue(LinRegLine) > 2.0
• THEN take trade
Buying & Selling
• Buy and Sell Statements
• Exit at End of Day
– “BuyMonday” by Joe Krutsinger
– Exit at 1258 instead of End of Day
• Trading at the Market
Buying & Selling
• Buy("Support") 5 contracts next bar at
Low Limit;
• Buy to Cover ("Profit") 10 contracts
next bar at MidPrice stop;
• Sell Short("BreakOut") 500 Shares
next bar MidPrice or Lower;
• Sell ("Profit") 10 contracts next bar at
MidPrice stop;
Joe Krutsinger BuyMonday
• //Joe Krutsinger BuyMonday
• inputs:Da(5) , Amount(500) ;
• If DayOfWeek(Date)=Da then Buy
Next Bar At Market;
• SetExitOnClose;
• SetStopLoss( Amount ) ;
Better, Safer Exit
• Instead of SetExitOnClose
• Use the time of your market less a few
minutes
• For instance:
IF Time > 1257 THEN BEGIN
IF MarketPosition = 1 THEN Sell ;
IF MarketPosition = -1 THEN Buy to
Cover;
END;
Strategy Performance Report
• Important Statistics
• Essential Statistics
• Key Tabs Under the Report
• Charts in the Performance Report
• Saving the Report to a Spreadsheet
Strategy Performance Report
Performance Report Stats
These Numbers Calculate CPC
• Remember that
• CPC Index =
• Profit Factor * Percentage * Ratio
• Must be > 1.2 to feel safe
Perf Report: Equity Curve Detailed
Perf Report:
Perf report: VAMI
Your LabBook
• Keep it Diligently
Your Trades Log
Upcoming
• Session Three will be more about
Testing and Optimizing Your Strategy,
or one you invent, buy, beg, borrow or
read about
Prices Are Rising
• Price Increase Effective 3/1/2012
• If you mention that you attended this
Webinar, you can have 50% off all my
products (except books)
Keep In Touch
• Sunny J. Harris
• 1547 Mission Meadows Dr.,
Oceanside, CA 92057
• www.moneymentor.com
• (760) 908-3070
• Skype: (760) 444-4174
• Fax: (760) 859-3057