Trend Vigor Part III: ATR position sizing, Annualized Sharpe above 1.4, and Why Leverage Is Pointless

[This article was first published on QuantStrat TradeR » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

To continue the investigation of Trend Vigor (see part 1 here, and part 2 here), let’s examine the importance of position sizing. Also, this post will show the way to obtain this equity curve:

Equity Curve 20 day ATR pctATR .04

Before starting this post, I would like to defer to an authority in terms of the importance of position sizing. That would be one Andreas Clenow, author of an extremely highly-rated book about trend-following. Here’s his post: Why Leverage Is Pointless

Now before starting the main thrust of this post, I’d like to make a quick comparison regarding the 30 ETFs I selected for this demo–namely, their inter-instrument correlations.

tmp <- list()
length(tmp) <- length(symbols)
for (i in 1:length(symbols)) {
  tmp[[i]] <-Cl(get(symbols[i]))
}
tmp <- do.call(cbind, tmp)
baseCors <- cor(tmp)
diag(baseCors) <- NA
instrumentAverageBaseCors <- rowMeans(baseCors, na.rm=TRUE)
names(instrumentAverageBaseCors) <- gsub(".Close", "", names(instrumentAverageBaseCors))
instrumentAverageBaseCors
(grandMeanBaseCors <- mean(instrumentAverageBaseCors))


> instrumentAverageBaseCors
      XLB       XLE       XLF       XLP       XLI       XLU       XLV 
0.8208166 0.7872692 0.2157401 0.7618719 0.7882733 0.8049700 0.7487639 
      XLK       XLY       RWR       EWJ       EWG       EWU       EWC 
0.7785739 0.5912142 0.7055041 0.6665144 0.8112501 0.7735207 0.8159072 
      EWY       EWA       EWH       EWS       IYZ       EZU       IYR 
0.8231610 0.8234274 0.8022086 0.7971305 0.6875318 0.7669643 0.6894201 
      EWT       EWZ       EFA       IGE       EPP       LQD       SHY 
0.7746172 0.7227011 0.8047205 0.8034852 0.8274662 0.5552580 0.4339562 
      IEF       TLT 
0.3954464 0.3863955 
> (grandMeanBaseCors <- mean(instrumentAverageBaseCors))
[1] 0.7054693

In other words, pretty ugly. All sorts of ugly, but I suppose this is what happens when limiting the choices to ETFs in inception since 2003. So remember that number. A correlation north of .70 on average among all the instruments.

Now, onto the main thrust of the topic of this post:

In the previous post, we saw that some highly successful instruments, when analyzed at their own scale, such as SHY (the short term bonds ETF), had spectacular performances. However, in the grand scheme of things, due to identical notional risk allocation, the fact that SHY itself just didn’t move as much as, say, the SPDR sector ETFs meant that its performance could not make as much of an impact in the portfolio performance. This implication meant that despite having 30 instruments in the portfolio, not only were the base instruments highly correlated (quandl futures data algorithm coming sometime in the future!), but beyond that, the performance was dominated by the most volatile among them. This is clearly undesirable, and with most trading information in the public domain looking at a “trading system” as just a set of indicators, signals, and rules on one instrument at a time, there is very little emphasis placed on relative position sizing, with the occasional thoughtful writer saying “my order size is based on dividing some notional amount by some ATR”, and leaving it at that.

How important is that one little detail? As Andreas Clenow has pointed out in his post, it is extremely important, and in many cases, far more important than a couple of simplistic rules.

The approach I take is rooted in futures trading. In futures trading, due to the discontinuous nature of contracts, in order to formulate a backtest, quants/engineers/traders/whoever have to create a continuous contract, going back in time, and have to find some way to smooth over those price discontinuities between the two contracts they roll between at any point in time. More often than not, these changes add up quickly, and so, any computation that was sensitive to the addition of a scalar quantity was instantly off the table (this means that anything depending on percentage changes in price? Gone). One solution to this is the Average True Range, which not only succeeds in this regard, but also isn’t penalized by directional volatility, like standard deviation in a trend (consider a monotonically rising price–a moving average across that time period would constantly lag the current quantity, and a standard deviation would consistently punish that divergence). Furthermore, if I have not yet stated it already, the ATR has a very important interpretation for position sizing:

It’s a measure of the actual dollar movement of the security.

What does this mean? It means that rather that rather than ordering a notional quantity of the security, the trading system can instead order a specific level of *risk*, regardless of the notional price. This allows a trading system simulation to *force* equal risk contributions from all securities involved in the system. My implementation of this idea (found in my IKTrading package, see my about page for my github link) grew into a little bit of a Swiss army knife to include maximum position sizing, and a rebalancing feature.

Here’s the function, along with a necessary sister function:

"lagATR" <- function(HLC, n=14, maType, lag=1, ...) {
  ATR <- ATR(HLC, n=n, maType=maType, ...)
  ATR <- lag(ATR, lag)
  out <- ATR$atr
  colnames(out) <- "atr"
  return(out)
}

"osDollarATR" <- function(orderside, tradeSize, pctATR, maxPctATR=pctATR, data, timestamp, symbol,
                        prefer="Open", portfolio, integerQty=TRUE, atrMod="", rebal=FALSE, ...) {
  if(tradeSize > 0 & orderside == "short"){
    tradeSize <- tradeSize*-1
  }
  pos <- getPosQty(portfolio, symbol, timestamp)
  atrString <- paste0("atr",atrMod)
  atrCol <- grep(atrString, colnames(mktdata))
  if(length(atrCol)==0) {
    stop(paste("Term", atrString, "not found in mktdata column names."))
  }
  atrTimeStamp <- mktdata[timestamp, atrCol]
  if(is.na(atrTimeStamp) | atrTimeStamp==0) {
    stop(paste("ATR corresponding to",atrString,"is invalid at this point in time. 
               Add a logical operator to account for this."))
  }
  dollarATR <- pos*atrTimeStamp
  desiredDollarATR <- pctATR*tradeSize
  remainingRiskCapacity <- tradeSize*maxPctATR-dollarATR
  
  if(orderside == "long"){
    qty <- min(tradeSize*pctATR/atrTimeStamp, remainingRiskCapacity/atrTimeStamp)
  } else {
    qty <- max(tradeSize*pctATR/atrTimeStamp, remainingRiskCapacity/atrTimeStamp)
  }
  
  if(integerQty) {
    qty <- trunc(qty)
  }
  if(!rebal) {
    if(orderside == "long" & qty < 0) {
      qty <- 0
    }
    if(orderside == "short" & qty > 0) {
      qty <- 0
    }
  }
  if(rebal) {
    if(pos == 0) {
      qty <- 0
    }
  }
  return(qty)
}

To get it out of the way, the lagATR function exists to, as its name says, lag the ATR computation, in order to prevent look-ahead bias. After all, you cannot buy the open using an ATR value computed at the close of that same day.

Now, moving onto the actual osDollarATR function, the way it works is like this: it has the user specify a notional trade size (tradeSize), that is, a notional dollar amount, and then the risk level the user would like on that notional dollar amount (pctATR). And here’s where it gets fun–by multiplying the notional dollar amount by the percentage ATR, it allows the strategy to basically buy units of ATR. Beyond this, for strategies that scale in, pyramid, dollar-cost-average, or otherwise stack up positions, there is functionality to cap the risk, along with a feature that would check if the maximum risk level had been breached, and to pare down (not featured in this demonstration). Essentially, inherent in this conversion from dollars to ATR is an implicit variable leverage factor. That is, consider a security A that had an ATR for a given period of $2, that was priced for $50. Now consider another security B that was priced at $100 with an ATR for the same period of $1. If you wished to risk a notional 2% of $10,000 (that is, $200 worth of ATR), you’d only need 100 units of security A, essentially staying 50% in cash for that transaction, while for security B, you’d actually leverage 2:1 in order to purchase 200 units, even if you “lack” the notional capital. Obviously, since this is a computer, the function is assuming that you can actually *obtain* the proper leverage to properly position-size. But beyond that, this function inherently embodies the idea of showing “why leverage is pointless”.

The strategy is identical to the previous post’s, using the same TVI(20,0) indicator (or if you want, (20,0,1), if you take into account the triggerLag parameter), with one key difference: rather than using the equal dollar weight order-sizing function, I will instead use this new ATR order sizing function.

Here’s the code:

require(DSTrading)
require(IKTrading)
require(quantstrat)

initDate="1990-01-01"
from="2003-01-01"
to="2010-12-31"

#to rerun the strategy, rerun everything below this line
source("demoData.R") #contains all of the data-related boilerplate.

#trade sizing and initial equity settings
tradeSize <- 10000
initEq <- tradeSize*length(symbols)

strategy.st <- portfolio.st <- account.st <- "TVI_osATR"
rm.strat(portfolio.st)
rm.strat(strategy.st)
initPortf(portfolio.st, symbols=symbols, initDate=initDate, currency='USD')
initAcct(account.st, portfolios=portfolio.st, initDate=initDate, currency='USD',initEq=initEq)
initOrders(portfolio.st, initDate=initDate)
strategy(strategy.st, store=TRUE)

#parameters (trigger lag unchanged, defaulted at 1)
delta=0
period=20
pctATR=.02 #control risk with this parameter

#indicators
add.indicator(strategy.st, name="TVI", arguments=list(x=quote(Cl(mktdata)), period=period, delta=delta), label="TVI")
add.indicator(strategy.st, name="lagATR", arguments=list(HLC=quote(HLC(mktdata)), n=period), label="atrX")

#signals
add.signal(strategy.st, name="sigThreshold", 
           arguments=list(threshold=1, column="vigor.TVI", relationship="gte", cross=FALSE),
           label="TVIgtThresh")
add.signal(strategy.st, name="sigComparison",
           arguments=list(columns=c("vigor.TVI","trigger.TVI"), relationship="gt"),
           label="TVIgtLag")
add.signal(strategy.st, name="sigAND",
           arguments=list(columns=c("TVIgtThresh","TVIgtLag"), cross=TRUE),
           label="longEntry")
add.signal(strategy.st, name="sigCrossover",
           arguments=list(columns=c("vigor.TVI","trigger.TVI"), relationship="lt"),
           label="longExit")

#rules
add.rule(strategy.st, name="ruleSignal", 
         arguments=list(sigcol="longEntry", sigval=TRUE, ordertype="market", 
                        orderside="long", replace=FALSE, prefer="Open", osFUN=osDollarATR,
                        tradeSize=tradeSize, pctATR=pctATR, atrMod="X"), 
         type="enter", path.dep=TRUE)
add.rule(strategy.st, name="ruleSignal", 
         arguments=list(sigcol="longExit", sigval=TRUE, orderqty="all", ordertype="market", 
                        orderside="long", replace=FALSE, prefer="Open"), 
         type="exit", path.dep=TRUE)


#apply strategy
t1 <- Sys.time()
out <- applyStrategy(strategy=strategy.st,portfolios=portfolio.st)
t2 <- Sys.time()
print(t2-t1)


#set up analytics
updatePortf(portfolio.st)
dateRange <- time(getPortfolio(portfolio.st)$summary)[-1]
updateAcct(portfolio.st,dateRange)
updateEndEq(account.st)

Notice the addition of the new indicator (using an ATR period tied to the TVI period of 20), and the modified entry rule. Also, a small detail is the atrMod string modifier. This modifies the string “atr”, by appending the modifier to the end of it. While it looks superfluous at first, the reason for this addition is in case the user wishes to make use of multiple atr indicators, and thereby allowing the order sizing function to locate the appropriate column. Also note that the label on the indicator has to be the term “atr” and then the modifier. If this seems slightly kludge-y, I’m open for any suggestions.

One other thing to note–the computation for the ATR order stream should have valid values before the first order signal fires, or it will not work. That is, consider a system that, for argument’s sake, has a 20-day period to compute its indicator (such as TVI(20,0)), but a 100-day ATR computation. At the beginning of the data, it could very well be the case that there is not yet a valid value for the ATR computation, and therefore, a valid order quantity cannot be returned.

So, those two notes about using this function dealt with, let’s move onto the results.

Here are the trade stats:

#tradeStats
tStats <- tradeStats(Portfolios = portfolio.st, use="trades", inclZeroDays=FALSE)
tStats[,4:ncol(tStats)] <- round(tStats[,4:ncol(tStats)], 2)
print(data.frame(t(tStats[,-c(1,2)])))
(aggPF <- sum(tStats$Gross.Profits)/-sum(tStats$Gross.Losses))
(aggCorrect <- mean(tStats$Percent.Positive))
(numTrades <- sum(tStats$Num.Trades))
(meanAvgWLR <- mean(tStats$Avg.WinLoss.Ratio))


                        EFA      EPP      EWA      EWC      EWG
Num.Txns              63.00    63.00    57.00    67.00    59.00
Num.Trades            32.00    32.00    29.00    34.00    30.00
Net.Trading.PL     15389.57 15578.88 16204.18 11846.58 12646.07
Avg.Trade.PL         480.92   486.84   558.76   348.43   421.54
Med.Trade.PL         185.67   179.37   275.26   -13.31   -15.89
Largest.Winner      2440.60  3542.54  3609.82  3040.75  2875.15
Largest.Loser       -840.30 -1190.45  -937.03 -1199.78  -912.56
Gross.Profits      20142.82 20037.94 20434.89 19120.45 18349.74
Gross.Losses       -4753.25 -4459.05 -4230.71 -7273.88 -5703.66
Std.Dev.Trade.PL     953.83  1055.36  1191.82  1022.49  1097.44
Percent.Positive      65.62    59.38    58.62    50.00    43.33
Percent.Negative      34.38    40.62    41.38    50.00    56.67
Profit.Factor          4.24     4.49     4.83     2.63     3.22
Avg.Win.Trade        959.18  1054.63  1202.05  1124.73  1411.52
Med.Win.Trade        902.74   722.86   592.03  1075.71  1042.79
Avg.Losing.Trade    -432.11  -343.00  -352.56  -427.88  -335.51
Med.Losing.Trade    -450.96  -231.60  -284.15  -377.76  -346.90
Avg.Daily.PL         489.72   495.27   565.90   314.01   438.00
Med.Daily.PL         163.09   133.15   243.61   -56.13   -14.28
Std.Dev.Daily.PL     968.28  1071.71  1213.06  1018.14  1113.09
Ann.Sharpe             8.03     7.34     7.41     4.90     6.25
Max.Drawdown       -2338.43 -2430.09 -2168.66 -2982.50 -2904.73
Profit.To.Max.Draw     6.58     6.41     7.47     3.97     4.35
Avg.WinLoss.Ratio      2.22     3.07     3.41     2.63     4.21
Med.WinLoss.Ratio      2.00     3.12     2.08     2.85     3.01
Max.Equity         15968.41 16789.50 17435.72 13048.24 13773.99
Min.Equity           -17.93  -188.46     0.00  -393.45  -100.42
End.Equity         15389.57 15578.88 16204.18 11846.58 12646.07

                        EWH      EWJ      EWS      EWT      EWU
Num.Txns              57.00    69.00    53.00    61.00    55.00
Num.Trades            29.00    34.00    27.00    31.00    27.00
Net.Trading.PL     12085.74  7457.81 13356.23  6906.24  7492.71
Avg.Trade.PL         416.75   219.35   494.68   222.78   277.51
Med.Trade.PL         192.70   -34.71   425.41   -52.39    87.70
Largest.Winner      2924.25  2586.20  3268.76  1965.93  2715.28
Largest.Loser      -1552.50  -854.08  -631.60 -1052.89  -999.50
Gross.Profits      16111.39 12289.56 15881.04 13110.95 12459.02
Gross.Losses       -4025.66 -4831.75 -2524.81 -6204.71 -4966.31
Std.Dev.Trade.PL     925.26   736.30   848.37   883.21   872.02
Percent.Positive      68.97    47.06    70.37    48.39    59.26
Percent.Negative      31.03    52.94    29.63    51.61    40.74
Profit.Factor          4.00     2.54     6.29     2.11     2.51
Avg.Win.Trade        805.57   768.10   835.84   874.06   778.69
Med.Win.Trade        465.57   571.09   576.83   517.53   542.01
Avg.Losing.Trade    -447.30  -268.43  -315.60  -387.79  -451.48
Med.Losing.Trade    -413.37  -206.93  -338.84  -322.41  -433.08
Avg.Daily.PL         434.15   169.87   504.61   129.14   284.11
Med.Daily.PL         201.67   -36.02   430.95   -54.67    72.31
Std.Dev.Daily.PL     937.40   687.94   863.57   725.09   888.60
Ann.Sharpe             7.35     3.92     9.28     2.83     5.08
Max.Drawdown       -2229.93 -4036.69 -2021.12 -3147.85 -2599.57
Profit.To.Max.Draw     5.42     1.85     6.61     2.19     2.88
Avg.WinLoss.Ratio      1.80     2.86     2.65     2.25     1.72
Med.WinLoss.Ratio      1.13     2.76     1.70     1.61     1.25
Max.Equity         13043.23  8395.92 14415.11  6906.24  9160.15
Min.Equity           -33.87  -274.69  -699.37  -788.28  -327.38
End.Equity         12085.74  7457.81 13356.23  6906.24  7492.71

                        EWY      EWZ      EZU      IEF      IGE
Num.Txns              63.00    65.00    57.00    62.00    67.00
Num.Trades            32.00    33.00    29.00    31.00    34.00
Net.Trading.PL      9736.49 16814.33 13135.27 17932.39 13435.41
Avg.Trade.PL         304.27   509.53   452.94   578.46   395.16
Med.Trade.PL          61.08   295.06    94.54   362.74    32.80
Largest.Winner      2278.76  2821.49  2805.66  4412.27  2955.08
Largest.Loser       -915.90 -1170.96 -1222.74  -836.09  -763.29
Gross.Profits      14597.54 22199.95 18539.53 21651.92 18691.32
Gross.Losses       -4861.05 -5385.61 -5404.25 -3719.52 -5255.91
Std.Dev.Trade.PL     815.28  1006.45  1097.26  1097.78   984.69
Percent.Positive      53.12    57.58    55.17    70.97    52.94
Percent.Negative      46.88    42.42    44.83    29.03    47.06
Profit.Factor          3.00     4.12     3.43     5.82     3.56
Avg.Win.Trade        858.68  1168.42  1158.72   984.18  1038.41
Med.Win.Trade        617.31  1071.08  1068.20   552.55   708.61
Avg.Losing.Trade    -324.07  -384.69  -415.71  -413.28  -328.49
Med.Losing.Trade    -293.26  -391.20  -339.56  -420.83  -303.28
Avg.Daily.PL         296.04   510.77   465.74   578.46   324.22
Med.Daily.PL           8.30   249.20    89.51   362.74    17.63
Std.Dev.Daily.PL     827.41  1022.53  1115.19  1097.78   907.45
Ann.Sharpe             5.68     7.93     6.63     8.36     5.67
Max.Drawdown       -2689.16 -2599.61 -2764.56 -1475.57 -2439.52
Profit.To.Max.Draw     3.62     6.47     4.75    12.15     5.51
Avg.WinLoss.Ratio      2.65     3.04     2.79     2.38     3.16
Med.WinLoss.Ratio      2.10     2.74     3.15     1.31     2.34
Max.Equity          9736.49 17637.00 14909.94 18695.22 13435.41
Min.Equity          -392.89     0.00     0.00  -127.86  -654.86
End.Equity          9736.49 16814.33 13135.27 17932.39 13435.41

                        IYR      IYZ      LQD      RWR      SHY
Num.Txns              57.00    67.00    60.00    57.00    54.00
Num.Trades            29.00    34.00    30.00    29.00    25.00
Net.Trading.PL     13555.67  7434.57 12091.15 13301.24 31955.85
Avg.Trade.PL         467.44   218.66   403.04   458.66  1278.23
Med.Trade.PL         137.55   -65.13   133.08   142.52   261.88
Largest.Winner      6726.10  1967.48  2512.92  2396.20 13432.83
Largest.Loser       -511.83  -931.17 -1902.27  -664.22  -887.59
Gross.Profits      17122.17 13327.47 16376.88 17323.42 34748.07
Gross.Losses       -3566.50 -5892.89 -4285.72 -4022.18 -2792.21
Std.Dev.Trade.PL    1379.47   754.07   947.51   914.56  2874.15
Percent.Positive      62.07    44.12    66.67    55.17    64.00
Percent.Negative      37.93    55.88    33.33    44.83    36.00
Profit.Factor          4.80     2.26     3.82     4.31    12.44
Avg.Win.Trade        951.23   888.50   818.84  1082.71  2171.75
Med.Win.Trade        338.57   542.36   623.46   929.54  1104.65
Avg.Losing.Trade    -324.23  -310.15  -428.57  -309.40  -310.25
Med.Losing.Trade    -377.80  -289.92  -311.99  -232.44  -336.51
Avg.Daily.PL         471.34   177.85   403.04   461.77  1278.23
Med.Daily.PL         129.71   -70.50   133.08   127.80   261.88
Std.Dev.Daily.PL    1404.62   726.63   947.51   931.19  2874.15
Ann.Sharpe             5.33     3.89     6.75     7.87     7.06
Max.Drawdown       -2623.12 -2791.39 -3237.00 -2463.55 -1756.33
Profit.To.Max.Draw     5.17     2.66     3.74     5.40    18.19
Avg.WinLoss.Ratio      2.93     2.86     1.91     3.50     7.00
Med.WinLoss.Ratio      0.90     1.87     2.00     4.00     3.28
Max.Equity         15608.04  8133.92 12349.90 14777.73 32781.60
Min.Equity          -473.13  -520.47  -146.25  -314.85   -63.98
End.Equity         13555.67  7434.57 12091.15 13301.24 31955.85

                        TLT      XLB      XLE      XLF      XLI
Num.Txns              66.00    69.00    75.00    67.00    61.00
Num.Trades            33.00    35.00    38.00    34.00    31.00
Net.Trading.PL      9170.38  6286.92  9724.35  6689.67  9474.51
Avg.Trade.PL         277.89   179.63   255.90   196.76   305.63
Med.Trade.PL          -9.84   -92.05    -2.16   -65.18   165.99
Largest.Winner      2658.27  1727.45  2624.41  1948.36  1610.51
Largest.Loser       -797.00  -821.66  -686.89  -470.70  -762.56
Gross.Profits      15454.01 12787.87 15637.04 10744.46 13894.65
Gross.Losses       -6283.62 -6500.94 -5912.69 -4054.78 -4420.15
Std.Dev.Trade.PL     902.92   707.04   857.84   599.09   700.96
Percent.Positive      48.48    45.71    47.37    47.06    54.84
Percent.Negative      51.52    54.29    52.63    52.94    45.16
Profit.Factor          2.46     1.97     2.64     2.65     3.14
Avg.Win.Trade        965.88   799.24   868.72   671.53   817.33
Med.Win.Trade        721.04   790.04   632.93   515.21   885.41
Avg.Losing.Trade    -369.62  -342.15  -295.63  -225.27  -315.72
Med.Losing.Trade    -417.82  -309.84  -236.16  -188.27  -301.85
Avg.Daily.PL         277.89   126.90   186.61   198.53   262.31
Med.Daily.PL          -9.84   -97.36    -3.15   -95.20   147.54
Std.Dev.Daily.PL     902.92   644.05   754.17   608.29   669.41
Ann.Sharpe             4.89     3.13     3.93     5.18     6.22
Max.Drawdown       -4200.46 -2545.47 -3708.60 -2393.02 -2159.46
Profit.To.Max.Draw     2.18     2.47     2.62     2.80     4.39
Avg.WinLoss.Ratio      2.61     2.34     2.94     2.98     2.59
Med.WinLoss.Ratio      1.73     2.55     2.68     2.74     2.93
Max.Equity         11046.45  6319.32 10527.81  8171.61  9481.43
Min.Equity          -367.76  -489.76  -301.10  -458.76  -348.23
End.Equity          9170.38  6286.92  9724.35  6689.67  9474.51

                        XLK      XLP      XLU      XLV      XLY
Num.Txns              65.00    73.00    57.00    71.00    59.00
Num.Trades            33.00    37.00    28.00    36.00    30.00
Net.Trading.PL      6074.82  6211.79 14167.62  2959.63 10416.38
Avg.Trade.PL         184.09   167.89   505.99    82.21   347.21
Med.Trade.PL          45.54    -6.88   218.93    35.12    54.36
Largest.Winner      2118.84  1518.72  2715.03  1515.40  2324.63
Largest.Loser       -800.36  -710.82  -595.12 -1025.77  -814.78
Gross.Profits      12263.07 12061.50 16821.17  9472.62 14850.49
Gross.Losses       -6188.26 -5849.72 -2653.56 -6512.99 -4434.12
Std.Dev.Trade.PL     714.36   617.33   862.82   582.88   861.18
Percent.Positive      51.52    45.95    75.00    55.56    53.33
Percent.Negative      48.48    54.05    25.00    44.44    46.67
Profit.Factor          1.98     2.06     6.34     1.45     3.35
Avg.Win.Trade        721.36   709.50   801.01   473.63   928.16
Med.Win.Trade        653.80   760.76   782.21   301.14   746.86
Avg.Losing.Trade    -386.77  -292.49  -379.08  -407.06  -316.72
Med.Losing.Trade    -300.13  -203.01  -491.90  -310.13  -267.52
Avg.Daily.PL         187.13   164.72   521.39    82.91   302.83
Med.Daily.PL           4.72    -7.27   249.47    33.66    23.93
Std.Dev.Daily.PL     725.58   625.78   875.33   591.37   840.78
Ann.Sharpe             4.09     4.18     9.46     2.23     5.72
Max.Drawdown       -2615.33 -2565.79 -1696.88 -2604.95 -2431.47
Profit.To.Max.Draw     2.32     2.42     8.35     1.14     4.28
Avg.WinLoss.Ratio      1.87     2.43     2.11     1.16     2.93
Med.WinLoss.Ratio      2.18     3.75     1.59     0.97     2.79
Max.Equity          6786.94  6374.13 14371.31  4236.64 10538.74
Min.Equity          -523.50  -269.87     0.00  -205.49  -154.97
End.Equity          6074.82  6211.79 14167.62  2959.63 10416.38

And aggregate daily stats:

> (aggPF <- sum(tStats$Gross.Profits)/-sum(tStats$Gross.Losses))
[1] 3.37825
> (aggCorrect <- mean(tStats$Percent.Positive))
[1] 55.921
> (numTrades <- sum(tStats$Num.Trades))
[1] 946
> (meanAvgWLR <- mean(tStats$Avg.WinLoss.Ratio))
[1] 2.766667

If you scroll down to the end of the , you can see that the aggregate profit factor broke above 3 per trade (that is, when you aggregate all the trades on their own merit, you take away more than $3 for every $1 that the market claims, and even the standalone average per-instrument win to loss ratio improved (you’ll see why in a moment).

Here are the daily stats:

#dailyStats
dStats <- dailyStats(Portfolios = portfolio.st, use="Equity")
rownames(dStats) <- gsub(".DailyEndEq","", rownames(dStats))
print(data.frame(t(dStats)))


                         EFA       EPP       EWA       EWC       EWG
Total.Net.Profit    15389.57  15578.88  16204.18  11846.58  12646.07
Total.Days           1316.00   1323.00   1303.00   1297.00   1281.00
Winning.Days          713.00    722.00    730.00    729.00    719.00
Losing.Days           603.00    601.00    573.00    568.00    562.00
Avg.Day.PL             11.69     11.78     12.44      9.13      9.87
Med.Day.PL             16.38     16.83     21.71     21.41     20.15
Largest.Winner        677.61    663.11   1056.94    449.52    525.11
Largest.Loser        -951.74  -1054.27  -1049.55   -576.75   -880.58
Gross.Profits       82528.83  93453.33  86183.11  74841.31  78603.60
Gross.Losses       -67139.26 -77874.45 -69978.93 -62994.74 -65957.53
Std.Dev.Daily.PL      147.33    171.22    159.08    134.32    147.41
Percent.Positive       54.18     54.57     56.02     56.21     56.13
Percent.Negative       45.82     45.43     43.98     43.79     43.87
Profit.Factor           1.23      1.20      1.23      1.19      1.19
Avg.Win.Day           115.75    129.44    118.06    102.66    109.32
Med.Win.Day            96.00    104.99     98.53     88.60     88.28
Avg.Losing.Day       -111.34   -129.57   -122.13   -110.91   -117.36
Med.Losing.Day        -86.50    -92.48    -89.56    -82.30    -87.95
Avg.Daily.PL           11.69     11.78     12.44      9.13      9.87
Med.Daily.PL           16.38     16.83     21.71     21.41     20.15
Std.Dev.Daily.PL.1    147.33    171.22    159.08    134.32    147.41
Ann.Sharpe              1.26      1.09      1.24      1.08      1.06
Max.Drawdown        -2338.43  -2430.09  -2168.66  -2982.50  -2904.73
Profit.To.Max.Draw      6.58      6.41      7.47      3.97      4.35
Avg.WinLoss.Ratio       1.04      1.00      0.97      0.93      0.93
Med.WinLoss.Ratio       1.11      1.14      1.10      1.08      1.00
Max.Equity          15968.41  16789.50  17435.72  13048.24  13773.99
Min.Equity            -17.93   -188.46      0.00   -393.45   -100.42
End.Equity          15389.57  15578.88  16204.18  11846.58  12646.07

                         EWH       EWJ       EWS       EWT       EWU
Total.Net.Profit    12085.74   7457.81  13356.23   6906.24   7492.71
Total.Days           1246.00   1108.00   1302.00   1173.00   1250.00
Winning.Days          667.00    568.00    726.00    608.00    670.00
Losing.Days           579.00    540.00    576.00    565.00    580.00
Avg.Day.PL              9.70      6.73     10.26      5.89      5.99
Med.Day.PL             12.96     11.70     20.48      8.74     15.91
Largest.Winner        518.58    677.56    659.34    716.23    557.67
Largest.Loser        -977.28   -498.25  -1032.26  -1114.68   -922.23
Gross.Profits       76296.60  72956.55  76089.41  69500.58  71225.98
Gross.Losses       -64210.86 -65498.74 -62733.18 -62594.34 -63733.27
Std.Dev.Daily.PL      148.85    163.57    140.94    149.35    139.57
Percent.Positive       53.53     51.26     55.76     51.83     53.60
Percent.Negative       46.47     48.74     44.24     48.17     46.40
Profit.Factor           1.19      1.11      1.21      1.11      1.12
Avg.Win.Day           114.39    128.44    104.81    114.31    106.31
Med.Win.Day            89.18     99.48     82.86     92.69     91.01
Avg.Losing.Day       -110.90   -121.29   -108.91   -110.79   -109.88
Med.Losing.Day        -82.75    -92.33    -86.52    -80.77    -82.34
Avg.Daily.PL            9.70      6.73     10.26      5.89      5.99
Med.Daily.PL           12.96     11.70     20.48      8.74     15.91
Std.Dev.Daily.PL.1    148.85    163.57    140.94    149.35    139.57
Ann.Sharpe              1.03      0.65      1.16      0.63      0.68
Max.Drawdown        -2229.93  -4036.69  -2021.12  -3147.85  -2599.57
Profit.To.Max.Draw      5.42      1.85      6.61      2.19      2.88
Avg.WinLoss.Ratio       1.03      1.06      0.96      1.03      0.97
Med.WinLoss.Ratio       1.08      1.08      0.96      1.15      1.11
Max.Equity          13043.23   8395.92  14415.11   6906.24   9160.15
Min.Equity            -33.87   -274.69   -699.37   -788.28   -327.38
End.Equity          12085.74   7457.81  13356.23   6906.24   7492.71

                         EWY       EWZ       EZU       IEF       IGE
Total.Net.Profit     9736.49  16814.33  13135.27  17932.39  13435.41
Total.Days           1245.00   1368.00   1288.00   1220.00   1288.00
Winning.Days          687.00    770.00    702.00    647.00    710.00
Losing.Days           558.00    598.00    586.00    573.00    578.00
Avg.Day.PL              7.82     12.29     10.20     14.70     10.43
Med.Day.PL             19.58     24.81     18.68     15.24     22.02
Largest.Winner        551.45    638.31    641.61    718.28    641.62
Largest.Loser        -850.59   -873.96  -1149.58   -629.94   -585.35
Gross.Profits       78146.89  91623.76  78313.24  89399.23  87064.44
Gross.Losses       -68410.40 -74809.43 -65177.97 -71466.84 -73629.04
Std.Dev.Daily.PL      155.20    158.93    147.61    169.04    160.78
Percent.Positive       55.18     56.29     54.50     53.03     55.12
Percent.Negative       44.82     43.71     45.50     46.97     44.88
Profit.Factor           1.14      1.22      1.20      1.25      1.18
Avg.Win.Day           113.75    118.99    111.56    138.18    122.63
Med.Win.Day            92.47     99.96     89.60    111.01    100.82
Avg.Losing.Day       -122.60   -125.10   -111.23   -124.72   -127.39
Med.Losing.Day        -87.06    -96.89    -82.02   -100.19   -101.57
Avg.Daily.PL            7.82     12.29     10.20     14.70     10.43
Med.Daily.PL           19.58     24.81     18.68     15.24     22.02
Std.Dev.Daily.PL.1    155.20    158.93    147.61    169.04    160.78
Ann.Sharpe              0.80      1.23      1.10      1.38      1.03
Max.Drawdown        -2689.16  -2599.61  -2764.56  -1475.57  -2439.52
Profit.To.Max.Draw      3.62      6.47      4.75     12.15      5.51
Avg.WinLoss.Ratio       0.93      0.95      1.00      1.11      0.96
Med.WinLoss.Ratio       1.06      1.03      1.09      1.11      0.99
Max.Equity           9736.49  17637.00  14909.94  18695.22  13435.41
Min.Equity           -392.89      0.00      0.00   -127.86   -654.86
End.Equity           9736.49  16814.33  13135.27  17932.39  13435.41

                         IYR       IYZ       LQD       RWR       SHY
Total.Net.Profit    13555.67   7434.57  12091.15  13301.24  31955.85
Total.Days           1312.00   1213.00   1290.00   1324.00   1403.00
Winning.Days          711.00    641.00    720.00    713.00    796.00
Losing.Days           601.00    572.00    570.00    611.00    607.00
Avg.Day.PL             10.33      6.13      9.37     10.05     22.78
Med.Day.PL             13.97     11.30     13.65     14.07     23.56
Largest.Winner        690.00    539.17    414.09    701.08    743.43
Largest.Loser        -995.13   -747.09  -1607.99   -999.24   -896.22
Gross.Profits       80483.61  60768.48  65938.33  81751.44 104570.57
Gross.Losses       -66927.95 -53333.91 -53847.18 -68450.20 -72614.72
Std.Dev.Daily.PL      150.96    123.03    125.94    153.36    167.92
Percent.Positive       54.19     52.84     55.81     53.85     56.74
Percent.Negative       45.81     47.16     44.19     46.15     43.26
Profit.Factor           1.20      1.14      1.22      1.19      1.44
Avg.Win.Day           113.20     94.80     91.58    114.66    131.37
Med.Win.Day            95.20     70.59     74.82     94.50     95.01
Avg.Losing.Day       -111.36    -93.24    -94.47   -112.03   -119.63
Med.Losing.Day        -79.94    -70.65    -73.01    -78.78    -95.52
Avg.Daily.PL           10.33      6.13      9.37     10.05     22.78
Med.Daily.PL           13.97     11.30     13.65     14.07     23.56
Std.Dev.Daily.PL.1    150.96    123.03    125.94    153.36    167.92
Ann.Sharpe              1.09      0.79      1.18      1.04      2.15
Max.Drawdown        -2623.12  -2791.39  -3237.00  -2463.55  -1756.33
Profit.To.Max.Draw      5.17      2.66      3.74      5.40     18.19
Avg.WinLoss.Ratio       1.02      1.02      0.97      1.02      1.10
Med.WinLoss.Ratio       1.19      1.00      1.02      1.20      0.99
Max.Equity          15608.04   8133.92  12349.90  14777.73  32781.60
Min.Equity           -473.13   -520.47   -146.25   -314.85    -63.98
End.Equity          13555.67   7434.57  12091.15  13301.24  31955.85

                         TLT       XLB       XLE       XLF       XLI
Total.Net.Profit     9170.38   6286.92   9724.35   6689.67   9474.51
Total.Days           1177.00   1262.00   1306.00   1153.00   1285.00
Winning.Days          613.00    680.00    702.00    607.00    711.00
Losing.Days           564.00    582.00    604.00    546.00    574.00
Avg.Day.PL              7.79      4.98      7.45      5.80      7.37
Med.Day.PL             14.24     13.77     12.90     11.39     12.93
Largest.Winner        779.53    558.63    506.82    417.23    725.14
Largest.Loser        -626.74   -760.41   -498.32   -870.83   -603.54
Gross.Profits       80421.50  70434.95  78663.61  58593.75  63680.92
Gross.Losses       -71251.12 -64148.03 -68939.26 -51904.08 -54206.41
Std.Dev.Daily.PL      169.42    137.85    145.10    126.64    121.34
Percent.Positive       52.08     53.88     53.75     52.65     55.33
Percent.Negative       47.92     46.12     46.25     47.35     44.67
Profit.Factor           1.13      1.10      1.14      1.13      1.17
Avg.Win.Day           131.19    103.58    112.06     96.53     89.57
Med.Win.Day           100.56     87.71     92.88     73.21     70.48
Avg.Losing.Day       -126.33   -110.22   -114.14    -95.06    -94.44
Med.Losing.Day        -96.87    -84.01    -92.03    -68.77    -74.02
Avg.Daily.PL            7.79      4.98      7.45      5.80      7.37
Med.Daily.PL           14.24     13.77     12.90     11.39     12.93
Std.Dev.Daily.PL.1    169.42    137.85    145.10    126.64    121.34
Ann.Sharpe              0.73      0.57      0.81      0.73      0.96
Max.Drawdown        -4200.46  -2545.47  -3708.60  -2393.02  -2159.46
Profit.To.Max.Draw      2.18      2.47      2.62      2.80      4.39
Avg.WinLoss.Ratio       1.04      0.94      0.98      1.02      0.95
Med.WinLoss.Ratio       1.04      1.04      1.01      1.06      0.95
Max.Equity          11046.45   6319.32  10527.81   8171.61   9481.43
Min.Equity           -367.76   -489.76   -301.10   -458.76   -348.23
End.Equity           9170.38   6286.92   9724.35   6689.67   9474.51

                         XLK       XLP       XLU       XLV       XLY
Total.Net.Profit     6074.82   6211.79  14167.62   2959.63  10416.38
Total.Days           1216.00   1284.00   1388.00   1178.00   1234.00
Winning.Days          674.00    705.00    770.00    617.00    653.00
Losing.Days           542.00    579.00    618.00    561.00    581.00
Avg.Day.PL              5.00      4.84     10.21      2.51      8.44
Med.Day.PL             17.93     15.90     16.14      6.56     12.17
Largest.Winner        574.72    900.15    556.47    473.90    769.98
Largest.Loser        -724.67   -556.91   -838.97   -710.57   -629.37
Gross.Profits       61490.68  61791.76  69063.01  54247.40  64353.02
Gross.Losses       -55415.86 -55579.98 -54895.40 -51287.76 -53936.65
Std.Dev.Daily.PL      125.72    118.81    118.48    117.04    126.47
Percent.Positive       55.43     54.91     55.48     52.38     52.92
Percent.Negative       44.57     45.09     44.52     47.62     47.08
Profit.Factor           1.11      1.11      1.26      1.06      1.19
Avg.Win.Day            91.23     87.65     89.69     87.92     98.55
Med.Win.Day            73.60     71.94     71.86     72.65     77.55
Avg.Losing.Day       -102.24    -95.99    -88.83    -91.42    -92.83
Med.Losing.Day        -74.44    -75.68    -64.76    -73.67    -74.04
Avg.Daily.PL            5.00      4.84     10.21      2.51      8.44
Med.Daily.PL           17.93     15.90     16.14      6.56     12.17
Std.Dev.Daily.PL.1    125.72    118.81    118.48    117.04    126.47
Ann.Sharpe              0.63      0.65      1.37      0.34      1.06
Max.Drawdown        -2615.33  -2565.79  -1696.88  -2604.95  -2431.47
Profit.To.Max.Draw      2.32      2.42      8.35      1.14      4.28
Avg.WinLoss.Ratio       0.89      0.91      1.01      0.96      1.06
Med.WinLoss.Ratio       0.99      0.95      1.11      0.99      1.05
Max.Equity           6786.94   6374.13  14371.31   4236.64  10538.74
Min.Equity           -523.50   -269.87      0.00   -205.49   -154.97
End.Equity           6074.82   6211.79  14167.62   2959.63  10416.38


#portfolio cash PL
portPL <- .blotter$portfolio.TVI_osATR$summary$Net.Trading.PL

#Cash Sharpe
(SharpeRatio.annualized(portPL, geometric=FALSE))


> (SharpeRatio.annualized(portPL, geometric=FALSE))
                                Net.Trading.PL
Annualized Sharpe Ratio (Rf=0%)       1.383361

So a cash Sharpe (a conservative estimate) a healthy amount higher than 1. Now let’s look at something interesting. Remember those base instrument correlations at the beginning of this post?

#Portfolio comparisons to SPY
instRets <- PortfReturns(account.st)

#Correlations
instCors <- cor(instRets)
diag(instRets) <- NA
corMeans <- rowMeans(instCors, na.rm=TRUE)
names(corMeans) <- gsub(".DailyEndEq", "", names(corMeans))
print(round(corMeans,3))
mean(corMeans)


> print(round(corMeans,3))
   EFA    EPP    EWA    EWC    EWG    EWH    EWJ    EWS    EWT    EWU 
 0.503  0.456  0.406  0.392  0.457  0.392  0.354  0.417  0.355  0.452 
   EWY    EWZ    EZU    IEF    IGE    IYR    IYZ    LQD    RWR    SHY 
 0.399  0.387  0.471 -0.001  0.384  0.322  0.375  0.078  0.313 -0.013 
   TLT    XLB    XLE    XLF    XLI    XLK    XLP    XLU    XLV    XLY 
 0.009  0.447  0.362  0.407  0.434  0.407  0.333  0.314  0.336  0.412 

> mean(corMeans)
[1] 0.3452772

With this (somewhat) simplistic market timer, the correlations of some dangerously correlated instruments have been, on aggregate, sliced by more than 50%. Pretty impressive, no?

Let’s look at equity curve comparisons.

cumPortfRets <- cumprod(1+portfRets)
firstNonZeroDay <- index(portfRets)[min(which(portfRets!=0))]
getSymbols("SPY", from=firstNonZeroDay, to="2010-12-31")
SPYrets <- diff(log(Cl(SPY)))[-1]
cumSPYrets <- cumprod(1+SPYrets)
comparison <- cbind(cumPortfRets, cumSPYrets)
colnames(comparison)  <- c("strategy", "SPY")
chart.TimeSeries(comparison, legend.loc = "topleft", 
                 main=paste0("Period=", period, ", Delta=",delta), colors=c("green","red"))

2% ATR risk

To compare, here is the equity curve with all three strategies–buy and hold the SPY, and the two TVI strategies–the ATR in green and the equal dollar weight in black.

3 strategy EC

Notice how, with better order sizing, that the recession barely even scratched the equity curve?

Here are the aggregate portfolio statistics:

#Sharpe, Returns, max DD
SharpeRatio.annualized(portfRets)
Return.annualized(portfRets)
maxDrawdown(portfRets)


> SharpeRatio.annualized(portfRets)
                                    [,1]
Annualized Sharpe Ratio (Rf=0%) 1.428448
> Return.annualized(portfRets)
                       [,1]
Annualized Return 0.1504228
> maxDrawdown(portfRets)
[1] 0.1103311

First off: annualized Sharpe Ratio above 1.4. Daily returns. Next, something that personally impresses me: annualized return higher than maximum drawdown. My interpretation of this is that while you *may* have the occasional down year, on average, even in the absolute worst case scenario, it takes you less than a year to recover from your absolute worst drawdown.

And keep in mind, this is with 30 instruments, most of them highly correlated!

Lastly, let’s look at an individual instrument’s equity curve and how the position-sizing algorithm helps out.

#Individual instrument equity curve
chart.Posn(portfolio.st, "XLB")
#The triggerLag is NOT 30 for the strategy, just amplified in this case to illustrate exit logic.
#The actual trigger lag is defaulted at 1.
tmp <- TVI(Cl(XLB), period=period, delta=delta, triggerLag=1)
add_TA(tmp$vigor, lwd=3)
add_TA(tmp$trigger, on=5, col="red", lwd=1.5)
tmp2 <- lagATR(HLC=HLC(XLB), n=period)
add_TA(tmp2$atr, col="blue", lwd=2)

XLB Equity Curve ATR 20

Remember how even the average win to loss ratios went up? This is why. Notice the height of the blue rectangles (position sizes up, duration of trade across), in relation to the ATR (the blue line across the bottom). In the depths of the financial crisis, even though the actual strategy wasn’t intelligent enough to know to keep out, through the use of ATR position sizing, it reduced trade sizes considerably. The result was a failsafe that prevented a great deal of damage to a system that had no idea it was trading against a massive longer time horizon trend going in the opposite direction.

Of course, this does not mean that ATR order sizing on entry is a complete catch-all for everything that can go wrong. At longer time frames, an entry signal’s calculation may have little relevance to the actual risk of the position currently. On this strategy, because I was using a 20-day period, I felt that the issue of rebalancing wouldn’t be a major factor, because old positions were exited, and new positions were entered at a good pace (about 1,000 trades in 7 years is 142 trades per year on average, over 30 instruments, that’s around 4 trades per year per instrument, which puts each trade at a couple of months on average, and considering that rebalancing can happen monthly to quarterly, rebalancing isn’t an issue at this frequency). However, this does not apply to longer time frames.

For instance, if the period (both for the Trend Vigor and for the ATR computation) were changed to 60 days, these are the results:

trade stats:

                        EFA      EPP      EWA      EWC      EWG
Num.Txns              21.00    19.00    17.00    15.00    21.00
Num.Trades            11.00    10.00     9.00     8.00    11.00
Net.Trading.PL     10208.50 17160.90 16467.19 16571.75 10873.05
Avg.Trade.PL         928.05  1716.09  1829.69  2071.47   988.46
Med.Trade.PL        1139.43  1599.47  2284.16  2714.11  1024.49
Largest.Winner      3958.71  6239.36  4809.68  4067.28  5039.72
Largest.Loser      -2055.34 -1680.48 -1293.99  -552.08 -1506.05
Gross.Profits      14866.20 20617.57 19559.85 17387.68 14996.28
Gross.Losses       -4657.70 -3456.67 -3092.66  -815.93 -4123.23
Std.Dev.Trade.PL    1986.71  2532.82  2298.49  1699.23  2040.81
Percent.Positive      63.64    70.00    66.67    75.00    63.64
Percent.Negative      36.36    30.00    33.33    25.00    36.36
Profit.Factor          3.19     5.96     6.32    21.31     3.64
Avg.Win.Trade       2123.74  2945.37  3259.97  2897.95  2142.33
Med.Win.Trade       1635.86  2404.87  3413.33  2931.19  1490.68
Avg.Losing.Trade   -1164.43 -1152.22 -1030.89  -407.97 -1030.81
Med.Losing.Trade   -1165.87 -1088.41  -954.82  -407.97 -1038.36
Avg.Daily.PL         857.26  1696.47  2070.98  2155.75   940.86
Med.Daily.PL         822.59  1306.31  2284.16  2874.79   668.54
Std.Dev.Daily.PL    2079.51  2685.65  3206.53  1817.23  2144.75
Ann.Sharpe             6.54    10.03    10.25    18.83     6.96
Max.Drawdown       -5394.64 -3799.80 -3919.36 -3229.19 -5185.89
Profit.To.Max.Draw     1.89     4.52     4.20     5.13     2.10
Avg.WinLoss.Ratio      1.82     2.56     3.16     7.10     2.08
Med.WinLoss.Ratio      1.40     2.21     3.57     7.18     1.44
Max.Equity         13816.60 18136.21 17072.51 16571.75 14015.59
Min.Equity             0.00  -135.30     0.00  -132.86   -75.34
End.Equity         10208.50 17160.90 16467.19 16571.75 10873.05

                        EWH      EWJ      EWS      EWT      EWU
Num.Txns              19.00    25.00    19.00    21.00    25.00
Num.Trades            10.00    13.00     9.00    11.00    13.00
Net.Trading.PL     12558.12  8228.69 15686.23  4112.81  6421.97
Avg.Trade.PL        1255.81   632.98  1742.91   373.89   494.00
Med.Trade.PL        1286.07    38.30  1543.49   131.24  1188.66
Largest.Winner      5381.90  5983.06  6090.42  2292.56  2041.08
Largest.Loser      -1189.78 -1476.27  -787.18 -1439.03 -1987.03
Gross.Profits      14737.19 12329.23 17166.54  8550.62 10961.68
Gross.Losses       -2179.07 -4100.54 -1480.31 -4437.82 -4539.71
Std.Dev.Trade.PL    1962.01  2047.60  2255.20  1461.94  1278.47
Percent.Positive      70.00    53.85    77.78    63.64    61.54
Percent.Negative      30.00    46.15    22.22    36.36    38.46
Profit.Factor          6.76     3.01    11.60     1.93     2.41
Avg.Win.Trade       2105.31  1761.32  2452.36  1221.52  1370.21
Med.Win.Trade       1722.40   454.78  1586.46  1018.02  1478.14
Avg.Losing.Trade    -726.36  -683.42  -740.16 -1109.45  -907.94
Med.Losing.Trade    -908.19  -673.37  -740.16 -1169.46  -877.51
Avg.Daily.PL        1161.34   543.61  1762.47   113.24   434.83
Med.Daily.PL        1051.12   -79.18  1250.27    73.92   768.38
Std.Dev.Daily.PL    2056.75  2112.00  2410.10  1242.73  1316.60
Ann.Sharpe             8.96     4.09    11.61     1.45     5.24
Max.Drawdown       -4368.83 -6749.29 -3010.28 -4204.52 -4997.13
Profit.To.Max.Draw     2.87     1.22     5.21     0.98     1.29
Avg.WinLoss.Ratio      2.90     2.58     3.31     1.10     1.51
Med.WinLoss.Ratio      1.90     0.68     2.14     0.87     1.68
Max.Equity         13935.41 13216.89 15878.52  4375.25  9759.45
Min.Equity          -281.46     0.00     0.00   -22.49     0.00
End.Equity         12558.12  8228.69 15686.23  4112.81  6421.97

                        EWY      EWZ      EZU      IEF      IGE
Num.Txns              15.00    15.00    19.00    22.00    25.00
Num.Trades             8.00     8.00    10.00    11.00    13.00
Net.Trading.PL     13779.39 23013.79  7849.71 10099.65 14095.94
Avg.Trade.PL        1722.42  2876.72   784.97   918.15  1084.30
Med.Trade.PL        1977.00  2866.24  1019.40   395.20    45.68
Largest.Winner      3889.04  6791.13  2859.00  4103.15  5685.82
Largest.Loser      -1312.72 -1003.77 -1640.20 -1292.50 -1069.15
Gross.Profits      15092.11 24017.56 10979.15 12939.41 17823.91
Gross.Losses       -1312.72 -1003.77 -3129.45 -2839.76 -3727.97
Std.Dev.Trade.PL    1594.21  2830.98  1540.22  1747.80  2125.97
Percent.Positive      87.50    87.50    70.00    63.64    53.85
Percent.Negative      12.50    12.50    30.00    36.36    46.15
Profit.Factor         11.50    23.93     3.51     4.56     4.78
Avg.Win.Trade       2156.02  3431.08  1568.45  1848.49  2546.27
Med.Win.Trade       2339.69  3735.41  1562.23  1595.67  2222.50
Avg.Losing.Trade   -1312.72 -1003.77 -1043.15  -709.94  -621.33
Med.Losing.Trade   -1312.72 -1003.77 -1205.35  -726.74  -543.04
Avg.Daily.PL        1633.02  3143.63   786.64   918.15   989.45
Med.Daily.PL        1614.30  3735.41  1268.81   395.20  -134.88
Std.Dev.Daily.PL    1700.14  2947.08  1633.64  1747.80  2191.58
Ann.Sharpe            15.25    16.93     7.64     8.34     7.17
Max.Drawdown       -4564.52 -4072.32 -5298.53 -4019.55 -3449.65
Profit.To.Max.Draw     3.02     5.65     1.48     2.51     4.09
Avg.WinLoss.Ratio      1.64     3.42     1.50     2.60     4.10
Med.WinLoss.Ratio      1.78     3.72     1.30     2.20     4.09
Max.Equity         13779.39 23910.96 10592.36 12909.83 14200.07
Min.Equity             0.00     0.00  -165.41 -1675.30   -88.76
End.Equity         13779.39 23013.79  7849.71 10099.65 14095.94

                        IYR      IYZ      LQD      RWR      SHY
Num.Txns              17.00    21.00    20.00    19.00    14.00
Num.Trades             9.00    11.00    10.00    10.00     7.00
Net.Trading.PL     12982.75  9649.19  4756.41 11097.68 30866.81
Avg.Trade.PL        1442.53   877.20   475.64  1109.77  4409.54
Med.Trade.PL        1332.53   846.90   172.62  1280.34   449.49
Largest.Winner      3712.91  5017.76  3474.77  4332.24 24644.48
Largest.Loser       -515.27  -977.05  -891.57  -993.55  -259.33
Gross.Profits      13790.04 11967.93  7704.54 13487.26 31126.14
Gross.Losses        -807.29 -2318.75 -2948.14 -2389.57  -259.33
Std.Dev.Trade.PL    1542.81  1654.02  1388.08  1710.13  9013.08
Percent.Positive      77.78    72.73    50.00    70.00    85.71
Percent.Negative      22.22    27.27    50.00    30.00    14.29
Profit.Factor         17.08     5.16     2.61     5.64   120.03
Avg.Win.Trade       1970.01  1495.99  1540.91  1926.75  5187.69
Med.Win.Trade       1596.75  1104.29  1437.80  1685.60  1540.67
Avg.Losing.Trade    -403.65  -772.92  -589.63  -796.52  -259.33
Med.Losing.Trade    -403.65  -916.94  -725.42  -886.53  -259.33
Avg.Daily.PL        1480.73   770.38   475.64  1130.97  4409.54
Med.Daily.PL        1464.64   617.43   172.62  1641.75   449.49
Std.Dev.Daily.PL    1644.78  1703.02  1388.08  1812.47  9013.08
Ann.Sharpe            14.29     7.18     5.44     9.91     7.77
Max.Drawdown       -4095.25 -2939.04 -3263.55 -4582.43 -3537.22
Profit.To.Max.Draw     3.17     3.28     1.46     2.42     8.73
Avg.WinLoss.Ratio      4.88     1.94     2.61     2.42    20.00
Med.WinLoss.Ratio      3.96     1.20     1.98     1.90     5.94
Max.Equity         13142.58  9649.19  5704.58 12750.19 31638.96
Min.Equity          -257.82   -18.03  -876.30  -336.91  -401.25
End.Equity         12982.75  9649.19  4756.41 11097.68 30866.81

                        TLT      XLB      XLE      XLF      XLI
Num.Txns              20.00    23.00    27.00    17.00    17.00
Num.Trades            10.00    12.00    14.00     9.00     9.00
Net.Trading.PL      7984.42 10276.48 15328.84  2931.55 11452.17
Avg.Trade.PL         798.44   856.37  1094.92   325.73  1272.46
Med.Trade.PL         635.82   553.43   298.85   353.89  1530.29
Largest.Winner      4084.20  3877.14 10982.05  1552.10  3382.70
Largest.Loser      -1295.01 -1514.24 -1066.86 -1658.50 -1082.79
Gross.Profits      11035.29 13539.19 18826.91  5044.64 13147.30
Gross.Losses       -3050.87 -3262.71 -3498.08 -2113.09 -1695.13
Std.Dev.Trade.PL    1656.89  1654.32  3020.85  1003.42  1538.10
Percent.Positive      60.00    58.33    50.00    77.78    66.67
Percent.Negative      40.00    41.67    50.00    22.22    33.33
Profit.Factor          3.62     4.15     5.38     2.39     7.76
Avg.Win.Trade       1839.22  1934.17  2689.56   720.66  2191.22
Med.Win.Trade       1779.55  1758.72  1297.88   602.56  1887.54
Avg.Losing.Trade    -762.72  -652.54  -499.73 -1056.55  -565.04
Med.Losing.Trade    -616.18  -444.05  -502.26 -1056.55  -482.61
Avg.Daily.PL         798.44   733.48   993.83   248.29  1246.61
Med.Daily.PL         635.82   175.80   -75.82   215.38  1598.19
Std.Dev.Daily.PL    1656.89  1676.63  3119.46  1043.56  1642.21
Ann.Sharpe             7.65     6.94     5.06     3.78    12.05
Max.Drawdown       -4815.13 -3002.83 -3697.94 -3305.04 -2288.62
Profit.To.Max.Draw     1.66     3.42     4.15     0.89     5.00
Avg.WinLoss.Ratio      2.41     2.96     5.38     0.68     3.88
Med.WinLoss.Ratio      2.89     3.96     2.58     0.57     3.91
Max.Equity         11680.33 10377.57 16209.04  4685.40 11458.63
Min.Equity         -1228.87   -87.21  -130.15  -225.91     0.00
End.Equity          7984.42 10276.48 15328.84  2931.55 11452.17

                        XLK      XLP      XLU      XLV      XLY
Num.Txns              23.00    17.00    21.00    21.00    19.00
Num.Trades            12.00     9.00    11.00    11.00    10.00
Net.Trading.PL      5168.06  7233.14  9654.01  1295.79  4546.69
Avg.Trade.PL         430.67   803.68   877.64   117.80   454.67
Med.Trade.PL          28.36   167.20   412.15   332.08   418.47
Largest.Winner      2489.14  4607.82  6094.87  1824.31  2341.47
Largest.Loser       -886.51 -2168.49 -1121.59 -1818.18 -1633.72
Gross.Profits       8101.55 10272.30 12840.30  6498.45  8842.45
Gross.Losses       -2933.49 -3039.15 -3186.30 -5202.66 -4295.76
Std.Dev.Trade.PL    1117.36  1954.14  2261.27  1240.89  1461.48
Percent.Positive      50.00    55.56    54.55    54.55    50.00
Percent.Negative      50.00    44.44    45.45    45.45    50.00
Profit.Factor          2.76     3.38     4.03     1.25     2.06
Avg.Win.Trade       1350.26  2054.46  2140.05  1083.08  1768.49
Med.Win.Trade       1432.23  1902.15   790.75   978.13  1744.68
Avg.Losing.Trade    -488.91  -759.79  -637.26 -1040.53  -859.15
Med.Losing.Trade    -456.93  -335.80  -779.63  -820.91  -668.55
Avg.Daily.PL         336.75   666.37   912.78    47.83   367.23
Med.Daily.PL        -184.80   -15.93   129.41  -121.08  -404.63
Std.Dev.Daily.PL    1121.11  2042.13  2380.42  1284.94  1522.13
Ann.Sharpe             4.77     5.18     6.09     0.59     3.83
Max.Drawdown       -3136.49 -4108.70 -3440.49 -6294.99 -3508.84
Profit.To.Max.Draw     1.65     1.76     2.81     0.21     1.30
Avg.WinLoss.Ratio      2.76     2.70     3.36     1.04     2.06
Med.WinLoss.Ratio      3.13     5.66     1.01     1.19     2.61
Max.Equity          5216.66  7583.26 11588.28  4179.18  4986.43
Min.Equity           -88.40     0.00  -144.19 -2115.81     0.00
End.Equity          5168.06  7233.14  9654.01  1295.79  4546.69


> (aggPF <- sum(tStats$Gross.Profits)/-sum(tStats$Gross.Losses))
[1] 4.86916
> (aggCorrect <- mean(tStats$Percent.Positive))
[1] 65.397
> (numTrades <- sum(tStats$Num.Trades))
[1] 309
> (meanAvgWLR <- mean(tStats$Avg.WinLoss.Ratio))
[1] 3.348667

The trade stats look better mainly because of the strength of the indicator to identify periods of good entries. However, the advantages end there.

Here are the daily stats:

                         EFA       EPP       EWA       EWC       EWG
Total.Net.Profit    10208.50  17160.90  16467.19  16571.75  10873.05
Total.Days           1315.00   1374.00   1413.00   1462.00   1225.00
Winning.Days          717.00    753.00    792.00    815.00    678.00
Losing.Days           598.00    621.00    621.00    647.00    547.00
Avg.Day.PL              7.76     12.49     11.65     11.33      8.88
Med.Day.PL             16.17     18.89     24.11     21.70     18.39
Largest.Winner        854.72    818.41    902.53    735.67    651.33
Largest.Loser        -891.71  -1089.41  -1022.44   -691.88   -870.92
Gross.Profits       88275.97 110279.44 104118.90  97654.12  81458.62
Gross.Losses       -78067.47 -93118.55 -87651.72 -81082.37 -70585.57
Std.Dev.Daily.PL      169.32    200.83    183.57    157.83    165.30
Percent.Positive       54.52     54.80     56.05     55.75     55.35
Percent.Negative       45.48     45.20     43.95     44.25     44.65
Profit.Factor           1.13      1.18      1.19      1.20      1.15
Avg.Win.Day           123.12    146.45    131.46    119.82    120.15
Med.Win.Day            96.83    118.04    108.51    102.89     94.74
Avg.Losing.Day       -130.55   -149.95   -141.15   -125.32   -129.04
Med.Losing.Day        -96.63   -102.98    -96.38    -91.98    -93.83
Avg.Daily.PL            7.76     12.49     11.65     11.33      8.88
Med.Daily.PL           16.17     18.89     24.11     21.70     18.39
Std.Dev.Daily.PL.1    169.32    200.83    183.57    157.83    165.30
Ann.Sharpe              0.73      0.99      1.01      1.14      0.85
Max.Drawdown        -5394.64  -3799.80  -3919.36  -3229.19  -5185.89
Profit.To.Max.Draw      1.89      4.52      4.20      5.13      2.10
Avg.WinLoss.Ratio       0.94      0.98      0.93      0.96      0.93
Med.WinLoss.Ratio       1.00      1.15      1.13      1.12      1.01
Max.Equity          13816.60  18136.21  17072.51  16571.75  14015.59
Min.Equity              0.00   -135.30      0.00   -132.86    -75.34
End.Equity          10208.50  17160.90  16467.19  16571.75  10873.05
                         EWH       EWJ       EWS       EWT       EWU
Total.Net.Profit    12558.12   8228.69  15686.23   4112.81   6421.97
Total.Days           1334.00   1112.00   1337.00   1232.00   1294.00
Winning.Days          706.00    583.00    745.00    630.00    699.00
Losing.Days           628.00    529.00    592.00    602.00    595.00
Avg.Day.PL              9.41      7.40     11.73      3.34      4.96
Med.Day.PL             12.37     16.23     22.24      7.50     17.61
Largest.Winner       1132.42    747.36   1048.83    714.29    855.70
Largest.Loser       -1149.08  -1130.40  -1334.88  -1051.58   -761.51
Gross.Profits       98567.49  88747.53  93204.72  77892.68  79104.53
Gross.Losses       -86009.37 -80518.84 -77518.49 -73779.88 -72682.57
Std.Dev.Daily.PL      201.14    204.93    177.78    167.18    155.18
Percent.Positive       52.92     52.43     55.72     51.14     54.02
Percent.Negative       47.08     47.57     44.28     48.86     45.98
Profit.Factor           1.15      1.10      1.20      1.06      1.09
Avg.Win.Day           139.61    152.23    125.11    123.64    113.17
Med.Win.Day            98.81    110.77     95.35     96.74     94.35
Avg.Losing.Day       -136.96   -152.21   -130.94   -122.56   -122.16
Med.Losing.Day        -94.53   -109.95    -97.43    -91.36    -93.62
Avg.Daily.PL            9.41      7.40     11.73      3.34      4.96
Med.Daily.PL           12.37     16.23     22.24      7.50     17.61
Std.Dev.Daily.PL.1    201.14    204.93    177.78    167.18    155.18
Ann.Sharpe              0.74      0.57      1.05      0.32      0.51
Max.Drawdown        -4368.83  -6749.29  -3010.28  -4204.52  -4997.13
Profit.To.Max.Draw      2.87      1.22      5.21      0.98      1.29
Avg.WinLoss.Ratio       1.02      1.00      0.96      1.01      0.93
Med.WinLoss.Ratio       1.05      1.01      0.98      1.06      1.01
Max.Equity          13935.41  13216.89  15878.52   4375.25   9759.45
Min.Equity           -281.46      0.00      0.00    -22.49      0.00
End.Equity          12558.12   8228.69  15686.23   4112.81   6421.97
                         EWY        EWZ       EZU       IEF
Total.Net.Profit    13779.39   23013.79   7849.71  10099.65
Total.Days           1423.00    1499.00   1260.00   1285.00
Winning.Days          777.00     841.00    683.00    659.00
Losing.Days           646.00     658.00    577.00    626.00
Avg.Day.PL              9.68      15.35      6.23      7.86
Med.Day.PL             17.91      24.89     17.35      6.75
Largest.Winner        869.03    1099.10    664.64   1116.66
Largest.Loser        -838.15   -1215.42   -995.76   -967.58
Gross.Profits      109035.17  126735.25  80243.70  99184.62
Gross.Losses       -95255.78 -103721.46 -72393.99 -89084.97
Std.Dev.Daily.PL      197.08     215.29    161.49    193.96
Percent.Positive       54.60      56.10     54.21     51.28
Percent.Negative       45.40      43.90     45.79     48.72
Profit.Factor           1.14       1.22      1.11      1.11
Avg.Win.Day           140.33     150.70    117.49    150.51
Med.Win.Day           111.32     112.94     93.24    116.02
Avg.Losing.Day       -147.45    -157.63   -125.47   -142.31
Med.Losing.Day       -103.45    -105.36    -90.08   -108.20
Avg.Daily.PL            9.68      15.35      6.23      7.86
Med.Daily.PL           17.91      24.89     17.35      6.75
Std.Dev.Daily.PL.1    197.08     215.29    161.49    193.96
Ann.Sharpe              0.78       1.13      0.61      0.64
Max.Drawdown        -4564.52   -4072.32  -5298.53  -4019.55
Profit.To.Max.Draw      3.02       5.65      1.48      2.51
Avg.WinLoss.Ratio       0.95       0.96      0.94      1.06
Med.WinLoss.Ratio       1.08       1.07      1.04      1.07
Max.Equity          13779.39   23910.96  10592.36  12909.83
Min.Equity              0.00       0.00   -165.41  -1675.30
End.Equity          13779.39   23013.79   7849.71  10099.65
                          IGE       IYR       IYZ       LQD       RWR
Total.Net.Profit     14095.94  12982.75   9649.19   4756.41  11097.68
Total.Days            1461.00   1314.00   1225.00   1350.00   1331.00
Winning.Days           793.00    728.00    653.00    718.00    722.00
Losing.Days            668.00    586.00    572.00    632.00    609.00
Avg.Day.PL               9.65      9.88      7.88      3.52      8.34
Med.Day.PL              21.30     16.00      9.14      9.95     13.44
Largest.Winner         663.26    578.88    516.66    591.08    614.36
Largest.Loser         -819.01  -1139.51   -758.41   -491.67  -1201.72
Gross.Profits       116037.20  77715.47  60926.63  64184.63  83589.23
Gross.Losses       -101941.26 -64732.72 -51277.45 -59428.22 -72491.55
Std.Dev.Daily.PL       194.37    150.80    124.66    119.90    164.61
Percent.Positive        54.28     55.40     53.31     53.19     54.24
Percent.Negative        45.72     44.60     46.69     46.81     45.76
Profit.Factor            1.14      1.20      1.19      1.08      1.15
Avg.Win.Day            146.33    106.75     93.30     89.39    115.77
Med.Win.Day            118.07     84.95     68.24     72.26     90.32
Avg.Losing.Day        -152.61   -110.47    -89.65    -94.03   -119.03
Med.Losing.Day        -115.51    -74.56    -64.29    -74.35    -78.63
Avg.Daily.PL             9.65      9.88      7.88      3.52      8.34
Med.Daily.PL            21.30     16.00      9.14      9.95     13.44
Std.Dev.Daily.PL.1     194.37    150.80    124.66    119.90    164.61
Ann.Sharpe               0.79      1.04      1.00      0.47      0.80
Max.Drawdown         -3449.65  -4095.25  -2939.04  -3263.55  -4582.43
Profit.To.Max.Draw       4.09      3.17      3.28      1.46      2.42
Avg.WinLoss.Ratio        0.96      0.97      1.04      0.95      0.97
Med.WinLoss.Ratio        1.02      1.14      1.06      0.97      1.15
Max.Equity           14200.07  13142.58   9649.19   5704.58  12750.19
Min.Equity             -88.76   -257.82    -18.03   -876.30   -336.91
End.Equity           14095.94  12982.75   9649.19   4756.41  11097.68
                         SHY       TLT       XLB       XLE       XLF
Total.Net.Profit    30866.81   7984.42  10276.48  15328.84   2931.55
Total.Days           1562.00   1245.00   1331.00   1456.00   1095.00
Winning.Days          874.00    644.00    731.00    798.00    570.00
Losing.Days           688.00    601.00    600.00    658.00    525.00
Avg.Day.PL             19.76      6.41      7.72     10.53      2.68
Med.Day.PL             21.92     10.54     16.37     17.80      7.67
Largest.Winner        809.44   1027.71    570.55    843.05    534.17
Largest.Loser        -975.79   -728.07   -622.80  -1083.92   -930.35
Gross.Profits      113467.63  99021.87  80646.28 112733.44  54186.21
Gross.Losses       -82600.83 -91037.45 -70369.80 -97404.60 -51254.66
Std.Dev.Daily.PL      170.13    202.61    148.19    196.05    130.52
Percent.Positive       55.95     51.73     54.92     54.81     52.05
Percent.Negative       44.05     48.27     45.08     45.19     47.95
Profit.Factor           1.37      1.09      1.15      1.16      1.06
Avg.Win.Day           129.83    153.76    110.32    141.27     95.06
Med.Win.Day            93.07    115.64     91.77    110.41     74.69
Avg.Losing.Day       -120.06   -151.48   -117.28   -148.03    -97.63
Med.Losing.Day        -92.93   -116.88    -86.95   -105.73    -68.38
Avg.Daily.PL           19.76      6.41      7.72     10.53      2.68
Med.Daily.PL           21.92     10.54     16.37     17.80      7.67
Std.Dev.Daily.PL.1    170.13    202.61    148.19    196.05    130.52
Ann.Sharpe              1.84      0.50      0.83      0.85      0.33
Max.Drawdown        -3537.22  -4815.13  -3002.83  -3697.94  -3305.04
Profit.To.Max.Draw      8.73      1.66      3.42      4.15      0.89
Avg.WinLoss.Ratio       1.08      1.02      0.94      0.95      0.97
Med.WinLoss.Ratio       1.00      0.99      1.06      1.04      1.09
Max.Equity          31638.96  11680.33  10377.57  16209.04   4685.40
Min.Equity           -401.25  -1228.87    -87.21   -130.15   -225.91
End.Equity          30866.81   7984.42  10276.48  15328.84   2931.55
                         XLI       XLK       XLP       XLU       XLV
Total.Net.Profit    11452.17   5168.06   7233.14   9654.01   1295.79
Total.Days           1323.00   1230.00   1382.00   1348.00   1179.00
Winning.Days          731.00    681.00    751.00    735.00    606.00
Losing.Days           592.00    549.00    631.00    613.00    573.00
Avg.Day.PL              8.66      4.20      5.23      7.16      1.10
Med.Day.PL             12.27     15.06     13.67     15.33      5.21
Largest.Winner        667.88    651.97    645.78    544.81   1086.79
Largest.Loser        -681.83   -702.78   -743.00   -677.52   -784.28
Gross.Profits       70933.60  65526.03  68115.23  71114.61  57258.43
Gross.Losses       -59481.42 -60357.97 -60882.09 -61460.60 -55962.63
Std.Dev.Daily.PL      134.55    138.48    123.71    133.61    131.08
Percent.Positive       55.25     55.37     54.34     54.53     51.40
Percent.Negative       44.75     44.63     45.66     45.47     48.60
Profit.Factor           1.19      1.09      1.12      1.16      1.02
Avg.Win.Day            97.04     96.22     90.70     96.75     94.49
Med.Win.Day            73.44     75.24     73.21     76.94     77.97
Avg.Losing.Day       -100.48   -109.94    -96.49   -100.26    -97.67
Med.Losing.Day        -73.30    -80.20    -73.80    -67.78    -74.02
Avg.Daily.PL            8.66      4.20      5.23      7.16      1.10
Med.Daily.PL           12.27     15.06     13.67     15.33      5.21
Std.Dev.Daily.PL.1    134.55    138.48    123.71    133.61    131.08
Ann.Sharpe              1.02      0.48      0.67      0.85      0.13
Max.Drawdown        -2288.62  -3136.49  -4108.70  -3440.49  -6294.99
Profit.To.Max.Draw      5.00      1.65      1.76      2.81      0.21
Avg.WinLoss.Ratio       0.97      0.88      0.94      0.97      0.97
Med.WinLoss.Ratio       1.00      0.94      0.99      1.14      1.05
Max.Equity          11458.63   5216.66   7583.26  11588.28   4179.18
Min.Equity              0.00    -88.40      0.00   -144.19  -2115.81
End.Equity          11452.17   5168.06   7233.14   9654.01   1295.79
                         XLY
Total.Net.Profit     4546.69
Total.Days           1148.00
Winning.Days          603.00
Losing.Days           545.00
Avg.Day.PL              3.96
Med.Day.PL              9.85
Largest.Winner        490.31
Largest.Loser        -726.59
Gross.Profits       54521.44
Gross.Losses       -49974.75
Std.Dev.Daily.PL      121.37
Percent.Positive       52.53
Percent.Negative       47.47
Profit.Factor           1.09
Avg.Win.Day            90.42
Med.Win.Day            73.22
Avg.Losing.Day        -91.70
Med.Losing.Day        -69.21
Avg.Daily.PL            3.96
Med.Daily.PL            9.85
Std.Dev.Daily.PL.1    121.37
Ann.Sharpe              0.52
Max.Drawdown        -3508.84
Profit.To.Max.Draw      1.30
Avg.WinLoss.Ratio       0.99
Med.WinLoss.Ratio       1.06
Max.Equity           4986.43
Min.Equity              0.00
End.Equity           4546.69

Equity Curve 60

Compared to the previous equity curve, the drawdowns here are more pronounced. So how much do we pay for having this higher “set it and forget it” holding period?

> SharpeRatio.annualized(portfRets)
                                    [,1]
Annualized Sharpe Ratio (Rf=0%) 1.099297
> Return.annualized(portfRets)
                       [,1]
Annualized Return 0.1393566
> maxDrawdown(portfRets)
[1] 0.183505

Turns out, a fair bit. The Sharpe Ratio comes down quite a bit, the returns are slightly lower, but the drawdown is much higher, crossing back under that boundary of annualized returns higher than maximum drawdown. Of course, this isn’t all attributable to stale ATR calculations, as order sizing and rebalancing won’t save a strategy from holding onto bad trades, but not rebalancing certainly does nobody any favors at the longer holding timeframes.

Here’s a picture of a single instrument, length of positions, and the indicators.

XLB Equity Curve 60 day period

Would it have been nice to have some rebalancing for those longer timeframe trades? Yep.

Finally, is the equity curve comparison taken further, to the original 100-day period.

Equity Curve comparison 100 day holding period

And the corresponding three statistics:

> SharpeRatio.annualized(portfRets)
                                     [,1]
Annualized Sharpe Ratio (Rf=0%) 0.8681733
> Return.annualized(portfRets)
                       [,1]
Annualized Return 0.1366685
> maxDrawdown(portfRets)
[1] 0.2241631

Definitely not a good look. Sharpe back under 1, and drawdowns at more than 20%? What kind of returns can we get for such drawdowns? Wait until the end of the post, and I’ll show you.

The beginning of the volatility preceding the financial crisis caused some violent drawdowns (notice the actual bear market didn’t cause so much). Could some of this damage have been mitigated?

XLB Equity Curve ATR 100

The answer? Certainly (see the monotonic rise in ATR in 2007).

So, with all of this in mind, as promised, let’s see what sort of returns we can get for the 20 day period.

What if we took our original portfolio, and simply doubled the risk allocation–in other words, leveraged the original strategy 2:1?

Here’s the one line change:

#parameters (trigger lag unchanged, defaulted at 1)
delta=0
period=20
pctATR=.04 #control risk with this parameter

Well, this is what happens:

Equity Curve 20 day ATR pctATR .04

And the statistics:

> SharpeRatio.annualized(portfRets)
                                    [,1]
Annualized Sharpe Ratio (Rf=0%) 1.465359
> Return.annualized(portfRets)
                       [,1]
Annualized Return 0.3088355
> maxDrawdown(portfRets)
[1] 0.2109036

About 31% annualized returns, with slightly over 20% drawdowns. Considering that the stock market has much higher drawdowns, this is a pretty good risk-return profile. If we’re willing to go above 30% drawdown, this is the resulting equity curve:

Equity Curve period 20 pctATR .06

At this point, the equity curve for SPY becomes almost a flat line by comparison–not because its drawdowns are smaller (at the height of the crisis, they were over 60%), but because of proper position sizing. Here are the corresponding three statistics:

> SharpeRatio.annualized(portfRets)
                                    [,1]
Annualized Sharpe Ratio (Rf=0%) 1.493416
> Return.annualized(portfRets)
                       [,1]
Annualized Return 0.4722279
> maxDrawdown(portfRets)
[1] 0.3022385

Of course, beyond this point, if one is willing to tolerate drawdowns, the annualized returns just start to get silly, but the drawdowns start to really show in 2010, when the fact that this system’s exits could still be improved, and its instrument selection (with a base correlation across all instruments of .7) starts quickly putting on the brakes on going beyond this point. For now anyway.

Thanks for reading.


To leave a comment for the author, please follow the link and comment on their blog: QuantStrat TradeR » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)