CDAXX
> # Print trade statistics table
> cat('\nRSI(2) Trade Statistics - RSI steps = 5, Size steps = 0.25\n')
RSI(2) Trade Statistics - RSI steps = 5, Size steps = 0.25
> print(tradeStats(sig,ret))
Signal # Trades % Win Mean Win Mean Loss Median Win Median Loss
1 -1.00 309 46.60194 0.7908320 -0.6201146 0.5529343 -0.4206923
2 -0.75 240 42.91667 0.5301378 -0.5227856 0.3438300 -0.3631226
3 -0.50 216 43.05556 0.3913037 -0.4502722 0.2422385 -0.3006031
4 -0.25 191 45.02618 0.2391220 -0.1944549 0.1499309 -0.1462801
5 0.00 1442 0.00000 NaN NaN NA NA
6 0.25 157 52.22930 0.2827231 -0.3062386 0.2134882 -0.2284079
7 0.50 156 49.35897 0.6706037 -0.5946854 0.6051180 -0.4838192
8 0.75 185 48.64865 0.8130823 -1.1794626 0.6002428 -0.8490656
9 1.00 210 53.80952 1.6079988 -1.4924245 1.0110181 -1.1272812
Mean W/L Median W/L
1 1.2752997 1.3143440
2 1.0140635 0.9468703
3 0.8690380 0.8058418
4 1.2297043 1.0249575
5 NaN NA
6 0.9232119 0.9346796
7 1.1276613 1.2507111
8 0.6893667 0.7069452
9 1.0774407 0.8968641
>
> # Print drawdown table
> cat('\nRSI(2) Drawdowns - RSI steps = 5, Size steps = 0.25\n')
RSI(2) Drawdowns - RSI steps = 5, Size steps = 0.25
> print(table.Drawdowns(ret_all, top=10))
From Trough To Depth Length To Trough Recovery
1 2000-05-31 2002-07-23 2008-12-02 -0.2750 2202 560 1642
2 2011-02-07 2011-08-10 <NA> -0.2630 246 131 NA
3 2008-12-30 2009-10-28 2011-01-28 -0.1344 531 212 319
4 2000-03-03 2000-04-05 2000-05-03 -0.0546 44 24 20
5 2000-01-13 2000-01-17 2000-01-26 -0.0277 10 3 7
6 2000-05-22 2000-05-22 2000-05-25 -0.0109 4 1 3
7 2000-02-04 2000-02-04 2000-02-07 -0.0091 2 1 1
8 2000-02-09 2000-02-10 2000-02-16 -0.0084 6 2 4
9 2000-01-06 2000-01-06 2000-01-07 -0.0046 2 1 1
10 2000-02-23 2000-02-23 2000-02-24 -0.0041 2 1 1
>
> # Print downside risk table
> cat('\nRSI(2) Downside Risk - RSI steps = 5, Size steps = 0.25\n')
RSI(2) Downside Risk - RSI steps = 5, Size steps = 0.25
> print(table.DownsideRisk(ret_all))
Total System Return
Semi Deviation 0.0064
Gain Deviation 0.0098
Loss Deviation 0.0084
Downside Deviation (MAR=210%) 0.0113
Downside Deviation (Rf=0%) 0.0106
Downside Deviation (0%) 0.0106
Maximum Drawdown 0.2750
Historical VaR (95%) -0.0102
Historical ES (95%) -0.0201
Modified VaR (95%) -0.0052
Modified ES (95%) -0.0052
>
> # Calculate signals with the 'rsi2pos()' function
> # using new RSI and size step values
> sig <- rsi2pos(rsi, 10, 0.3)
>
> # Break out the long (up) and short (dn) signals
> sigup <- ifelse(sig > 0, sig, 0)
> sigdn <- ifelse(sig < 0, sig, 0)
>
> # Calculate rule returns
> ret_up <- ret * sigup
> colnames(ret_up) <- 'Long System Return'
> ret_dn <- ret * sigdn
> colnames(ret_dn) <- 'Short System Return'
> ret_all <- ret * sig
> colnames(ret_all) <- 'Total System Return'
>
> # Calculate performance statistics
> png(filename="20090606_rsi2_performance_updated.png", 720, 720)
> charts.PerformanceSummary(cbind(ret_up,ret_dn),methods='none',
+ main='RSI(2) Performance - RSI steps = 10, Size steps = 0.30')
> dev.off()
null device
1
>
> # Print trade statistics table
> cat('\nRSI(2) Trade Statistics - RSI steps = 10, Size steps = 0.30\n')
RSI(2) Trade Statistics - RSI steps = 10, Size steps = 0.30
> print(tradeStats(sig,ret))
Signal # Trades % Win Mean Win Mean Loss Median Win Median Loss
1 -1.0 549 44.99089 0.7558113 -0.6565845 0.50856937 -0.43195259
2 -0.7 407 43.98034 0.6063034 -0.5915089 0.35049461 -0.41123759
3 -0.4 285 42.45614 0.4122292 -0.3806877 0.32363185 -0.25264987
4 -0.1 254 46.85039 0.1189782 -0.1213035 0.08493660 -0.10022296
5 0.0 432 0.00000 NaN NaN NA NA
6 0.1 228 49.12281 0.1107091 -0.1266814 0.07407946 -0.08901997
7 0.4 243 49.38272 0.4087624 -0.5438892 0.31181830 -0.44707164
8 0.7 313 50.79872 0.8629201 -0.8446817 0.71152382 -0.67542816
9 1.0 395 51.39241 1.3757327 -1.5338425 0.96796960 -1.13208741
Mean W/L Median W/L
1 1.1511258 1.1773731
2 1.0250114 0.8522922
3 1.0828542 1.2809500
4 0.9808310 0.8474765
5 NaN NA
6 0.8739177 0.8321667
7 0.7515545 0.6974683
8 1.0215921 1.0534412
9 0.8969191 0.8550308
>
> # Print drawdown table
> cat('\nRSI(2) Drawdowns - RSI steps = 10, Size steps = 0.30\n')
RSI(2) Drawdowns - RSI steps = 10, Size steps = 0.30
> print(table.Drawdowns(ret_all, top=10))
From Trough To Depth Length To Trough Recovery
1 2000-05-18 2011-09-06 <NA> -0.5189 3009 2913 NA
2 2000-03-02 2000-04-05 2000-05-16 -0.0649 54 25 29
3 2000-01-10 2000-01-17 2000-02-01 -0.0432 17 6 11
4 2000-02-02 2000-02-04 2000-02-28 -0.0246 19 3 16
5 2000-01-06 2000-01-06 2000-01-07 -0.0046 2 1 1
Warning message:
In table.Drawdowns(ret_all, top = 10) : Only 5 available in the data.
>
> # Print downside risk table
> cat('\nRSI(2) Downside Risk - RSI steps = 10, Size steps = 0.30\n')
RSI(2) Downside Risk - RSI steps = 10, Size steps = 0.30
> print(table.DownsideRisk(ret_all))
Total System Return
Semi Deviation 0.0107
Gain Deviation 0.0091
Loss Deviation 0.0084
Downside Deviation (MAR=210%) 0.0129
Downside Deviation (Rf=0%) 0.0106
Downside Deviation (0%) 0.0106
Maximum Drawdown 0.5189
Historical VaR (95%) -0.0141
Historical ES (95%) -0.0249
Modified VaR (95%) -0.0119
Modified ES (95%) -0.0119
>
No comments:
Post a Comment