Amibroker Runs Test

The Runs Test is a statistic test for checking if an occurrence of runs (for us a run is a sequence of winning or losing trades) may be considered random or not.

I added the Runs Test calculation to the AFL script for Consecutive Winning or Losing Trades calculation.

The calculation is the same you can read on adaptrade.com. Result > 1.96 means positive dependency: wins follow wins and losses follow losses. Result < -1.96, means wins tend to follow losses, and losses tend to follow wins.

The results is something like this:

Statistics | Charts | Trades | Formula | Settings | Symbols

Statistics
All trades Long trades Short trades
Initial capital 100000.00 100000.00 100000.00
Ending capital 112575.00 108800.00 103775.00
Net Profit 12575.00 8800.00 3775.00
Net Profit % 12.57 % 8.80 % 3.77 %
Exposure % 0.10 % -0.00 % 0.10 %
Net Risk Adjusted Return % 12833.00 % -330809.02 % 3750.63 %
Annual Return % 12.69 % 8.88 % 3.81 %
Risk Adjusted Return % 12945.83 % -333668.77 % 3782.30 %

All trades 32 14 (43.75 %) 18 (56.25 %)
 Avg. Profit/Loss 392.97 628.57 209.72
 Avg. Profit/Loss % 26.20 % 41.90 % 13.98 %
 Avg. Bars Held 1.44 2.00 1.00

Winners 27 (84.38 %) 13 (40.63 %) 14 (43.75 %)
 Total Profit 18750.00 8800.00 9950.00
 Avg. Profit 694.44 676.92 710.71
 Avg. Profit % 46.30 % 45.13 % 47.38 %
 Avg. Bars Held 1.48 2.00 1.00
 Max. Consecutive 12 13 7
 Largest win 1475.00 1475.00 800.00
 # bars in largest win 2 2 1

Losers 5 (15.63 %) 1 (3.13 %) 4 (12.50 %)
 Total Loss -6175.00 0.00 -6175.00
 Avg. Loss -1235.00 0.00 -1543.75
 Avg. Loss % -82.33 % 0.00 % -102.92 %
 Avg. Bars Held 1.20 2.00 1.00
 Max. Consecutive 2 1 1
 Largest loss -3225.00 0.00 -3225.00
 # bars in largest loss 1 0 1

Max. trade drawdown -3225.00 0.00 -3225.00
Max. trade % drawdown -83.33 % 0.00 % -83.33 %
Max. system drawdown -3225.00 0.00 -3225.00
Max. system % drawdown -3.12 % 0.00 % -3.20 %
Recovery Factor 3.90 N/A 1.17
CAR/MaxDD 4.07 N/A 1.19
RAR/MaxDD 4152.70 N/A 1182.48
Profit Factor 3.04 N/A 1.61
Payoff Ratio 0.56 N/A 0.46
Standard Error 1446.00 417.76 1312.22
Risk-Reward Ratio 8.98 21.16 3.16
Ulcer Index 1.00 0.00 1.22
Ulcer Performance Index 7.25 N/A -1.30
Sharpe Ratio of trades 6.16 22.95 3.15
K-Ratio 0.1614 0.3801 0.0568

Consecutive Winners #1 0 0 0
Consecutive Winners #2 0 0 2
Consecutive Winners #3 1 0 1
Consecutive Winners #4 0 0 0
Consecutive Winners #5 0 0 0
Consecutive Winners #6 2 0 0
Consecutive Winners #7 0 0 1
Consecutive Winners #8 0 0 0
Consecutive Winners #9 0 0 0
Consecutive Winners #10 0 0 0
Consecutive Winners #11 0 0 0
Consecutive Winners #12 1 0 0
Consecutive Winners #13 0 1 0
Consecutive Losers #1 3 0 3
Consecutive Losers #2 0 0 0
Runs Test -1.01 -2.45 0.56

The updated AFL script is downloadable here.

Include it on top of your AFL trading system with an #include_once instruction.

Or copy and past it on the top of your AFL trading system.

The previous post on this subject is here.

Comments

Popular Posts