Upload
others
View
14
Download
0
Embed Size (px)
Citation preview
A 68 indicator, hard-ranking system using Amibroker
H o w M a n y I n d i c a t o r s D o Yo u R E A L LY N e e d ?
M a r k B a t e s , C F Te
ATA S M e e t i n g W e d n e s d a y, M a y 5 , 2 0 2 1
Agenda
Amibroker Platform
Problems With Some Standard Approaches
Results
Theory, Approach and Considerations
Amibroker Considerations
Goals of the System
Goals of The Trading System
Investing/Trading Goals Technical Goals
• Acceptable Net RAR
• Acceptable Number of Trades
• Acceptable Average Bars Held
• Acceptable Trade Win Percentage
• Acceptable Max System Drawdown
• Runs Quickly even Intraday
• Backtests Quickly
• Scales well with more indicators
Design Goals
• +1 system makes it same or better
• Minimal number of head fakes
• Avoid “look forward” functionality
Amibroker Platform
My Experience with Amibroker Why Amibroker?
• User since 2007
• Using version 6.30
• Data comes from Yahoo Daily Close
• Have also used 5 min data from TD Ameritrade using API
• Regular feeds of data from FRED
• Array-based language
• Very fast processing
• Sophisticated backtester
• Monte Carlo analysis
As applied to this problem
• Many indicators at one time
• Ranking
• The Foundation by Southwind v13 – 2010
Theory, Approach and Considerations
Theory – Inherent Issues With Technical indicators
• Trending and Trading Periods favor different indicator types
• Beta affects which indicators/values make sense
• A “system” that works for Stock A might not work for Stock B
• Market trends and economic cycles complicate success over time
Theory, Approach and Considerations
Multi-indicator Approach And Challenges
• Build a “system of systems” that will adapt automatically
• “Survival of the Fittest” model reflects the market itself
• Addition of +1 system should not negate performance
• Use Techniques that don’t favor one oscillator type over the others
• Challenge: statistically relevant backtesting
Amibroker System Settings
General Settings System Specific Settings
• Trade Delay period (1,1)
• Initial Equity 100k
• Long-only Trading
• Long-Short calculations
• Lookback Period
• Short, Medium and Long Periods
• Number of “Winning” symbols
• Buy/Sell signal confirmation length
• Position Size is 1/n
Possible Ranking Factor(s)
• Gain during lookback period
• Gain over multiple economic cycles
• Maximize Expectation value
• Maximize Winning percentage
• Maximize RAR/MDD
• Choice: Total Return / Exposure
Indicator Examples
Types Individual Examples
• Leading
• Lagging
• Confirming
• Short Term
• Long Term
• Trend
• Momentum
• Volume
• Volatility
• Moving Average
• MACD
• Bollinger Band
• ADX
• PDI
• Slope Divergence
• Stochastic
• CCI
• Relative Strength
Systems Examples
• Swing Trading
• OBV variants
• Trend + Oscillators
• Money Flow
• Martin Pring
• Turtles
• DeMark variants
• Ichimoku
• Heikin-Ashi
• Adaptive Cycles
• Volatility
• Cycles
Theory Output Example
Setup
• Slider = 200 bars
• Shortperiod = 10 bars
• TopLimit = 3 strategies
Notes
• Green: model BUY
• Red: model SELL
• Blue: 200dma
• 9/16/2020 last day of BUY signal
Permutation System version 35 no restraints
final Buy=0 Sell=0
version 23
BuySum= 9.484883e+07
SellSum= 5.151071e+07
Tradecount= 166
RANKCOUNT
Rank=1 Formula=103 Name=MACD Shortperiod Equity=5.169183e+07
Rank=2 Formula=211 Name=Martin Pring KST Equity=5.151071e+07
Rank=3 Formula=105 Name=MA mediumperiod Equity=4.3157e+07
Rank=4 Formula=10 Name=Joanne Klein shortperiod Equity=3.941296e+07
Theory Output Example
Notes
• Formula 105 turned to SELL
• Aggregate pushed to SELL
• Actual trade at next day Open
• Number of participating systems can be varied
Permutation System version 35 no restraints
final Buy=0 Sell=1
version 23
BuySum= 5.250441e+07
SellSum= 9.261211e+07
Tradecount= 166
RANKCOUNT
Rank=1 Formula=103 Name=MACD Shortperiod Equity=5.250441e+07
Rank=2 Formula=211 Name=Martin Pring KST Equity=5.043244e+07
Rank=3 Formula=105 Name=MA mediumperiod Equity=4.217966e+07
Rank=4 Formula=10 Name=Joanne Klein shortperiod Equity=3.851961e+07
Theory Output Example
Notes
• Every system has a rank and a signal
• One could count BUY v SELL signals, but that does not reward excellence
• Low numbers of participating systems give better, but more volatile, results
Rank=1 Formula=103 Name=MACD Shortperiod Equity=5.250441e+07
Rank=2 Formula=211 Name=Martin Pring KST Equity=5.043244e+07
Rank=3 Formula=105 Name=MA mediumperiod Equity=4.217966e+07
Rank=4 Formula=10 Name=Joanne Klein shortperiod Equity=3.851961e+07
Rank=5 Formula=109 Name=BBandBot longperiod Equity=3.178877e+07
Rank=6 Formula=215 Name=Turtle Trading System Equity=2.940932e+07
Rank=7 Formula=248 Name=Dagnino 200dma System Equity=2.286805e+07
Rank=8 Formula=102 Name=MA longperiod Equity=2.253516e+07
Rank=9 Formula=204 Name=LinRegSlope mediumperiod Equity=1.716808e+07
Rank=10 Formula=205 Name=PDI/MDI mediumperiod Equity=1.643893e+07
Rank=11 Formula=235 Name=Mean Reversion Trading System Equity=1.526644e+07
Rank=12 Formula=219 Name=AFL - Premier Stochastic Indicator Equity=1.41556e+07
Rank=13 Formula=238 Name=MA Channel Breakout Equity=1.415363e+07
Rank=14 Formula=223 Name=AFL - The Quest for Reliable Crossovers Equity=1.360469e+07
Rank=15 Formula=217 Name=AFL - An Expert of a System Equity=1.130473e+07
Rank=16 Formula=213 Name=Dave Landry Pullback Scan Equity=1.102577e+07
Rank=17 Formula=231 Name=Version 5.0 - Trend and Oscillating Model Equity=1.048088e+07
Rank=18 Formula=106 Name=BBandBot mediumperiod Equity=9644544
Rank=19 Formula=246 Name=Keltner Band Trading System Equity=9317566
Rank=20 Formula=247 Name=Multi Timeframe Exploration Equity=7390152
Rank=21 Formula=206 Name=Chaiken longperiod Equity=6535885
Rank=22 Formula=112 Name=ATR System Equity=6150601
Rank=23 Formula=11 Name=Joanne Klein mediumperiod Equity=6106582
Example 1 – Setup –Maximize RAR/MDD
Preliminary Optimization Prior to Example
• Optimization using S&P 500
• Data Optimization 1/1/2007 to 4/28/2021
• Maximize RAR/MDD
• Slider 2000 bars: represents an 8+ year daily equivalent but tends to exclude short term irreproducible results
• Short Period: 20 bars
• Top Limit: 1 system
• Buy Signal Confirm: 20 bars
• Sell Signal Confirm: 9 bars
Example 1 –S&P500 optimization Results
Results of Backtesting Using Previous Setup but with x Top Systems – 1/1/2007 to 4/28/2021
Top RAR% Exposure% Trades Win% MaxDD RAR/MaxDD
1 13.18% 55.63% 4286 57.96% -41.39% 0.32
5 12.00% 46.68% 5918 57.06% -34.94% 0.34
9 11.52% 43.16% 6397 55.70% -34.78% 0.33
13 11.70% 41.28% 6397 55.14% -34.85% 0.34
17 11.89% 40.11% 6429 53.63% -33.48% 0.36
21 11.89% 38.10% 6392 53.72% -32.21% 0.36
25 11.70% 37.55% 6386 52.60% -31.43% 0.38
29 11.32% 37.37% 6370 52.14% -31.42% 0.38
33 11.23% 37.02% 6345 51.80% -31.06% 0.36
37 11.59% 36.70% 6332 51.78% -30.98% 0.37
Example 2 – Setup –Maximize Net Percent Profit
Preliminary Optimization Prior to Example
• Optimization using S&P 500
• Data Optimization 1/1/2007 to 4/28/2021
• Maximize Net Percent Profit
• Slider 200 bars
• Short Period: 10 bars
• Top Limit: 24 systems
• Buy Signal Confirm: 6 bars
• Sell Signal Confirm: 18 bars
Example 2 –S&P500 optimization Results
Results of Backtesting Using Optimized Setup with 24 Top Systems
• Annualized RAR = 16.16%
• Trades: 14353 (avg bars held = 202)
• Win % = 58.20%
• Max DD = -36.96%
• RAR/MaxDD = 0.44
Example 2 –K - Kelloggs
Results of applying Optimized S&P Setup with 24 Top Systems
• Annualized RAR = 10.84%
• Trades: 27 (avg bars held = 319)
• Win % = 55.56%
• Max DD = 0.39%
• RAR/MaxDD = 28.04
• Top 1-5 Systems for K on 4/29/2021:
1. AFL – Predictive Indicator
2. Williams ShortPeriod Equity
3. Money Flow Index
4. Hawkeye Spread Analysis
5. Tom DeMark Sequential
• Top System over Lookback: Pivot Point Squeeze (13 days)
Next Steps
Investing/Trading Goals Technical Goals
• Acceptable Net RAR
• Acceptable Number of Trades
• Acceptable Average Bars Held
• Acceptable Trade Win Percentage
• Acceptable Max System Drawdown
• Runs Quickly even Intraday
• Backtests Quickly
• Scales well with more indicators
Design Goals
• +1 system makes it same or better
• Minimal number of head fakes
• Avoid “look forward” functionality