1. The document outlines the contents of an AmiBroker extreme course, including advanced topics in market analysis, AFL coding, money management, portfolio construction, and miscellaneous subjects.
2. Advanced market analysis techniques include market breadth indicators, equity curve analysis, and customized market filters and classifications.
3. Advanced AFL coding covers customizing position and strategy metrics, and building customized backtesters at high and low levels.
4. Advanced money management involves risk management, portfolio heat, equity models, position sizing, and alternative strategies like dollar cost averaging.
4. MKBI: Another view of the Market
Note: MKBI is informative/helpful especially in an early warning of a trend reversal.
Reversals which can be identifiedby both SET Index and MKBI
Only by MKBI (SET Index, cap-weightedindex, is still in uptrend.)
5. Market Breadth (MKB)
1. How to Count the Market (Raw MKB)
β’ New High β New Low
β’ Advance & Decline
β’ Up & Down Volume
β’ MKB on Indicator: MA40 > MA100, MACD > 0, β¦
2. How to Apply an indicator to MKB (Processed MKBI)
β’ β¦
3. How to use MKBI
β’ Market Filter (MKF)
β’ Market Classification (MKC)
6. From Raw MKB to Processed MKBI
Note: Smoothed/processedMKBI results in a less-whipsaw/falsesignals
Raw
Processed
7. Market Analysis
7
MK = Market, MKF = Market Filter (basic), MKC = Market Classification (intermediate)
MKB = Market Breadth (advanced), MKBI = Market Breadth Indicators
MK
MKF
MKC
MKB
Without Filter = All Markets = MKC 0
With Filter
All Markets = MKC 0
basedMKC
mergedMKC
Standard Index
Indicators
MKF
MKCCustomized IndexMKBI
8. 2. Advanced AFL Coding
β’ Customized Position Metrics
β’ Customized Strategy Metrics
β’ High-Mid Level Custom Backtester
β’ Low Level Custom Backtester
Customized Strategy Metrics with High-level CBI
from Van K. Tharp (VKT) and Ralph Vince (RV)
10. Risk Management with Portfolio Heat
Skipping 38% of signals
in order to control Risk
ππππ‘πππππ π»πππ‘ πΏππ£ππ =
Ο π=1
πππ₯πππππππ ππ‘ππππ
π ππ π π
πΈππ’ππ‘π¦
Allowable PH could be:
β’ Static:15%
β’ Dynamic: iif(Uptrend,25, 15);
11. Different Types of Equity Models
11
//Code in Custom Backtest for Secured Equity
//Showing concept, not the actual AFL code
For OpenPositions
currentRiskPerShare = 10/100 x BuyPrice
sumCurrentRisk += currentRiskPerShare*Shares
Next
securedEquity= bo.Equity β sumCurrentRisk
For Signals
sig.Pos = 5/100 * securedEquity
Next
Baht
Year
1 M
2 M
1 2 3
Total Equity
Cash Equity
Secured Equity
12. 4. Advanced Portfolio Construction
β’ Strategy & Portfolio Analysis
β’ Multiple-Strategy Portfolio Construction & Simulation
β’ Multiple-Strategy Portfolio Optimization
Time
Equity (Baht)
Main STRATEGY01
Time
Equity (Baht)
Main STRATEGY02
Time
Equity (Baht)
OptimizedSTRATEGY01+02
+ =
ππππβπ‘01 Γ πΈππ’ππ‘π¦01 + ππππβπ‘02 Γ πΈππ’ππ‘π¦02
ππππβπ‘01 + ππππβπ‘02
= πππ‘ππππ§ππ πΈππ’ππ‘π¦01&02
Note: Each main strategy will be backtested/simulatedfor 300 runs for simulation & optimizationin order to obtainthe OptimizedStrategy.
13. 5. Advanced Miscellaneous Subjects
β’ Random & Walk-Forward Analysis
β’ Ruin Test
β’ Basket Backtesting
β’ Multiple Time Frame Strategy & Analysis
2008 2009 2010 2011 2012 2013 20142007 2015
Case 1
Case 2
Case 3
Case 4
Case 200
Random & Walk-Forward CAR
Percentile
40%
30%
20%
10%
10 20 30 40 50 60 70 80 90 100