Background: I want to compare two trading strategies in term of profitability. The red one is an active trading strategy, which involves many entry and exit to a specific market. The blue one is a passive strategy.
Both portfolios start at some unit 3. The units on the x-axis are months. As you can see, the active one clearly outperforms the passive strategy in absolute terms.
But when I compare both portfolios in terms of returns (edit: discrete returns ) and cumulative returns (something like cumprod(1+Return)):
It seems that the opposite is the case: the passive strategy works better.
How could this be?
Here is part of the code in using R:
library(quantmod)
library(tseries)
# calculating returns
portfolio.active <- c(3e+07, 6680419, 6980132, 7268161, 7519643, 7739132, 7941601,
8119644, 8286440, 8435480, 8595353, 8772177, 9000774, 27468724.0476,
9162873.0476, 9503273.0476, 9791440.0476, 10097455.0476, 10415108.0476,
10682368.0476, 10932171.0476, 11190461.0476, 11462988.0476, 11746256.0476,
12009560.0476, 34328954.4748696, 34768365.0921479, 35236579.0753889,
35677036.3138312, 36108728.4532286, 36549254.940358, 36940331.9682198,
37325742.7650882, 37687802.4699096, 38047092.8534561, 38444050.8555604,
38856683.6680768, 18480549.6680768, 18699486.6680768, 18927669.6680768,
19157485.6680768, 19415315.6680768, 19665072.6680768, 19874970.6680768,
20094206.6680768, 20321975.6680768, 20534633.6680768, 41857739.8826469,
42284688.8294499, 42704716.7384891, 43167351.1698227, 43670970.266804,
44206667.5020768, 25078572.5020768, 25262687.5020768, 25460188.5020768,
25670408.5020768, 25900891.5020768, 26185010.5020768, 26468094.5020768,
26791336.5020768, 27124813.5020768, 27445686.5020768, 27797816.5020768,
28169749.5020768, 28530619.5020768, 28851193.5020768, 29171192.5020768,
29524403.5020768, 29857673.5020768, 30123254.5020768, 52942557.9825139,
53849640.4759476, 54747134.4838801, 55628563.3490706, 56548288.9297752,
57481335.6971165, 58443190.0477816, 59434776.1722589, 60455073.163216,
61472733.5614635, 62515720.9408897, 63555565.7658731, 64621180.7518809,
65678814.0768534, 44286709.0768534, 44509648.0768534, 44736037.0768534,
44940967.0768534, 45122736.0768534, 45299951.0768534, 45497061.0768534,
68541626.0566368, 69672562.8865713, 70826805.0117255, 72040304.2709264,
73279397.5043863, 74510491.38246, 75774686.0529157, 77045174.9557362,
78316420.3425059, 79621694.014881, 80943414.135528, 82281678.5825687,
83625612.666084, 84910659.5807195, 70986088.5807195, 71134875.5807195,
71259144.5807195, 71382746.5807195, 86070512.2301142, 87344355.8111198,
72406044.8111198, 72574841.8111198, 72734093.8111198, 72876348.8111198,
73013152.8111198, 73157845.8111198, 73342328.8111198, 73526765.8111198,
73704118.8111198, 73898514.8111198, 74081870.8111198, 74300600.8111198,
74525126.8111198, 74756092.8111198, 74992670.8111198, 75240955.8111198,
75485445.8111198, 75736352.8111198, 75978887.8111198, 76218754.8111198,
76455194.8111198, 94467009.4053774, 96003672.7583715, 97418126.8703449,
98674820.7069723, 99865496.8768364, 101027265.490504, 102209284.496743,
103354028.483106, 104263543.933757, 105014241.45008, 105668830.221786,
106264097.965369, 106848550.504178, 107464710.478752, 108105916.584609,
108725723.839694, 91768810.839694, 109049526.184452, 109660203.531085,
110252368.630153, 94067536.630153, 94240657.630153, 94440021.630153,
94687041.630153, 94938224.630153, 95175768.630153, 95433874.630153,
95743316.630153, 96077069.630153, 96389386.630153, 96724956.630153,
97052499.630153, 97410241.630153, 98093042.630153, 98769541.630153,
99552139.630153, 100431061.630153, 101345311.630153, 102241667.630153,
103005198.630153, 103578174.630153, 129996171.902754, 130572488.264856,
131216645.87363, 131938337.425934, 132712375.672167, 133628091.064305,
94297376.0643046, 95030984.0643046, 95750240.0643046, 96575296.0643046,
97249725.0643046, 97755334.0643046, 141077560.446541, 142591792.928667,
144226845.487583, 145871031.526141, 147674969.949348, 149584899.560693,
151524517.091663, 153666063.599892, 155935199.13905, 158279424.966107,
160706376.148921, 163234823.133664, 165841139.143032, 168577517.938892,
127864050.938892, 128484705.938892, 129103980.938892, 129759917.938892,
130434392.938892, 131118780.938892, 131759054.938892, 132479828.938892,
133227604.938892, 134109332.938892, 134952558.938892, 136083238.938892,
137206719.938892, 138478067.938892, 139996228.938892, 141580951.938892,
143068867.938892, 144160194.938892, 145172631.938892, 146430708.938892,
147709646.938892, 149254901.938892, 150654198.938892, 151985116.938892,
240918508.942675, 241825968.659692, 242366046.656365, 242519545.152581,
242543797.107096, 242648899.419176, 242891548.318595, 243061572.402418,
243191205.241033, 243337119.964177, 243483122.236156, 208208237.236156,
208482926.236156, 208784318.236156, 209112574.236156, 209601255.236156,
210075285.236156, 210553892.236156, 210973504.236156, 211499146.236156,
211986447.236156, 212568324.236156, 213018802.236156, 213301380.236156,
251743071.638948, 251868943.174768, 251978086.383477, 252095676.157123,
252213320.805996, 252339427.466399, 252448774.551634, 252532924.143151,
252583430.72798, 252617108.518744, 252650790.79988, 252684477.571986,
252701323.203824, 252709746.581265, 252726593.897703, 252735018.1175,
252743442.618104, 252768716.962366, 252844547.577454, 252911972.790142,
252979415.982886, 253055309.80768, 253131226.400623, 253215603.47609,
253300008.677248)
portfolio.passive <- c(6680419, 6980132, 7268161, 7519643, 7739132, 7941601, 8119644,
8286440, 8435480, 8595353, 8772177, 9000774, 9223828, 9510477,
9850877, 10139044, 10445059, 10762712, 11029972, 11279775, 11538065,
11810592, 12093860, 12357164, 12611636, 12826134, 13020162, 13205887,
13411967, 13586583, 13738107, 13890114, 14033013, 14176096, 14379071,
14632186, 14858552, 15077489, 15305672, 15535488, 15793318, 16043075,
16252973, 16472209, 16699978, 16912636, 17117129, 17309938, 17499182,
17669704, 17838570, 18030597, 18248752, 18432867, 18630368, 18840588,
19071071, 19355190, 19638274, 19961516, 20294993, 20615866, 20967996,
21339929, 21700799, 22021373, 22341372, 22694583, 23027853, 23293434,
23552161, 23807208, 24037208, 24239999, 24430692, 24636197, 24838827,
25024759, 25167083, 25292732, 25396830, 25531909, 25750800, 25982456,
26197851, 26420790, 26647179, 26852109, 27033878, 27211093, 27408203,
27587764, 27761184, 27940101, 28100963, 28275165, 28449068, 28580697,
28738500, 28872981, 29016478, 29153880, 29281553, 29397565, 29511990,
29657419, 29806206, 29930475, 30054077, 30189731, 30345050, 30481739,
30650536, 30809788, 30952043, 31088847, 31233540, 31418023, 31602460,
31779813, 31974209, 32157565, 32376295, 32600821, 32831787, 33068365,
33316650, 33561140, 33812047, 34054582, 34294449, 34530889, 34784441,
35030472, 35288003, 35537392, 35777282, 35993896, 36182795, 36309410,
36428366, 36551784, 36678261, 36799218, 36930272, 37056381, 37192817,
37315361, 37443448, 37559161, 37678255, 37796705, 37943123, 38116244,
38315608, 38562628, 38813811, 39051355, 39309461, 39618903, 39952656,
40264973, 40600543, 40928086, 41285828, 41968629, 42645128, 43427726,
44306648, 45220898, 46117254, 46880785, 47453761, 47874224, 48446901,
49082644, 49735039, 50465013, 51353940, 52223225, 52956833, 53676089,
54501145, 55175574, 55681183, 56126394, 56426107, 56695598, 57013205,
57401606, 57732898, 58059337, 58331657, 58599952, 58940697, 59221343,
59514294, 59891103, 60293258, 60784791, 61405446, 62024721, 62680658,
63355133, 64039521, 64679795, 65400569, 66148345, 67030073, 67873299,
69003979, 70127460, 71398808, 72916969, 74501692, 75989608, 77080935,
78093372, 79351449, 80630387, 82175642, 83574939, 84905857, 85860403,
86533153, 86693118, 86848759, 86933744, 86987679, 87166596, 87400230,
87530962, 87793484, 88192304, 88594919, 88869608, 89171000, 89499256,
89987937, 90461967, 90940574, 91360186, 91885828, 92373129, 92955006,
93405484, 93688062, 94046149, 94442209, 94722786, 94994784, 95253442,
95412993, 95558123, 95756774, 95872809, 96042503, 96225790, 96353440,
96481780, 96623966, 96805068, 96962756, 97096340, 97134658, 97129276,
97141765, 97210259, 97308354, 97369925, 97419651, 97417259, 97374617
)
ts.plot(ts(portfolio.active, start=1990, frequency=12)/1000000,ts(portfolio.passive, start=1990, frequency=12)/1000000, col=c("red","blue"), ylab="in million dollars")
abline(h=0)
return.ma.trading <- ROC(portfolio.active, type ="discrete")
return.buy.and.hold <- ROC(portfolio.passive, type ="discrete")
return.ma.trading[is.na(return.ma.trading)] <- 0
return.buy.and.hold[is.na(return.buy.and.hold)] <- 0
cumret.ma.trading <- cumprod(1+return.ma.trading)
cumret.buy.and.hold <- cumprod(1+return.buy.and.hold)
par(mfrow=c(2,2))
plot.ts(return.ma.trading)
plot.ts(return.buy.and.hold)
plot.ts(cumret.ma.trading)
plot.ts(cumret.buy.and.hold)
ROC(, type="discrete")
which calculatesc(NAs, x[(n + 1):NROW(x)]/x[1:(NROW(x) - n)]
. I will edit my post $\endgroup$