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

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 trade 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.

Trend Vigor Part II–the Delta parameter, Ehlers entries and exits, and (vaguely) intelligent portfolio management.

The last post gave a cursory overview of implementing a basic quantstrat strategy, and an introduction to Dr. Ehlers’s Trend Vigor indicator, with a less than intelligent exit. This post will delve further into this indicator, and how it can be made to act as a long-term trend follower to a short-term momentum trader, to probably anything in between, with a parameter called delta. Dr. Ehlers’s indicators often use some trigonometric math, the rationale of which is based on signal processing theory, and often times, that math uses a user-input parameter denoted by a Greek letter, such as alpha, gamma, delta, and so forth.

Rather than leave these esoteric parameters completely unexplored, out of sheer curiosity, I decided to alter the delta parameter. By tuning the delta parameter, it’s possible to tune how fast Trend Vigor oscillates, and thereby, how fast it judges that newer observations are part of a new trend (but at the same time, how much longer the indicator classifies a trend as ongoing). This would allow a user to tune the Trend Vigor indicator in a similar fashion as other trend following indicators to capture different sorts of market phenomena, such as long term trend-following/filtering, to shorter-term phenomena. On the *downside*, this means that as a user tunes the period and the delta, that he or she could easily overfit.

Furthermore, this blog post is going to make the portfolio analysis portion of the analytics make far more sense than a roughly-sketched, price-weighted equity curve. The results were that the benefits of diversification were…certainly less than expected. This backtest is going to implement an equal-weight asset allocation scheme, which will also showcase that quantstrat can implement custom order-sizing functions. Equal-weight asset allocation schemes can be improved upon, but that’s a discussion for a future time.

The strategy for this blog post is slightly different, as well. In this case, the strategy will use a more intelligent exit, by selling when the indicator crosses under its one-day lagged trigger, and buying not only when the indicator crosses above 1, but also if it should cross over its one-day lagged computation, but still be above 1. This is so that the strategy would stay in what it perceives as a trend, rather than sell and not come back until the computation dipped back below 1 (an arbitrary value, to be sure) and came back up again. The idea for the exit came from one of Dr. Ehlers’s presentations, in which he presented several more trend-following smoothers, some of which are already in the DSTrading package (FRAMA, KAMA, VIDYA which I call VIDA, and the Ehlers filters), and which I’ll visit in the future. The link to the presentation can be found here:

http://www.mesasoftware.com/Seminars/TradeStation%20World%2005.pdf

One last detail to mind is that between the last blog post and this one, I changed the Trend Vigor indicator to backfill any leading NAs as zero, since this is an indicator centered around zero. This will allow the strategy to instantly jump into the middle of a trend, if one was under way the moment the first true value of the indicator was computed.

My custom order-sizing function is found in my IKTrading package, which is my own personal collection of non-Ehlers indicators, miscellaneous tools, custom order-sizing functions, and generally serves as a catch-all for trading ideas I come across that don’t have enough content behind them to warrant a package of their own.

Let’s look at the code of the updated indicator.

First, the updated Trend Vigor indicator:

"TVI" <- function(x, period=20, delta=.2, triggerLag=1, ...) {
  if(period!=0) { #static, length-1 period
    beta <- cos(2*pi/period)
    gamma <- 1/cos(4*pi*delta/period)
    alpha <- gamma - sqrt(gamma*gamma-1)
    BP <- .5*(1-alpha)*(x-lag(x,2))
    BP[1] <- BP[2] <- 0
    BP <- filter(BP, c(beta*(1+alpha),-1*alpha),method="recursive")
    BP <- xts(BP, order.by=index(x))
    signal <- BP - lag(BP, round(period/2))
    lead <- 1.4*(BP-lag(BP, round(period/4)))
    
    BP2 <- BP*BP
    LBP2 <- lag(BP2, round(period/4))
    power <- runSum(BP2, period)+runSum(LBP2, period)
    RMS <- sqrt(power/period)
    PtoP <- 2*sqrt(2)*RMS
    
    a1 <- exp(-sqrt(2)*pi/period)
    b1 <- 2*a1*cos(sqrt(2)*pi/period)
    coef2 <- b1
    coef3 <- -a1*a1
    coef1 <- 1-coef2-coef3
    trend <- coef1*(x-lag(x, period))
    trend[is.na(trend)] <- 0
    trend <- filter(trend, c(coef2, coef3), method="recursive")
    trend <- xts(trend, order.by=index(x))
    vigor <- trend/PtoP
    vigor[vigor > 2] <- 2
    vigor[vigor < -2] <- -2
    vigor[is.na(vigor)] <- 0
    trigger <- lag(vigor, triggerLag)
    out <- cbind(vigor, signal, lead, trigger)
    colnames(out) <- c("vigor", "signal", "lead", "trigger")
    return(out)
  } else {
    stop("Dynamic period computation not implemented yet.")
    #TODO -- DYNAMIC PERIOD TREND VIGOR
  }
}

Delta is a parameter involved in an involved trigonometric calculation, lending to the idea that there may be some sort of circular relationship with delta, rather than simply a “trend sensitivity” as I described. That stated, considering that the default value that Dr. Ehlers used was .2, it implies that the parameter should probably be held between 0 and 1. Once beyond that, there’s no guarantee that the algorithm even runs (at some point, it will just make later computations come out as NaNs).

Next, I’d like to introduce a couple of functions from my IKTrading package.

sigAND <- function(label, data=mktdata, columns,  cross = FALSE) {
  ret_sig = NULL
  colNums <- rep(0, length(columns))
  for(i in 1:length(columns)) {
    colNums[i] <- match.names(columns[i], colnames(data))
  }
  ret_sig <- data[, colNums[1]]
  for(i in 2:length(colNums)) {
    ret_sig <- ret_sig & data[, colNums[i]]
  }
  ret_sig <- ret_sig*1
  if (isTRUE(cross)) 
    ret_sig <- diff(ret_sig) == 1
  colnames(ret_sig) <- label
  return(ret_sig)
}

osMaxDollar <- function(data, timestamp, orderqty, ordertype, orderside,
                        portfolio, symbol, prefer="Open", tradeSize,
                        maxSize, integerQty=TRUE,
                        ...) {
  pos <- getPosQty(portfolio, symbol, timestamp)
  if(prefer=="Close") {
    price <- as.numeric(Cl(mktdata[timestamp,]))
  } else {
    price <- as.numeric(Op(mktdata[timestamp,]))
  }
  posVal <- pos*price
  if (orderside=="short") {
    dollarsToTransact <- max(tradeSize, maxSize-posVal)
    #If our position is profitable, we don't want to cover needlessly.
    if(dollarsToTransact > 0) {dollarsToTransact=0}
  } else {
    dollarsToTransact <- min(tradeSize, maxSize-posVal)
    #If our position is profitable, we don't want to sell needlessly.
    if(dollarsToTransact < 0) {dollarsToTransact=0}
  }
  qty <- dollarsToTransact/price
  if(integerQty) {
    qty <- trunc(qty)
  }
  return(qty)
}

The first function is a basic AND operator for signals in quantstrat. While quantstrat itself has a signal function called sigFormula, I myself am not exactly a fan of it. The second function, however, is a bit more innovative, in that it allows a strategy to control positions by their total current dollar value. What it doesn’t do, however, is remember the initial dollar value of a position. That is, if you invested $10,000, with a limit of $20,000 in a position, and your initial position went to $11,000, this function would only allow up to another $9,000 worth of the instrument to be ordered. Negative quantities should be used for shorting. That is, if the goal is to short a security, rather than input 20000 as the maxSize and 10000 as the tradeSize, the parameters should be -20000 and -10000, respectively.

Again, the order sizing function takes into account the value of the position at the time of a new order, not the original value of the transaction. That is, the function does not do this: “You have an existing position that you entered into at some previous date, and your position then was $10,000, but now it’s $15,000, but I’ll order another $10,000 anyway”. The function currently does this: “You have a position with a current market value of $15,000. You want to add $10,000 to your position, but have a limit of $20,000. I’ll order the nearest integer quantity to the difference ($5,000).”

Moving on, here’s the modified strategy.

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


#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_TF_2"
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=.2
period=100

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

#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, orderqty=100, 
                        ordertype="market", orderside="long", 
                        replace=FALSE, prefer="Open", osFUN=osMaxDollar,
                        tradeSize=10000, maxSize=10000), 
         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)

For the moment, we’re going to go with the previous settings of delta = .2, and period = 100, but this time, using an order size of the nearest integer quantity that $10,000 can buy of that particular security. Also, we’re going to exit when the indicator shifts from moving up or flat (if it’s at 2), to downward, and buying whenever it shifts from moving downward to moving upward (but still has a value above 1). Also, note that now, there is an initial equity allocation, which will allow for the computation of portfolio returns.

Here are the results.

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)])))
                        EFA      EPP      EWA      EWC      EWG
Num.Txns              21.00    15.00    27.00    37.00    17.00
Num.Trades            11.00     8.00    14.00    19.00     9.00
Net.Trading.PL      3389.91  6323.15  6933.26  2213.97  4983.35
Avg.Trade.PL         308.17   790.39   495.23   116.52   553.71
Med.Trade.PL         298.45   549.42   107.35   110.98   206.57
Largest.Winner       869.60  2507.07  3410.61  1607.61  2600.90
Largest.Loser       -297.25  -675.35  -452.79 -1191.14  -343.19
Gross.Profits       4073.17  7327.60  8446.23  5734.53  5847.80
Gross.Losses        -683.26 -1004.45 -1512.97 -3520.55  -864.45
Std.Dev.Trade.PL     425.12  1189.75  1118.82   648.91   957.64
Percent.Positive      72.73    62.50    57.14    63.16    66.67
Percent.Negative      27.27    37.50    42.86    36.84    33.33
Profit.Factor          5.96     7.30     5.58     1.63     6.76
Avg.Win.Trade        509.15  1465.52  1055.78   477.88   974.63
Med.Win.Trade        485.27  1680.62   448.04   313.63   747.17
Avg.Losing.Trade    -227.75  -334.82  -252.16  -502.94  -288.15
Med.Losing.Trade    -266.17  -184.29  -220.96  -440.34  -274.72
Avg.Daily.PL         323.18   923.99   490.48    82.59   657.26
Med.Daily.PL         305.15  1057.21    54.49   100.34   465.90
Std.Dev.Daily.PL     445.03  1218.54  1164.36   650.14   968.40
Ann.Sharpe            11.53    12.04     6.69     2.02    10.77
Max.Drawdown       -1730.57 -2428.18 -2827.76 -3214.22 -2070.43
Profit.To.Max.Draw     1.96     2.60     2.45     0.69     2.41
Avg.WinLoss.Ratio      2.24     4.38     4.19     0.95     3.38
Med.WinLoss.Ratio      1.82     9.12     2.03     0.71     2.72
Max.Equity          3785.99  8030.74  7734.21  4215.37  5775.50
Min.Equity            -4.60  -186.62  -399.56  -272.20   -97.78
End.Equity          3389.91  6323.15  6933.26  2213.97  4983.35

                        EWH      EWJ      EWS      EWT      EWU
Num.Txns              17.00    19.00    21.00    23.00    24.00
Num.Trades             9.00    10.00    11.00    12.00    12.00
Net.Trading.PL      6281.71  1861.09  8115.03  1920.39  1113.36
Avg.Trade.PL         697.97   186.11   737.73   160.03    92.78
Med.Trade.PL         760.09    18.58   312.10  -180.82    -0.03
Largest.Winner      2223.08  2555.03  2736.35  3078.42  1243.53
Largest.Loser       -496.03 -1392.37  -531.77 -1219.88 -1009.85
Gross.Profits       7214.77  4666.47  9381.95  6413.88  3747.87
Gross.Losses        -933.06 -2805.38 -1266.92 -4493.49 -2634.51
Std.Dev.Trade.PL     959.96  1123.51  1178.37  1280.43   695.45
Percent.Positive      66.67    60.00    63.64    33.33    50.00
Percent.Negative      33.33    40.00    36.36    66.67    50.00
Profit.Factor          7.73     1.66     7.41     1.43     1.42
Avg.Win.Trade       1202.46   777.75  1340.28  1603.47   624.64
Med.Win.Trade       1046.89   314.63  1388.79  1505.03   541.51
Avg.Losing.Trade    -311.02  -701.35  -316.73  -561.69  -439.08
Med.Losing.Trade    -434.34  -591.09  -287.07  -478.14  -358.87
Avg.Daily.PL         785.55   142.07   780.29    69.58    92.78
Med.Daily.PL         857.90     6.87   291.84  -320.95    -0.03
Std.Dev.Daily.PL     987.05  1182.47  1233.16  1302.09   695.45
Ann.Sharpe            12.63     1.91    10.04     0.85     2.12
Max.Drawdown       -2240.59 -3140.49 -2181.89 -4191.97 -2682.76
Profit.To.Max.Draw     2.80     0.59     3.72     0.46     0.42
Avg.WinLoss.Ratio      3.87     1.11     4.23     2.85     1.42
Med.WinLoss.Ratio      2.41     0.53     4.84     3.15     1.51
Max.Equity          7033.54  3474.11  8268.38  3740.33  3093.03
Min.Equity          -101.98    -7.71  -715.49  -451.64  -298.31
End.Equity          6281.71  1861.09  8115.03  1920.39  1113.36

                        EWY      EWZ      EZU      IEF      IGE
Num.Txns              23.00    30.00    18.00    24.00    31.00
Num.Trades            12.00    15.00     9.00    12.00    16.00
Net.Trading.PL     11094.89 11017.62  3581.04   558.64  1425.90
Avg.Trade.PL         924.57   734.51   397.89    46.55    89.12
Med.Trade.PL         517.60   474.34   334.80   -21.76   -12.94
Largest.Winner      3654.10  3907.76  1415.98   544.99  2085.48
Largest.Loser       -497.47 -1034.75  -442.68  -286.86 -1357.10
Gross.Profits      12382.75 14795.36  4311.30  1551.73  5886.15
Gross.Losses       -1287.86 -3777.74  -730.26  -993.09 -4460.25
Std.Dev.Trade.PL    1396.50  1528.15   616.20   276.42   860.95
Percent.Positive      66.67    60.00    66.67    50.00    50.00
Percent.Negative      33.33    40.00    33.33    50.00    50.00
Profit.Factor          9.61     3.92     5.90     1.56     1.32
Avg.Win.Trade       1547.84  1643.93   718.55   258.62   735.77
Med.Win.Trade       1239.91  1050.52   707.66   245.34   614.69
Avg.Losing.Trade    -321.97  -629.62  -243.42  -165.52  -557.53
Med.Losing.Trade    -312.32  -654.53  -144.05  -161.22  -478.79
Avg.Daily.PL         946.10   734.51   397.89    46.55    29.55
Med.Daily.PL         347.37   474.34   334.80   -21.76   -95.89
Std.Dev.Daily.PL    1462.58  1528.15   616.20   276.42   856.36
Ann.Sharpe            10.27     7.63    10.25     2.67     0.55
Max.Drawdown       -3706.83 -4468.28 -1746.39 -1033.18 -4134.77
Profit.To.Max.Draw     2.99     2.47     2.05     0.54     0.34
Avg.WinLoss.Ratio      4.81     2.61     2.95     1.56     1.32
Med.WinLoss.Ratio      3.97     1.60     4.91     1.52     1.28
Max.Equity         11151.40 14325.48  4132.73  1324.33  3847.27
Min.Equity          -512.94  -669.31  -127.83  -496.42  -360.99
End.Equity         11094.89 11017.62  3581.04   558.64  1425.90

                        IYR      IYZ     LQD      RWR     SHY
Num.Txns              20.00    21.00   26.00    18.00   20.00
Num.Trades            10.00    10.00   13.00     9.00   10.00
Net.Trading.PL      3551.70   565.56  278.51  3846.21 1431.72
Avg.Trade.PL         355.17    56.56   21.42   427.36  143.17
Med.Trade.PL         285.85  -171.99   17.47   340.07   28.08
Largest.Winner      1457.62  1789.36  435.59  1465.93 1298.58
Largest.Loser       -397.79  -832.16 -516.47  -611.82  -79.25
Gross.Profits       4524.52  2743.13 1145.51  4698.97 1605.02
Gross.Losses        -972.82 -2177.58 -867.00  -852.76 -173.30
Std.Dev.Trade.PL     623.44   729.51  238.26   665.66  410.76
Percent.Positive      70.00    30.00   69.23    77.78   60.00
Percent.Negative      30.00    70.00   30.77    22.22   40.00
Profit.Factor          4.65     1.26    1.32     5.51    9.26
Avg.Win.Trade        646.36   914.38  127.28   671.28  267.50
Med.Win.Trade        497.94   737.25   32.03   531.59   55.68
Avg.Losing.Trade    -324.27  -311.08 -216.75  -426.38  -43.32
Med.Losing.Trade    -298.46  -242.80 -165.48  -426.38  -34.23
Avg.Daily.PL         355.17   -19.08   21.42   427.36  143.17
Med.Daily.PL         285.85  -211.89   17.47   340.07   28.08
Std.Dev.Daily.PL     623.44   730.99  238.26   665.66  410.76
Ann.Sharpe             9.04    -0.41    1.43    10.19    5.53
Max.Drawdown       -2117.09 -2239.16 -853.57 -2500.81 -206.62
Profit.To.Max.Draw     1.68     0.25    0.33     1.54    6.93
Avg.WinLoss.Ratio      1.99     2.94    0.59     1.57    6.17
Med.WinLoss.Ratio      1.67     3.04    0.19     1.25    1.63
Max.Equity          4939.41  1994.72  729.12  5125.30 1496.21
Min.Equity             0.00  -803.23 -815.95     0.00 -178.23
End.Equity          3551.70   565.56  278.51  3846.21 1431.72

                        TLT      XLB      XLE      XLF      XLI
Num.Txns              24.00    23.00    35.00    22.00    25.00
Num.Trades            12.00    12.00    18.00    11.00    13.00
Net.Trading.PL      1685.94  6026.21  -721.62  1073.90  3270.62
Avg.Trade.PL         140.49   502.18   -40.09    97.63   251.59
Med.Trade.PL          43.43   511.49  -148.36    53.82    -3.41
Largest.Winner      1244.42  2158.21  2243.05  1390.72  1358.00
Largest.Loser       -595.88  -750.40 -1151.80  -659.29  -378.11
Gross.Profits       2725.69  7456.59  4402.78  2346.46  4152.62
Gross.Losses       -1039.76 -1430.38 -5124.39 -1272.56  -882.00
Std.Dev.Trade.PL     468.08   819.50   771.46   512.62   512.44
Percent.Positive      58.33    66.67    22.22    63.64    46.15
Percent.Negative      41.67    33.33    77.78    36.36    53.85
Profit.Factor          2.62     5.21     0.86     1.84     4.71
Avg.Win.Trade        389.38   932.07  1100.69   335.21   692.10
Med.Win.Trade        195.01   997.33   857.45   226.90   589.41
Avg.Losing.Trade    -207.95  -357.59  -366.03  -318.14  -126.00
Med.Losing.Trade    -100.91  -301.05  -193.50  -239.29   -59.12
Avg.Daily.PL         140.49   499.71   -97.77    97.63   241.51
Med.Daily.PL          43.43   511.49  -152.39    53.82   -18.57
Std.Dev.Daily.PL     468.08   887.28   754.14   512.62   533.87
Ann.Sharpe             4.76     8.94    -2.06     3.02     7.18
Max.Drawdown       -2020.60 -2343.85 -5364.07 -1497.18 -1480.30
Profit.To.Max.Draw     0.83     2.57    -0.13     0.72     2.21
Avg.WinLoss.Ratio      1.87     2.61     3.01     1.05     5.49
Med.WinLoss.Ratio      1.93     3.31     4.43     0.95     9.97
Max.Equity          3278.94  6034.85  3638.56  2209.75  4344.89
Min.Equity         -1033.35  -234.71 -1725.52  -353.34     0.00
End.Equity          1685.94  6026.21  -721.62  1073.90  3270.62

                        XLK      XLP      XLU      XLV      XLY
Num.Txns              25.00    25.00    16.00    21.00    21.00
Num.Trades            13.00    12.00     8.00    11.00    11.00
Net.Trading.PL      2786.08  1691.84  2071.68   329.36  1596.47
Avg.Trade.PL         214.31   140.99   258.96    29.94   145.13
Med.Trade.PL          19.79    27.51  -175.95  -152.51    42.65
Largest.Winner      2153.72  1339.05  2416.22  1492.98   914.92
Largest.Loser       -586.52 -1482.72 -1180.81  -511.62  -228.81
Gross.Profits       4276.67  3888.90  4456.67  2179.92  1974.22
Gross.Losses       -1490.59 -2197.06 -2385.00 -1850.56  -377.75
Std.Dev.Trade.PL     687.96   747.73  1254.25   552.25   310.09
Percent.Positive      53.85    50.00    37.50    36.36    63.64
Percent.Negative      46.15    50.00    62.50    63.64    36.36
Profit.Factor          2.87     1.77     1.87     1.18     5.23
Avg.Win.Trade        610.95   648.15  1485.56   544.98   282.03
Med.Win.Trade        437.51   594.68  1966.92   301.18   180.59
Avg.Losing.Trade    -248.43  -366.18  -477.00  -264.37   -94.44
Med.Losing.Trade    -220.94  -132.84  -397.83  -238.91   -73.86
Avg.Daily.PL         195.71   125.23   258.96    10.26   149.62
Med.Daily.PL         -14.41   -24.11  -175.95  -187.75    39.16
Std.Dev.Daily.PL     715.13   782.14  1254.25   578.04   326.49
Ann.Sharpe             4.34     2.54     3.28     0.28     7.28
Max.Drawdown       -1984.37 -2106.40 -2360.48 -1327.16 -1540.71
Profit.To.Max.Draw     1.40     0.80     0.88     0.25     1.04
Avg.WinLoss.Ratio      2.46     1.77     3.11     2.06     2.99
Med.WinLoss.Ratio      1.98     4.48     4.94     1.26     2.45
Max.Equity          2883.68  2116.10  4325.65   653.11  2920.67
Min.Equity          -739.92   -49.59 -1004.33 -1293.46  -393.05
End.Equity          2786.08  1691.84  2071.68   329.36  1596.47

Already, we can see that the equal dollar weighting scheme may not have been the greatest. For instance, the gross profits (that is, total dollars gained, not net profit) vary wildly. For instance, the command:

summary(tStats$Gross.Profit)

Gives the output:

   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   1146    2994    4430    5145    6282   14800

Which means that either a few instruments were just fortunate, or more likely, that $10,000 in different instruments buys different levels of risk. Ideally, with trend following (or any investment strategy, for that matter), order sizing should be done with some measure of volatility in mind. Jeff Swanson of System Trader Success uses position sizing scaled with ATR, for instance.

Moving on, 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     3389.91   6323.15   6933.26   2213.97   4983.35
Total.Days            715.00    860.00    814.00    720.00    606.00
Winning.Days          397.00    472.00    457.00    394.00    337.00
Losing.Days           318.00    388.00    357.00    326.00    269.00
Avg.Day.PL              4.74      7.35      8.52      3.07      8.22
Med.Day.PL             11.05     13.86     24.93     16.08     17.82
Largest.Winner        349.71    520.81    651.16    383.73    430.91
Largest.Loser        -441.39   -658.33   -737.68   -533.75   -511.74
Gross.Profits       29341.17  51407.19  56127.72  35108.16  35014.78
Gross.Losses       -25951.26 -45084.04 -49194.46 -32894.18 -30031.43
Std.Dev.Daily.PL      101.85    151.01    173.50    121.89    138.19
Percent.Positive       55.52     54.88     56.14     54.72     55.61
Percent.Negative       44.48     45.12     43.86     45.28     44.39
Profit.Factor           1.13      1.14      1.14      1.07      1.17
Avg.Win.Day            73.91    108.91    122.82     89.11    103.90
Med.Win.Day            62.74     87.40    100.18     76.90     86.18
Avg.Losing.Day        -81.61   -116.20   -137.80   -100.90   -111.64
Med.Losing.Day        -60.59    -76.11    -98.03    -70.68    -84.29
Avg.Daily.PL            4.74      7.35      8.52      3.07      8.22
Med.Daily.PL           11.05     13.86     24.93     16.08     17.82
Std.Dev.Daily.PL.1    101.85    151.01    173.50    121.89    138.19
Ann.Sharpe              0.74      0.77      0.78      0.40      0.94
Max.Drawdown        -1730.57  -2428.18  -2827.76  -3214.22  -2070.43
Profit.To.Max.Draw      1.96      2.60      2.45      0.69      2.41
Avg.WinLoss.Ratio       0.91      0.94      0.89      0.88      0.93
Med.WinLoss.Ratio       1.04      1.15      1.02      1.09      1.02
Max.Equity           3785.99   8030.74   7734.21   4215.37   5775.50
Min.Equity             -4.60   -186.62   -399.56   -272.20    -97.78
End.Equity           3389.91   6323.15   6933.26   2213.97   4983.35

                         EWH       EWJ       EWS       EWT       EWU
Total.Net.Profit     6281.71   1861.09   8115.03   1920.39   1113.36
Total.Days            694.00    499.00    853.00    554.00    639.00
Winning.Days          365.00    264.00    469.00    282.00    336.00
Losing.Days           329.00    235.00    384.00    272.00    303.00
Avg.Day.PL              9.05      3.73      9.51      3.47      1.74
Med.Day.PL             13.35     13.75     19.75      8.49      9.84
Largest.Winner        793.54    550.75    760.20    603.79    393.65
Largest.Loser        -821.31   -560.56   -967.53   -606.81   -500.81
Gross.Profits       49928.51  29574.53  56989.19  36177.69  28874.40
Gross.Losses       -43646.80 -27713.44 -48874.16 -34257.30 -27761.04
Std.Dev.Daily.PL      184.78    146.73    167.87    164.58    114.57
Percent.Positive       52.59     52.91     54.98     50.90     52.58
Percent.Negative       47.41     47.09     45.02     49.10     47.42
Profit.Factor           1.14      1.07      1.17      1.06      1.04
Avg.Win.Day           136.79    112.02    121.51    128.29     85.94
Med.Win.Day           103.78     94.05     89.94    110.89     72.42
Avg.Losing.Day       -132.67   -117.93   -127.28   -125.95    -91.62
Med.Losing.Day        -93.35    -86.26    -98.90    -88.80    -69.88
Avg.Daily.PL            9.05      3.73      9.51      3.47      1.74
Med.Daily.PL           13.35     13.75     19.75      8.49      9.84
Std.Dev.Daily.PL.1    184.78    146.73    167.87    164.58    114.57
Ann.Sharpe              0.78      0.40      0.90      0.33      0.24
Max.Drawdown        -2240.59  -3140.49  -2181.89  -4191.97  -2682.76
Profit.To.Max.Draw      2.80      0.59      3.72      0.46      0.42
Avg.WinLoss.Ratio       1.03      0.95      0.95      1.02      0.94
Med.WinLoss.Ratio       1.11      1.09      0.91      1.25      1.04
Max.Equity           7033.54   3474.11   8268.38   3740.33   3093.03
Min.Equity           -101.98     -7.71   -715.49   -451.64   -298.31
End.Equity           6281.71   1861.09   8115.03   1920.39   1113.36

                         EWY       EWZ       EZU       IEF       IGE
Total.Net.Profit    11094.89  11017.62   3581.04    558.64   1425.90
Total.Days            819.00    938.00    625.00    559.00    636.00
Winning.Days          457.00    521.00    348.00    282.00    347.00
Losing.Days           362.00    417.00    277.00    277.00    289.00
Avg.Day.PL             13.55     11.75      5.73      1.00      2.24
Med.Day.PL             28.70     27.38     14.64      1.17     17.39
Largest.Winner        802.78    921.65    339.49    203.78    400.87
Largest.Loser        -713.20   -983.67   -593.68   -193.81   -486.10
Gross.Profits       70050.73  98473.12  30606.55  11313.46  36042.39
Gross.Losses       -58955.83 -87455.50 -27025.51 -10754.82 -34616.50
Std.Dev.Daily.PL      206.98    261.11    121.98     52.18    138.92
Percent.Positive       55.80     55.54     55.68     50.45     54.56
Percent.Negative       44.20     44.46     44.32     49.55     45.44
Profit.Factor           1.19      1.13      1.13      1.05      1.04
Avg.Win.Day           153.28    189.01     87.95     40.12    103.87
Med.Win.Day           124.00    151.02     70.52     33.60     90.45
Avg.Losing.Day       -162.86   -209.73    -97.57    -38.83   -119.78
Med.Losing.Day       -112.49   -157.93    -69.01    -28.87   -100.54
Avg.Daily.PL           13.55     11.75      5.73      1.00      2.24
Med.Daily.PL           28.70     27.38     14.64      1.17     17.39
Std.Dev.Daily.PL.1    206.98    261.11    121.98     52.18    138.92
Ann.Sharpe              1.04      0.71      0.75      0.30      0.26
Max.Drawdown        -3706.83  -4468.28  -1746.39  -1033.18  -4134.77
Profit.To.Max.Draw      2.99      2.47      2.05      0.54      0.34
Avg.WinLoss.Ratio       0.94      0.90      0.90      1.03      0.87
Med.WinLoss.Ratio       1.10      0.96      1.02      1.16      0.90
Max.Equity          11151.40  14325.48   4132.73   1324.33   3847.27
Min.Equity           -512.94   -669.31   -127.83   -496.42   -360.99
End.Equity          11094.89  11017.62   3581.04    558.64   1425.90

                         IYR       IYZ      LQD       RWR      SHY
Total.Net.Profit     3551.70    565.56   278.51   3846.21  1431.72
Total.Days            734.00    573.00   652.00    739.00  1113.00
Winning.Days          403.00    294.00   346.00    400.00   621.00
Losing.Days           331.00    279.00   306.00    339.00   492.00
Avg.Day.PL              4.84      0.99     0.43      5.20     1.29
Med.Day.PL             14.36      3.93     3.56     12.15     1.30
Largest.Winner        670.92    284.62   121.85    697.50    47.06
Largest.Loser        -589.08   -417.80  -158.88   -604.38   -56.73
Gross.Profits       38230.24  20613.93  9963.95  39597.03  5662.04
Gross.Losses       -34678.54 -20048.37 -9685.44 -35750.82 -4230.32
Std.Dev.Daily.PL      137.96     93.19    39.22    142.32    11.76
Percent.Positive       54.90     51.31    53.07     54.13    55.80
Percent.Negative       45.10     48.69    46.93     45.87    44.20
Profit.Factor           1.10      1.03     1.03      1.11     1.34
Avg.Win.Day            94.86     70.12    28.80     98.99     9.12
Med.Win.Day            78.84     57.86    23.58     76.99     7.16
Avg.Losing.Day       -104.77    -71.86   -31.65   -105.46    -8.60
Med.Losing.Day        -71.21    -51.15   -23.52    -73.72    -6.71
Avg.Daily.PL            4.84      0.99     0.43      5.20     1.29
Med.Daily.PL           14.36      3.93     3.56     12.15     1.30
Std.Dev.Daily.PL.1    137.96     93.19    39.22    142.32    11.76
Ann.Sharpe              0.56      0.17     0.17      0.58     1.74
Max.Drawdown        -2117.09  -2239.16  -853.57  -2500.81  -206.62
Profit.To.Max.Draw      1.68      0.25     0.33      1.54     6.93
Avg.WinLoss.Ratio       0.91      0.98     0.91      0.94     1.06
Med.WinLoss.Ratio       1.11      1.13     1.00      1.04     1.07
Max.Equity           4939.41   1994.72   729.12   5125.30  1496.21
Min.Equity              0.00   -803.23  -815.95      0.00  -178.23
End.Equity           3551.70    565.56   278.51   3846.21  1431.72

                         TLT       XLB       XLE       XLF       XLI
Total.Net.Profit     1685.94   6026.21   -721.62   1073.90   3270.62
Total.Days            561.00    696.00    577.00    413.00    646.00
Winning.Days          291.00    389.00    305.00    211.00    355.00
Losing.Days           270.00    307.00    272.00    202.00    291.00
Avg.Day.PL              3.01      8.66     -1.25      2.60      5.06
Med.Day.PL              7.24     18.15     11.98      3.59      9.82
Largest.Winner        532.71    409.39    497.44    532.50    576.04
Largest.Loser        -377.39   -446.88   -494.46   -631.42   -442.08
Gross.Profits       21279.66  36728.98  33683.15  16124.85  26384.16
Gross.Losses       -19593.73 -30702.77 -34404.77 -15050.95 -23113.53
Std.Dev.Daily.PL      100.15    125.48    149.29    112.73    102.81
Percent.Positive       51.87     55.89     52.86     51.09     54.95
Percent.Negative       48.13     44.11     47.14     48.91     45.05
Profit.Factor           1.09      1.20      0.98      1.07      1.14
Avg.Win.Day            73.13     94.42    110.44     76.42     74.32
Med.Win.Day            50.91     80.16     93.17     50.84     64.46
Avg.Losing.Day        -72.57   -100.01   -126.49    -74.51    -79.43
Med.Losing.Day        -57.64    -71.25    -96.00    -47.78    -55.28
Avg.Daily.PL            3.01      8.66     -1.25      2.60      5.06
Med.Daily.PL            7.24     18.15     11.98      3.59      9.82
Std.Dev.Daily.PL.1    100.15    125.48    149.29    112.73    102.81
Ann.Sharpe              0.48      1.10     -0.13      0.37      0.78
Max.Drawdown        -2020.60  -2343.85  -5364.07  -1497.18  -1480.30
Profit.To.Max.Draw      0.83      2.57     -0.13      0.72      2.21
Avg.WinLoss.Ratio       1.01      0.94      0.87      1.03      0.94
Med.WinLoss.Ratio       0.88      1.13      0.97      1.06      1.17
Max.Equity           3278.94   6034.85   3638.56   2209.75   4344.89
Min.Equity          -1033.35   -234.71  -1725.52   -353.34      0.00
End.Equity           1685.94   6026.21   -721.62   1073.90   3270.62

                         XLK       XLP       XLU       XLV       XLY
Total.Net.Profit     2786.08   1691.84   2071.68    329.36   1596.47
Total.Days            608.00    693.00    745.00    430.00    538.00
Winning.Days          339.00    378.00    407.00    214.00    283.00
Losing.Days           269.00    315.00    338.00    216.00    255.00
Avg.Day.PL              4.58      2.44      2.78      0.77      2.97
Med.Day.PL             14.76      8.42     11.72     -3.08      9.24
Largest.Winner        370.61    231.60    314.64    274.83    542.64
Largest.Loser        -434.61   -664.12   -425.69   -281.88   -410.21
Gross.Profits       27166.46  18243.42  29482.80  12726.07  21293.42
Gross.Losses       -24380.38 -16551.58 -27411.12 -12396.71 -19696.96
Std.Dev.Daily.PL      111.27     67.51    101.03     75.55    103.78
Percent.Positive       55.76     54.55     54.63     49.77     52.60
Percent.Negative       44.24     45.45     45.37     50.23     47.40
Profit.Factor           1.11      1.10      1.08      1.03      1.08
Avg.Win.Day            80.14     48.26     72.44     59.47     75.24
Med.Win.Day            59.85     41.83     59.86     46.78     59.84
Avg.Losing.Day        -90.63    -52.54    -81.10    -57.39    -77.24
Med.Losing.Day        -64.53    -40.45    -55.63    -45.04    -50.75
Avg.Daily.PL            4.58      2.44      2.78      0.77      2.97
Med.Daily.PL           14.76      8.42     11.72     -3.08      9.24
Std.Dev.Daily.PL.1    111.27     67.51    101.03     75.55    103.78
Ann.Sharpe              0.65      0.57      0.44      0.16      0.45
Max.Drawdown        -1984.37  -2106.40  -2360.48  -1327.16  -1540.71
Profit.To.Max.Draw      1.40      0.80      0.88      0.25      1.04
Avg.WinLoss.Ratio       0.88      0.92      0.89      1.04      0.97
Med.WinLoss.Ratio       0.93      1.03      1.08      1.04      1.18
Max.Equity           2883.68   2116.10   4325.65    653.11   2920.67
Min.Equity           -739.92    -49.59  -1004.33  -1293.46   -393.05
End.Equity           2786.08   1691.84   2071.68    329.36   1596.47

This leads to the following cash Sharpe ratio:

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

#Cash Sharpe
(SharpeRatio.annualized(portPL, geometric=FALSE))
                                Net.Trading.PL
Annualized Sharpe Ratio (Rf=0%)       0.611745

This is the resulting equity curve, compared to SPY.

instRets <- PortfReturns(account.st)
portfRets <- xts(rowMeans(instRets)*ncol(instRets), order.by=index(instRets))
cumPortfRets <- cumprod(1+portfRets)-1
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)-1
comparison <- cbind(cumPortfRets, cumSPYrets)
colnames(comparison)  <- c("strategy", "SPY")
chart.TimeSeries(comparison, legend.loc = "topleft", 
                 main=paste0("Period=", period, ", Delta=",delta))

Period 100 delta 0.2

Here are the Sharpe based on returns, annualized returns, and max drawdown.

> SharpeRatio.annualized(portfRets)
                                     [,1]
Annualized Sharpe Ratio (Rf=0%) 0.5891719
> Return.annualized(portfRets)
                        [,1]
Annualized Return 0.04025855
> maxDrawdown(portfRets)
[1] 0.0979138

Essentially, 4% annualized return for a max drawdown of nearly 10%, with a Sharpe Ratio nowhere close to 1. Definitely not the greatest strategy, but nevertheless, compared to SPY, far less volatile, when comparing equity curves. Once again, however, keep in mind that currently, the Trend Vigor is being used as a market mode indicator, rather than a dedicated trend follower. Keep that in the back of your mind as you look at the value of the actual indicator over time.

chart.Posn(portfolio.st, "XLB")
tmp <- TVI(Cl(XLB), period=period, delta=delta, triggerLag=30)
add_TA(tmp$vigor)
add_TA(tmp$trigger, on=5, col="red")

XLB default settings

To note, this is *not* the actual indicator I am using. The indicator for the strategy has triggerLag at 1–that is, the same computation, lagged a day. So I buy when the black line goes from heading downward to heading upward, and sell vice versa. This lags the indicator by 30 days (the red line) just to illustrate the concept for human visibility at that scale.

So, that’s a walkthrough of the default settings strategy.

Now, it’s time to explore the interaction of delta and the period setting.

First, I’m going to try setting delta to .05. In the demo, this is one of the earlier lines, and one of the earlier lines in the blog post (scroll up to see the exact code). Here are the trade and daily statistics after running the demo.

#Trade Statistics
                        EFA      EPP      EWA      EWC      EWG
Num.Txns              15.00    15.00    15.00    17.00    15.00
Num.Trades             8.00     8.00     8.00     9.00     8.00
Net.Trading.PL      8227.33 11063.30 13924.03 10733.98  9025.04
Avg.Trade.PL        1028.42  1382.91  1740.50  1192.66  1128.13
Med.Trade.PL        1019.15   887.77  1708.82  1057.51   589.32
Largest.Winner      2882.94  3910.23  4012.78  2849.73  4583.32
Largest.Loser       -595.29     0.00     0.00  -700.52 -1555.36
Gross.Profits       9030.96 11063.30 13924.03 11563.24 10730.64
Gross.Losses        -803.63     0.00     0.00  -829.26 -1705.60
Std.Dev.Trade.PL    1225.82  1230.98  1445.19  1273.92  1960.06
Percent.Positive      75.00   100.00   100.00    77.78    75.00
Percent.Negative      25.00     0.00     0.00    22.22    25.00
Profit.Factor         11.24      Inf      Inf    13.94     6.29
Avg.Win.Trade       1505.16  1382.91  1740.50  1651.89  1788.44
Med.Win.Trade       1468.87   887.77  1708.82  1865.24  1383.92
Avg.Losing.Trade    -401.82      NaN      NaN  -414.63  -852.80
Med.Losing.Trade    -401.82       NA       NA  -414.63  -852.80
Avg.Daily.PL        1151.85  1511.09  1940.12  1274.24  1283.89
Med.Daily.PL        1300.39  1077.08  2230.28  1461.37   861.35
Std.Dev.Daily.PL    1269.20  1270.64  1436.92  1336.51  2062.93
Ann.Sharpe            14.41    18.88    21.43    15.13     9.88
Max.Drawdown       -1973.63 -3221.65 -2703.01 -3330.82 -2252.59
Profit.To.Max.Draw     4.17     3.43     5.15     3.22     4.01
Avg.WinLoss.Ratio      3.75      NaN      NaN     3.98     2.10
Med.WinLoss.Ratio      3.66       NA       NA     4.50     1.62
Max.Equity          8783.50 11706.29 15425.82 10733.98  9377.84
Min.Equity          -165.27  -186.62  -399.56  -272.20   -16.66
End.Equity          8227.33 11063.30 13924.03 10733.98  9025.04

                        EWH      EWJ      EWS      EWT      EWU
Num.Txns              17.00    15.00    17.00    23.00    15.00
Num.Trades             9.00     8.00     9.00    12.00     8.00
Net.Trading.PL      8607.81  3989.12 12749.63  1198.79  8737.48
Avg.Trade.PL         956.42   498.64  1416.63    99.90  1092.18
Med.Trade.PL         603.38   145.35   803.77  -126.44   717.13
Largest.Winner      2737.89  3119.88  4604.52  1186.44  3266.73
Largest.Loser          0.00  -897.44  -548.92 -1112.23  -683.09
Gross.Profits       8610.51  5284.21 13298.55  4610.06  9945.34
Gross.Losses          -2.70 -1295.09  -548.92 -3411.26 -1207.86
Std.Dev.Trade.PL    1041.04  1245.20  1659.47   855.59  1509.68
Percent.Positive      88.89    62.50    88.89    41.67    75.00
Percent.Negative      11.11    37.50    11.11    58.33    25.00
Profit.Factor       3192.83     4.08    24.23     1.35     8.23
Avg.Win.Trade       1076.31  1056.84  1662.32   922.01  1657.56
Med.Win.Trade        625.45   519.93  1353.14  1032.56  1475.05
Avg.Losing.Trade      -2.70  -431.70  -548.92  -487.32  -603.93
Med.Losing.Trade      -2.70  -342.50  -548.92  -366.82  -603.93
Avg.Daily.PL        1076.31   495.60  1493.23   -30.81  1205.85
Med.Daily.PL         625.45     7.05  1163.55  -244.67  1005.50
Std.Dev.Daily.PL    1044.39  1344.93  1756.95   761.39  1593.25
Ann.Sharpe            16.36     5.85    13.49    -0.64    12.01
Max.Drawdown       -3209.01 -2930.01 -2495.29 -5536.64 -1932.03
Profit.To.Max.Draw     2.68     1.36     5.11     0.22     4.52
Avg.WinLoss.Ratio    399.10     2.45     3.03     1.89     2.74
Med.WinLoss.Ratio    231.92     1.52     2.47     2.81     2.44
Max.Equity          9206.16  6227.40 12909.67  3431.84  9432.62
Min.Equity             0.00  -542.64  -412.24 -2104.80  -253.67
End.Equity          8607.81  3989.12 12749.63  1198.79  8737.48

                        EWY      EWZ      EZU      IEF      IGE
Num.Txns              21.00    12.00    20.00    19.00    29.00
Num.Trades            11.00     6.00    10.00    10.00    15.00
Net.Trading.PL      8265.64 24932.44  6119.14   585.45  9010.26
Avg.Trade.PL         751.42  4155.41   611.91    58.55   600.68
Med.Trade.PL         590.63  3411.21   281.39    56.80    17.71
Largest.Winner      3444.27 11178.58  2767.56   578.57  4768.77
Largest.Loser      -1639.42 -1956.40 -1612.20  -452.40 -1044.03
Gross.Profits      11590.14 27007.07  9032.54  1631.70 13257.71
Gross.Losses       -3324.50 -2074.63 -2913.40 -1046.25 -4247.45
Std.Dev.Trade.PL    1635.85  5142.41  1467.12   334.39  1601.62
Percent.Positive      54.55    66.67    50.00    50.00    53.33
Percent.Negative      45.45    33.33    50.00    50.00    46.67
Profit.Factor          3.49    13.02     3.10     1.56     3.12
Avg.Win.Trade       1931.69  6751.77  1806.51   326.34  1657.21
Med.Win.Trade       1663.75  6783.34  2240.25   283.77  1170.69
Avg.Losing.Trade    -664.90 -1037.32  -582.68  -209.25  -606.78
Med.Losing.Trade    -548.58 -1037.32  -380.50  -229.98  -496.26
Avg.Daily.PL         719.50  4155.41   611.91    43.81   582.55
Med.Daily.PL         207.44  3411.21   281.39   -11.57   -18.62
Std.Dev.Daily.PL    1720.73  5142.41  1467.12   351.22  1660.48
Ann.Sharpe             6.64    12.83     6.62     1.98     5.57
Max.Drawdown       -4430.88 -8099.04 -2376.14 -1042.38 -3292.00
Profit.To.Max.Draw     1.87     3.08     2.58     0.56     2.74
Avg.WinLoss.Ratio      2.91     6.51     3.10     1.56     2.73
Med.WinLoss.Ratio      3.03     6.54     5.89     1.23     2.36
Max.Equity          9939.98 27860.83  6964.49  1297.25 10608.96
Min.Equity          -275.58  -699.79  -119.44  -977.06  -360.99
End.Equity          8265.64 24932.44  6119.14   585.45  9010.26

                        IYR      IYZ      LQD      RWR     SHY
Num.Txns              18.00    23.00    20.00    18.00   17.00
Num.Trades             9.00    12.00    10.00     9.00    9.00
Net.Trading.PL      5152.30  1708.37   130.39  6718.45 1745.26
Avg.Trade.PL         572.48   142.36    13.04   746.49  193.92
Med.Trade.PL         563.22  -120.54    75.65   526.70   23.61
Largest.Winner      2918.00  3024.24   405.72  3621.48 1408.27
Largest.Loser       -866.08  -719.83  -437.61  -525.69  -38.96
Gross.Profits       6578.80  4526.67  1234.36  7766.42 1838.06
Gross.Losses       -1426.50 -2818.30 -1103.97 -1047.98  -92.81
Std.Dev.Trade.PL    1116.84  1009.69   279.74  1259.65  461.97
Percent.Positive      55.56    33.33    60.00    66.67   66.67
Percent.Negative      44.44    66.67    40.00    33.33   33.33
Profit.Factor          4.61     1.61     1.12     7.41   19.81
Avg.Win.Trade       1315.76  1131.67   205.73  1294.40  306.34
Med.Win.Trade       1065.80   607.86   193.42   935.99   94.33
Avg.Losing.Trade    -356.62  -352.29  -275.99  -349.33  -30.94
Med.Losing.Trade    -207.69  -356.49  -272.49  -422.60  -37.39
Avg.Daily.PL         572.48    83.84    13.04   746.49  206.09
Med.Daily.PL         563.22  -193.76    75.65   526.70   19.61
Std.Dev.Daily.PL    1116.84  1037.40   279.74  1259.65  492.32
Ann.Sharpe             8.14     1.28     0.74     9.41    6.65
Max.Drawdown       -2630.67 -1861.72  -936.63 -2352.97 -256.48
Profit.To.Max.Draw     1.96     0.92     0.14     2.86    6.80
Avg.WinLoss.Ratio      3.69     3.21     0.75     3.71    9.90
Med.WinLoss.Ratio      5.13     1.71     0.71     2.21    2.52
Max.Equity          6254.05  2468.70   536.06  7751.61 1786.95
Min.Equity             0.00 -1795.37  -899.01     0.00  -89.54
End.Equity          5152.30  1708.37   130.39  6718.45 1745.26

                        TLT      XLB      XLE      XLF      XLI
Num.Txns              24.00    21.00    27.00    16.00    15.00
Num.Trades            12.00    11.00    14.00     8.00     8.00
Net.Trading.PL      2066.64  4949.22 12832.20  3832.14  4152.85
Avg.Trade.PL         172.22   449.93   916.59   479.02   519.11
Med.Trade.PL          64.51   299.25    29.49   177.45   432.70
Largest.Winner      1516.76  2465.37 10722.60  2492.20  2076.85
Largest.Loser       -799.95 -1213.35 -1470.10 -1011.16  -780.27
Gross.Profits       3385.01  8451.54 16601.75  5130.47  5213.68
Gross.Losses       -1318.37 -3502.32 -3769.55 -1298.33 -1060.84
Std.Dev.Trade.PL     571.70  1338.56  3059.14  1099.30   908.57
Percent.Positive      58.33    63.64    57.14    62.50    75.00
Percent.Negative      41.67    36.36    42.86    37.50    25.00
Profit.Factor          2.57     2.41     4.40     3.95     4.91
Avg.Win.Trade        483.57  1207.36  2075.22  1026.09   868.95
Med.Win.Trade        353.25   696.82   520.06   745.78   635.27
Avg.Losing.Trade    -263.67  -875.58  -628.26  -432.78  -530.42
Med.Losing.Trade    -127.47  -965.22  -502.49  -243.40  -530.42
Avg.Daily.PL         172.22   425.24   897.10   479.02   483.63
Med.Daily.PL          64.51   172.27    25.82   177.45   362.26
Std.Dev.Daily.PL     571.70  1408.32  3183.15  1099.30   975.37
Ann.Sharpe             4.78     4.79     4.47     6.92     7.87
Max.Drawdown       -2230.38 -3263.67 -3550.72 -2353.27 -1876.74
Profit.To.Max.Draw     0.93     1.52     3.61     1.63     2.21
Avg.WinLoss.Ratio      1.83     1.38     3.30     2.37     1.64
Med.WinLoss.Ratio      2.77     0.72     1.03     3.06     1.20
Max.Equity          3450.04  6216.57 13284.80  5838.21  5031.19
Min.Equity         -1261.84  -116.14  -468.28  -106.64  -134.79
End.Equity          2066.64  4949.22 12832.20  3832.14  4152.85

                        XLK     XLP      XLU      XLV      XLY
Num.Txns              19.00   13.00    15.00    21.00    15.00
Num.Trades            10.00    7.00     8.00    11.00     8.00
Net.Trading.PL      5676.09 3673.84  4611.03  -318.04  5316.38
Avg.Trade.PL         567.61  524.83   576.38   -28.91   664.55
Med.Trade.PL         437.57  170.61   273.18    12.47   254.12
Largest.Winner      3770.88 1614.82  3011.64   619.76  3835.14
Largest.Loser       -698.78 -248.32  -966.49  -679.66  -601.28
Gross.Profits       7910.97 3943.62  5906.06  1676.74  6737.00
Gross.Losses       -2234.88 -269.78 -1295.04 -1994.78 -1420.62
Std.Dev.Trade.PL    1370.91  704.46  1281.22   417.22  1496.94
Percent.Positive      60.00   71.43    75.00    54.55    62.50
Percent.Negative      40.00   28.57    25.00    45.45    37.50
Profit.Factor          3.54   14.62     4.56     0.84     4.74
Avg.Win.Trade       1318.49  788.72   984.34   279.46  1347.40
Med.Win.Trade        787.39 1043.70   426.32   208.37   600.59
Avg.Losing.Trade    -558.72 -134.89  -647.52  -398.96  -473.54
Med.Losing.Trade    -581.97 -134.89  -647.52  -424.36  -497.16
Avg.Daily.PL         600.09  583.87   596.95   -48.94   692.34
Med.Daily.PL         599.90  551.34   126.12   -65.24    38.23
Std.Dev.Daily.PL    1449.98  752.49  1382.45   434.18  1614.65
Ann.Sharpe             6.57   12.32     6.85    -1.79     6.81
Max.Drawdown       -2163.21 -945.00 -2389.00 -1574.99 -2265.49
Profit.To.Max.Draw     2.62    3.89     1.93    -0.20     2.35
Avg.WinLoss.Ratio      2.36    5.85     1.52     0.70     2.85
Med.WinLoss.Ratio      1.35    7.74     0.66     0.49     1.21
Max.Equity          6522.36 3705.07  5776.84   731.12  7076.43
Min.Equity          -206.72 -315.77  -772.21 -1189.32   -55.79
End.Equity          5676.09 3673.84  4611.03  -318.04  5316.38


#Daily Statistics
                         EFA       EPP       EWA       EWC       EWG
Total.Net.Profit     8227.33  11063.30  13924.03  10733.98   9025.04
Total.Days           1007.00   1161.00   1171.00   1131.00   1006.00
Winning.Days          554.00    639.00    661.00    635.00    558.00
Losing.Days           453.00    522.00    510.00    496.00    448.00
Avg.Day.PL              8.17      9.53     11.89      9.49      8.97
Med.Day.PL             12.93     13.50     21.99     24.36     19.33
Largest.Winner        408.21    705.97    644.19    517.86    510.65
Largest.Loser        -446.90   -653.65   -726.30   -640.19   -578.28
Gross.Profits       48673.31  74367.84  84153.20  67767.25  62690.85
Gross.Losses       -40445.98 -63304.54 -70229.17 -57033.27 -53665.80
Std.Dev.Daily.PL      116.11    164.25    178.88    143.87    150.39
Percent.Positive       55.01     55.04     56.45     56.15     55.47
Percent.Negative       44.99     44.96     43.55     43.85     44.53
Profit.Factor           1.20      1.17      1.20      1.19      1.17
Avg.Win.Day            87.86    116.38    127.31    106.72    112.35
Med.Win.Day            72.86     87.42    100.11     86.51     89.18
Avg.Losing.Day        -89.28   -121.27   -137.70   -114.99   -119.79
Med.Losing.Day        -66.22    -80.24    -95.53    -82.40    -89.92
Avg.Daily.PL            8.17      9.53     11.89      9.49      8.97
Med.Daily.PL           12.93     13.50     21.99     24.36     19.33
Std.Dev.Daily.PL.1    116.11    164.25    178.88    143.87    150.39
Ann.Sharpe              1.12      0.92      1.06      1.05      0.95
Max.Drawdown        -1973.63  -3221.65  -2703.01  -3330.82  -2252.59
Profit.To.Max.Draw      4.17      3.43      5.15      3.22      4.01
Avg.WinLoss.Ratio       0.98      0.96      0.92      0.93      0.94
Med.WinLoss.Ratio       1.10      1.09      1.05      1.05      0.99
Max.Equity           8783.50  11706.29  15425.82  10733.98   9377.84
Min.Equity           -165.27   -186.62   -399.56   -272.20    -16.66
End.Equity           8227.33  11063.30  13924.03  10733.98   9025.04

                         EWH       EWJ       EWS       EWT       EWU
Total.Net.Profit     8607.81   3989.12  12749.63   1198.79   8737.48
Total.Days           1012.00    726.00   1146.00    851.00   1014.00
Winning.Days          531.00    379.00    639.00    438.00    554.00
Losing.Days           481.00    347.00    507.00    413.00    460.00
Avg.Day.PL              8.51      5.49     11.13      1.41      8.62
Med.Day.PL             12.53     13.79     21.28      8.92     15.16
Largest.Winner        753.74    517.40    785.37    880.75    462.83
Largest.Loser        -902.02   -782.59   -974.26  -1417.30   -590.98
Gross.Profits       72436.39  43880.76  82366.04  58541.90  54123.90
Gross.Losses       -63828.58 -39891.64 -69616.41 -57343.10 -45386.42
Std.Dev.Daily.PL      182.08    149.18    181.55    183.18    128.25
Percent.Positive       52.47     52.20     55.76     51.47     54.64
Percent.Negative       47.53     47.80     44.24     48.53     45.36
Profit.Factor           1.13      1.10      1.18      1.02      1.19
Avg.Win.Day           136.42    115.78    128.90    133.66     97.70
Med.Win.Day           104.08     94.55     91.27    108.07     80.81
Avg.Losing.Day       -132.70   -114.96   -137.31   -138.85    -98.67
Med.Losing.Day        -95.34    -85.90   -104.28    -99.70    -72.84
Avg.Daily.PL            8.51      5.49     11.13      1.41      8.62
Med.Daily.PL           12.53     13.79     21.28      8.92     15.16
Std.Dev.Daily.PL.1    182.08    149.18    181.55    183.18    128.25
Ann.Sharpe              0.74      0.58      0.97      0.12      1.07
Max.Drawdown        -3209.01  -2930.01  -2495.29  -5536.64  -1932.03
Profit.To.Max.Draw      2.68      1.36      5.11      0.22      4.52
Avg.WinLoss.Ratio       1.03      1.01      0.94      0.96      0.99
Med.WinLoss.Ratio       1.09      1.10      0.88      1.08      1.11
Max.Equity           9206.16   6227.40  12909.67   3431.84   9432.62
Min.Equity              0.00   -542.64   -412.24  -2104.80   -253.67
End.Equity           8607.81   3989.12  12749.63   1198.79   8737.48

                         EWY        EWZ       EZU       IEF       IGE
Total.Net.Profit     8265.64   24932.44   6119.14    585.45   9010.26
Total.Days           1115.00    1271.00    980.00    874.00   1212.00
Winning.Days          599.00     709.00    539.00    438.00    670.00
Losing.Days           516.00     562.00    441.00    436.00    542.00
Avg.Day.PL              7.41      19.62      6.24      0.67      7.43
Med.Day.PL             18.37      37.21     14.74      0.78     20.63
Largest.Winner        833.96    1516.20    511.25    359.14    456.89
Largest.Loser        -757.96   -1676.65   -743.07   -195.28   -600.22
Gross.Profits       96772.35  173737.17  52301.23  17413.21  79833.45
Gross.Losses       -88506.71 -148804.74 -46182.09 -16827.76 -70823.19
Std.Dev.Daily.PL      218.24     347.76    134.07     52.43    159.01
Percent.Positive       53.72      55.78     55.00     50.11     55.28
Percent.Negative       46.28      44.22     45.00     49.89     44.72
Profit.Factor           1.09       1.17      1.13      1.03      1.13
Avg.Win.Day           161.56     245.05     97.03     39.76    119.15
Med.Win.Day           131.89     190.69     76.26     32.13    100.58
Avg.Losing.Day       -171.52    -264.78   -104.72    -38.60   -130.67
Med.Losing.Day       -118.99    -181.70    -73.90    -29.23   -103.79
Avg.Daily.PL            7.41      19.62      6.24      0.67      7.43
Med.Daily.PL           18.37      37.21     14.74      0.78     20.63
Std.Dev.Daily.PL.1    218.24     347.76    134.07     52.43    159.01
Ann.Sharpe              0.54       0.90      0.74      0.20      0.74
Max.Drawdown        -4430.88   -8099.04  -2376.14  -1042.38  -3292.00
Profit.To.Max.Draw      1.87       3.08      2.58      0.56      2.74
Avg.WinLoss.Ratio       0.94       0.93      0.93      1.03      0.91
Med.WinLoss.Ratio       1.11       1.05      1.03      1.10      0.97
Max.Equity           9939.98   27860.83   6964.49   1297.25  10608.96
Min.Equity           -275.58    -699.79   -119.44   -977.06   -360.99
End.Equity           8265.64   24932.44   6119.14    585.45   9010.26

                         IYR       IYZ       LQD       RWR      SHY
Total.Net.Profit     5152.30   1708.37    130.39   6718.45  1745.26
Total.Days            981.00    948.00    770.00    992.00  1345.00
Winning.Days          536.00    480.00    408.00    538.00   753.00
Losing.Days           445.00    468.00    362.00    454.00   592.00
Avg.Day.PL              5.25      1.80      0.17      6.77     1.30
Med.Day.PL             14.23      3.87      3.36     16.33     1.31
Largest.Winner        670.92    455.49    211.30    697.50    47.38
Largest.Loser        -589.08   -439.41   -274.58   -604.38   -57.51
Gross.Profits       53330.41  36851.16  12914.84  56782.80  6920.89
Gross.Losses       -48178.11 -35142.78 -12784.45 -50064.35 -5175.63
Std.Dev.Daily.PL      139.95    100.60     44.38    146.67    11.97
Percent.Positive       54.64     50.63     52.99     54.23    55.99
Percent.Negative       45.36     49.37     47.01     45.77    44.01
Profit.Factor           1.11      1.05      1.01      1.13     1.34
Avg.Win.Day            99.50     76.77     31.65    105.54     9.19
Med.Win.Day            81.52     60.01     24.89     84.35     7.19
Avg.Losing.Day       -108.27    -75.09    -35.32   -110.27    -8.74
Med.Losing.Day        -76.06    -53.60    -27.51    -81.40    -6.81
Avg.Daily.PL            5.25      1.80      0.17      6.77     1.30
Med.Daily.PL           14.23      3.87      3.36     16.33     1.31
Std.Dev.Daily.PL.1    139.95    100.60     44.38    146.67    11.97
Ann.Sharpe              0.60      0.28      0.06      0.73     1.72
Max.Drawdown        -2630.67  -1861.72   -936.63  -2352.97  -256.48
Profit.To.Max.Draw      1.96      0.92      0.14      2.86     6.80
Avg.WinLoss.Ratio       0.92      1.02      0.90      0.96     1.05
Med.WinLoss.Ratio       1.07      1.12      0.90      1.04     1.06
Max.Equity           6254.05   2468.70    536.06   7751.61  1786.95
Min.Equity              0.00  -1795.37   -899.01      0.00   -89.54
End.Equity           5152.30   1708.37    130.39   6718.45  1745.26

                         TLT       XLB       XLE       XLF       XLI
Total.Net.Profit     2066.64   4949.22  12832.20   3832.14   4152.85
Total.Days            755.00   1039.00   1154.00    738.00   1001.00
Winning.Days          390.00    569.00    630.00    386.00    544.00
Losing.Days           365.00    470.00    524.00    352.00    457.00
Avg.Day.PL              2.74      4.76     11.12      5.19      4.15
Med.Day.PL              4.68     16.84     23.19      6.77      9.43
Largest.Winner        546.86    543.49    649.18    521.32    567.57
Largest.Loser        -387.41   -561.19   -898.57   -695.88   -461.98
Gross.Profits       29206.43  60629.30  91312.60  34177.43  41796.72
Gross.Losses       -27139.79 -55680.08 -78480.40 -30345.29 -37643.87
Std.Dev.Daily.PL      102.19    145.68    196.01    128.37    105.23
Percent.Positive       51.66     54.76     54.59     52.30     54.35
Percent.Negative       48.34     45.24     45.41     47.70     45.65
Profit.Factor           1.08      1.09      1.16      1.13      1.11
Avg.Win.Day            74.89    106.55    144.94     88.54     76.83
Med.Win.Day            52.20     90.91    112.15     61.85     62.90
Avg.Losing.Day        -74.36   -118.47   -149.77    -86.21    -82.37
Med.Losing.Day        -59.22    -87.40   -108.63    -54.35    -59.78
Avg.Daily.PL            2.74      4.76     11.12      5.19      4.15
Med.Daily.PL            4.68     16.84     23.19      6.77      9.43
Std.Dev.Daily.PL.1    102.19    145.68    196.01    128.37    105.23
Ann.Sharpe              0.43      0.52      0.90      0.64      0.63
Max.Drawdown        -2230.38  -3263.67  -3550.72  -2353.27  -1876.74
Profit.To.Max.Draw      0.93      1.52      3.61      1.63      2.21
Avg.WinLoss.Ratio       1.01      0.90      0.97      1.03      0.93
Med.WinLoss.Ratio       0.88      1.04      1.03      1.14      1.05
Max.Equity           3450.04   6216.57  13284.80   5838.21   5031.19
Min.Equity          -1261.84   -116.14   -468.28   -106.64   -134.79
End.Equity           2066.64   4949.22  12832.20   3832.14   4152.85

                         XLK       XLP       XLU       XLV       XLY
Total.Net.Profit     5676.09   3673.84   4611.03   -318.04   5316.38
Total.Days            964.00    999.00   1024.00    892.00    795.00
Winning.Days          536.00    549.00    562.00    449.00    422.00
Losing.Days           428.00    450.00    462.00    443.00    373.00
Avg.Day.PL              5.89      3.68      4.50     -0.36      6.69
Med.Day.PL             13.65      8.52     11.94      3.04      8.89
Largest.Winner        431.35    298.68    359.25    291.48    741.77
Largest.Loser        -462.31   -261.14   -429.41   -319.27   -560.75
Gross.Profits       45283.91  28445.54  41231.21  27231.30  37590.36
Gross.Losses       -39607.82 -24771.70 -36620.18 -27549.33 -32273.98
Std.Dev.Daily.PL      117.38     67.41    101.36     79.97    123.15
Percent.Positive       55.60     54.95     54.88     50.34     53.08
Percent.Negative       44.40     45.05     45.12     49.66     46.92
Profit.Factor           1.14      1.15      1.13      0.99      1.16
Avg.Win.Day            84.48     51.81     73.37     60.65     89.08
Med.Win.Day            60.65     42.81     59.91     50.84     67.06
Avg.Losing.Day        -92.54    -55.05    -79.26    -62.19    -86.53
Med.Losing.Day        -64.97    -44.88    -54.05    -49.00    -56.79
Avg.Daily.PL            5.89      3.68      4.50     -0.36      6.69
Med.Daily.PL           13.65      8.52     11.94      3.04      8.89
Std.Dev.Daily.PL.1    117.38     67.41    101.36     79.97    123.15
Ann.Sharpe              0.80      0.87      0.71     -0.07      0.86
Max.Drawdown        -2163.21   -945.00  -2389.00  -1574.99  -2265.49
Profit.To.Max.Draw      2.62      3.89      1.93     -0.20      2.35
Avg.WinLoss.Ratio       0.91      0.94      0.93      0.98      1.03
Med.WinLoss.Ratio       0.93      0.95      1.11      1.04      1.18
Max.Equity           6522.36   3705.07   5776.84    731.12   7076.43
Min.Equity           -206.72   -315.77   -772.21  -1189.32    -55.79
End.Equity           5676.09   3673.84   4611.03   -318.04   5316.38

The equity curve (vs. SPY)
Delta .05

This time, while you take on more risk, your returns are definitely better–essentially keeping pace with SPY in its bullish phases while missing the financial crisis (as any decent trend-follower does). That stated, the drawdowns between this strategy and SPY happen at similar times, meaning that given that there are more equity indices than the SPY (as well as bond indices), that position sizing for the strategy can be improved for diversification.

Here are the three portfolio statistics:

> SharpeRatio.annualized(portfRets)
                                     [,1]
Annualized Sharpe Ratio (Rf=0%) 0.7914488
> Return.annualized(portfRets)
                        [,1]
Annualized Return 0.08098812
> maxDrawdown(portfRets)
[1] 0.1283513

Finally, here’s the new indicator plot, this time with the true lagged indicator plotted.

XLB EC p100 delta .05

Notice that the indicator stays at more extreme values more often.

Let’s take this to the limit and set delta to zero.

Here are the trade stats:


                        EFA      EPP      EWA      EWC      EWG
Num.Txns              11.00     9.00    11.00    11.00    11.00
Num.Trades             6.00     5.00     6.00     6.00     6.00
Net.Trading.PL      9095.11 12779.16 14602.67 12673.96 11222.15
Avg.Trade.PL        1515.85  2555.83  2433.78  2112.33  1870.36
Med.Trade.PL        1820.06  2623.33  2709.23  2305.23  1861.94
Largest.Winner      3631.16  4615.15  5833.88  6144.25  3159.37
Largest.Loser       -933.65     0.00  -590.11 -1792.36     0.00
Gross.Profits      10028.75 12779.16 15192.78 14466.32 11222.15
Gross.Losses        -933.65     0.00  -590.11 -1792.36     0.00
Std.Dev.Trade.PL    1684.91  1513.27  2196.84  2607.66  1142.29
Percent.Positive      83.33   100.00    83.33    83.33   100.00
Percent.Negative      16.67     0.00    16.67    16.67     0.00
Profit.Factor         10.74      Inf    25.75     8.07      Inf
Avg.Win.Trade       2005.75  2555.83  3038.56  2893.26  1870.36
Med.Win.Trade       2479.23  2623.33  2780.49  2762.52  1861.94
Avg.Losing.Trade    -933.65      NaN  -590.11 -1792.36      NaN
Med.Losing.Trade    -933.65       NA  -590.11 -1792.36       NA
Avg.Daily.PL        1772.55  3065.78  2764.58  2357.14  2203.82
Med.Daily.PL        2479.23  2874.02  2780.49  2762.52  2359.07
Std.Dev.Daily.PL    1747.70  1148.77  2282.97  2837.32   892.78
Ann.Sharpe            16.10    42.37    19.22    13.19    39.19
Max.Drawdown       -2804.25 -3977.43 -4487.98 -4446.67 -3101.41
Profit.To.Max.Draw     3.24     3.21     3.25     2.85     3.62
Avg.WinLoss.Ratio      2.15      NaN     5.15     1.61      NaN
Med.WinLoss.Ratio      2.66       NA     4.71     1.54       NA
Max.Equity         10373.87 14886.32 16959.46 12828.77 12321.51
Min.Equity          -165.27  -186.62  -399.56  -272.20   -16.66
End.Equity          9095.11 12779.16 14602.67 12673.96 11222.15

                        EWH      EWJ      EWS      EWT      EWU
Num.Txns               7.00    13.00     9.00    15.00    11.00
Num.Trades             4.00     7.00     5.00     8.00     6.00
Net.Trading.PL     15840.82  5176.40 18882.47  3321.05  8340.94
Avg.Trade.PL        3960.20   739.49  3776.49   415.13  1390.16
Med.Trade.PL        3129.89   641.19  2657.46   125.19  1255.15
Largest.Winner      7545.70  3116.82 11080.06  3111.65  3892.96
Largest.Loser          0.00 -1200.32 -1012.71 -2126.89 -1020.86
Gross.Profits      15840.82  6376.72 19895.19  6644.85  9361.80
Gross.Losses           0.00 -1200.32 -1012.71 -3323.80 -1020.86
Std.Dev.Trade.PL    2449.69  1342.88  4478.92  1657.15  1717.55
Percent.Positive     100.00    85.71    80.00    62.50    83.33
Percent.Negative       0.00    14.29    20.00    37.50    16.67
Profit.Factor           Inf     5.31    19.65     2.00     9.17
Avg.Win.Trade       3960.20  1062.79  4973.80  1328.97  1872.36
Med.Win.Trade       3129.89   738.02  3334.30  1366.22  1290.27
Avg.Losing.Trade        NaN -1200.32 -1012.71 -1107.93 -1020.86
Med.Losing.Trade         NA -1200.32 -1012.71  -811.78 -1020.86
Avg.Daily.PL        4601.83   723.59  4183.99   200.63  1601.16
Med.Daily.PL        3307.58   391.69  3334.30    33.08  1290.27
Std.Dev.Daily.PL    2555.65  1470.34  5063.65  1665.66  1831.27
Ann.Sharpe            28.58     7.81    13.12     1.91    13.88
Max.Drawdown       -6279.36 -3186.71 -6357.43 -5074.58 -2806.72
Profit.To.Max.Draw     2.52     1.62     2.97     0.65     2.97
Avg.WinLoss.Ratio       NaN     0.89     4.91     1.20     1.83
Med.WinLoss.Ratio        NA     0.61     3.29     1.68     1.26
Max.Equity         16555.02  6833.58 19063.41  3473.68  9627.51
Min.Equity          -117.59  -396.06  -412.24 -1842.71  -253.67
End.Equity         15840.82  5176.40 18882.47  3321.05  8340.94

                        EWY      EWZ      EZU      IEF      IGE
Num.Txns              11.00     9.00     9.00    17.00     9.00
Num.Trades             6.00     5.00     5.00     9.00     5.00
Net.Trading.PL     16345.10 29677.36  9371.42   835.02 14116.64
Avg.Trade.PL        2724.18  5935.47  1874.28    92.78  2823.33
Med.Trade.PL        1151.79  7224.58  1259.50   -13.70  1578.21
Largest.Winner      7324.66 11173.16  4689.91   934.88 11236.40
Largest.Loser        -59.53     0.00     0.00  -243.00 -2370.85
Gross.Profits      16404.63 29677.36  9552.12  1538.80 16487.49
Gross.Losses         -59.53     0.00  -180.70  -703.78 -2370.85
Std.Dev.Trade.PL    3043.54  4291.41  1838.25   365.25  5039.93
Percent.Positive      83.33   100.00    80.00    44.44    80.00
Percent.Negative      16.67     0.00    20.00    55.56    20.00
Profit.Factor        275.58      Inf    52.86     2.19     6.95
Avg.Win.Trade       3280.93  5935.47  2388.03   384.70  4121.87
Med.Win.Trade       1208.67  7224.58  1879.94   210.16  1915.33
Avg.Losing.Trade     -59.53      NaN  -180.70  -140.76 -2370.85
Med.Losing.Trade     -59.53       NA  -180.70  -206.60 -2370.85
Avg.Daily.PL        3072.41  7399.70  2388.03    81.43  3134.61
Med.Daily.PL        1208.67  7532.93  1879.94   -20.44  1836.44
Std.Dev.Daily.PL    3266.42  3203.41  1657.09   388.77  5763.85
Ann.Sharpe            14.93    36.67    22.88     3.32     8.63
Max.Drawdown       -4656.74 -8660.23 -3353.89 -1345.79 -4492.64
Profit.To.Max.Draw     3.51     3.43     2.79     0.62     3.14
Avg.WinLoss.Ratio     55.12      NaN    13.22     2.73     1.74
Med.WinLoss.Ratio     20.30       NA    10.40     1.02     0.81
Max.Equity         16548.01 31682.83 11221.49  1756.16 14420.81
Min.Equity             0.00  -699.79  -119.44  -714.17  -360.99
End.Equity         16345.10 29677.36  9371.42   835.02 14116.64

                        IYR      IYZ      LQD      RWR     SHY
Num.Txns              11.00    13.00    15.00     9.00    9.00
Num.Trades             6.00     7.00     8.00     5.00    5.00
Net.Trading.PL     12860.27  5906.68  2177.09 15725.34 2126.96
Avg.Trade.PL        2143.38   843.81   272.14  3145.07  425.39
Med.Trade.PL        1549.35    -4.31    -9.55  1933.28  265.78
Largest.Winner      2494.86  2704.21   239.07  3664.07 1544.02
Largest.Loser      -1003.00  -789.18  -176.30  -664.12  -28.09
Gross.Profits      13863.26  7533.20  2468.60 16389.46 2155.05
Gross.Losses       -1003.00 -1626.52  -291.51  -664.12  -28.09
Std.Dev.Trade.PL    2977.41  2061.62   767.56  3956.03  639.74
Percent.Positive      83.33    42.86    37.50    80.00   80.00
Percent.Negative      16.67    57.14    62.50    20.00   20.00
Profit.Factor         13.82     4.63     8.47    24.68   76.71
Avg.Win.Trade       2772.65  2511.07   822.87  4097.37  538.76
Med.Win.Trade       1859.25  2704.21   239.07  2798.67  277.14
Avg.Losing.Trade   -1003.00  -406.63   -58.30  -664.12  -28.09
Med.Losing.Trade   -1003.00  -416.51   -36.93  -664.12  -28.09
Avg.Daily.PL        1031.33   200.00     4.06  1518.44  459.61
Med.Daily.PL        1239.44  -143.55   -15.28  1536.90  161.27
Std.Dev.Daily.PL    1344.03  1272.26   128.95  1796.50  733.41
Ann.Sharpe            12.18     2.50     0.50    13.42    9.95
Max.Drawdown       -4545.72 -3655.24 -1126.20 -4720.58 -258.24
Profit.To.Max.Draw     2.83     1.62     1.93     3.33    8.24
Avg.WinLoss.Ratio      2.76     6.18    14.11     6.17   19.18
Med.WinLoss.Ratio      1.85     6.49     6.47     4.21    9.86
Max.Equity         13193.50  5906.68  2600.28 16148.05 2169.34
Min.Equity             0.00 -1458.57  -750.84     0.00  -62.71
End.Equity         12860.27  5906.68  2177.09 15725.34 2126.96

                        TLT      XLB      XLE      XLF      XLI
Num.Txns              16.00    13.00     9.00    11.00    13.00
Num.Trades             8.00     7.00     5.00     6.00     7.00
Net.Trading.PL     -1042.28  8143.08 16350.23  6938.82  8270.94
Avg.Trade.PL        -130.28  1163.30  3270.05  1156.47  1181.56
Med.Trade.PL        -190.63  1181.00  1463.69  1327.34   915.45
Largest.Winner       442.59  2651.96 12793.77  2912.28  3541.70
Largest.Loser       -816.24  -920.78 -2248.45  -681.58 -1047.09
Gross.Profits       1090.18  9063.85 18598.68  7620.40  9318.03
Gross.Losses       -2132.46  -920.78 -2248.45  -681.58 -1047.09
Std.Dev.Trade.PL     463.66  1253.96  5680.01  1285.82  1537.81
Percent.Positive      37.50    85.71    80.00    83.33    85.71
Percent.Negative      62.50    14.29    20.00    16.67    14.29
Profit.Factor          0.51     9.84     8.27    11.18     8.90
Avg.Win.Trade        363.39  1510.64  4649.67  1524.08  1553.00
Med.Win.Trade        326.19  1375.19  2343.25  1551.96  1241.86
Avg.Losing.Trade    -426.49  -920.78 -2248.45  -681.58 -1047.09
Med.Losing.Trade    -297.11  -920.78 -2248.45  -681.58 -1047.09
Avg.Daily.PL        -130.28  1160.35  3721.63  1167.22  1225.92
Med.Daily.PL        -190.63  1106.96  2170.61  1551.96  1032.03
Std.Dev.Daily.PL     463.66  1373.62  6454.23  1437.28  1679.67
Ann.Sharpe            -4.46    13.41     9.15    12.89    11.59
Max.Drawdown       -3334.35 -2518.13 -4156.71 -2212.82 -2700.70
Profit.To.Max.Draw    -0.31     3.23     3.93     3.14     3.06
Avg.WinLoss.Ratio      0.85     1.64     2.07     2.24     1.48
Med.WinLoss.Ratio      1.10     1.49     1.04     2.28     1.19
Max.Equity          1995.24  9004.95 17110.53  7130.66  9488.70
Min.Equity         -1736.55  -116.14  -468.28  -106.64  -134.79
End.Equity         -1042.28  8143.08 16350.23  6938.82  8270.94

                        XLK      XLP      XLU      XLV      XLY
Num.Txns              13.00    13.00    11.00    17.00    15.00
Num.Trades             7.00     7.00     6.00     9.00     8.00
Net.Trading.PL      3773.49  5237.29  7443.30 -2400.55  2813.65
Avg.Trade.PL         539.07   748.18  1240.55  -266.73   351.71
Med.Trade.PL          11.43   320.54   164.75  -237.80  -130.81
Largest.Winner      3116.75  2419.39  6111.02   933.17  2821.36
Largest.Loser       -871.76  -965.46 -1390.74 -2162.93  -572.05
Gross.Profits       5172.39  6202.75  9530.05  1757.14  4713.91
Gross.Losses       -1398.90  -965.46 -2086.75 -4157.69 -1900.26
Std.Dev.Trade.PL    1392.56  1220.14  2826.50   889.12  1191.92
Percent.Positive      57.14    85.71    50.00    44.44    37.50
Percent.Negative      42.86    14.29    50.00    55.56    62.50
Profit.Factor          3.70     6.42     4.57     0.42     2.48
Avg.Win.Trade       1293.10  1033.79  3176.68   439.28  1571.30
Med.Win.Trade       1022.11   725.83  3054.43   341.19  1288.17
Avg.Losing.Trade    -466.30  -965.46  -695.58  -831.54  -380.05
Med.Losing.Trade    -475.97  -965.46  -660.91  -565.29  -508.62
Avg.Daily.PL         568.92   819.46  1415.74  -317.77   315.61
Med.Daily.PL         -19.87   616.89   -35.09  -319.04  -225.91
Std.Dev.Daily.PL    1523.02  1320.53  3123.49   936.31  1282.69
Ann.Sharpe             5.93     9.85     7.20    -5.39     3.91
Max.Drawdown       -3680.30 -2095.40 -3243.95 -3650.41 -3721.65
Profit.To.Max.Draw     1.03     2.50     2.29    -0.66     0.76
Avg.WinLoss.Ratio      2.77     1.07     4.57     0.53     4.13
Med.WinLoss.Ratio      2.15     0.75     4.62     0.60     2.53
Max.Equity          4245.23  5269.06 10132.95   318.90  4439.62
Min.Equity          -776.77  -244.67  -772.21 -3331.51 -1497.63
End.Equity          3773.49  5237.29  7443.30 -2400.55  2813.65

At this point, profit factors become obscene, and even the aggregate profit factor (sum of all gross profits divided by the negative sum of all gross losses) clocks in above 9, with the average percentage correct being above 70% (mean of the percent positive). In reality, this turns Trend Vigor into an up-or-down classifier (to use some machine-learning terminology), with no-in betweens, as you’ll see in a moment.

Here are the daily stats.

                         EFA       EPP       EWA       EWC       EWG
Total.Net.Profit     9095.11  12779.16  14602.67  12673.96  11222.15
Total.Days           1322.00   1414.00   1412.00   1492.00   1252.00
Winning.Days          725.00    773.00    784.00    829.00    697.00
Losing.Days           597.00    641.00    628.00    663.00    555.00
Avg.Day.PL              6.88      9.04     10.34      8.49      8.96
Med.Day.PL             13.62     14.90     21.27     20.66     19.16
Largest.Winner        568.38    880.27   1041.16    567.09    528.85
Largest.Loser        -576.56   -862.67   -975.68   -631.38   -864.63
Gross.Profits       71000.29  97398.68 111477.67  96460.68  80358.74
Gross.Losses       -61905.18 -84619.52 -96875.01 -83786.73 -69136.60
Std.Dev.Daily.PL      134.58    178.50    201.37    157.55    158.11
Percent.Positive       54.84     54.67     55.52     55.56     55.67
Percent.Negative       45.16     45.33     44.48     44.44     44.33
Profit.Factor           1.15      1.15      1.15      1.15      1.16
Avg.Win.Day            97.93    126.00    142.19    116.36    115.29
Med.Win.Day            79.54     95.29    109.27     93.87     91.68
Avg.Losing.Day       -103.69   -132.01   -154.26   -126.38   -124.57
Med.Losing.Day        -72.20    -84.37   -109.70    -93.87    -91.16
Avg.Daily.PL            6.88      9.04     10.34      8.49      8.96
Med.Daily.PL           13.62     14.90     21.27     20.66     19.16
Std.Dev.Daily.PL.1    134.58    178.50    201.37    157.55    158.11
Ann.Sharpe              0.81      0.80      0.82      0.86      0.90
Max.Drawdown        -2804.25  -3977.43  -4487.98  -4446.67  -3101.41
Profit.To.Max.Draw      3.24      3.21      3.25      2.85      3.62
Avg.WinLoss.Ratio       0.94      0.95      0.92      0.92      0.93
Med.WinLoss.Ratio       1.10      1.13      1.00      1.00      1.01
Max.Equity          10373.87  14886.32  16959.46  12828.77  12321.51
Min.Equity           -165.27   -186.62   -399.56   -272.20    -16.66
End.Equity           9095.11  12779.16  14602.67  12673.96  11222.15

                          EWH       EWJ        EWS       EWT
Total.Net.Profit     15840.82   5176.40   18882.47   3321.05
Total.Days            1447.00   1100.00    1510.00   1250.00
Winning.Days           762.00    578.00     835.00    639.00
Losing.Days            685.00    522.00     675.00    611.00
Avg.Day.PL              10.95      4.71      12.50      2.66
Med.Day.PL              13.07     14.51      26.15      8.46
Largest.Winner        1319.35    559.95    1304.43   1170.33
Largest.Loser        -1338.75   -846.93   -1618.16  -1445.34
Gross.Profits       123714.47  65127.12  133821.56  93059.51
Gross.Losses       -107873.66 -59950.72 -114939.08 -89738.46
Std.Dev.Daily.PL       235.97    147.88     241.58    198.13
Percent.Positive        52.66     52.55      55.30     51.12
Percent.Negative        47.34     47.45      44.70     48.88
Profit.Factor            1.15      1.09       1.16      1.04
Avg.Win.Day            162.35    112.68     160.27    145.63
Med.Win.Day            111.04     94.31     112.39    114.48
Avg.Losing.Day        -157.48   -114.85    -170.28   -146.87
Med.Losing.Day        -101.79    -85.77    -113.32   -109.38
Avg.Daily.PL            10.95      4.71      12.50      2.66
Med.Daily.PL            13.07     14.51      26.15      8.46
Std.Dev.Daily.PL.1     235.97    147.88     241.58    198.13
Ann.Sharpe               0.74      0.51       0.82      0.21
Max.Drawdown         -6279.36  -3186.71   -6357.43  -5074.58
Profit.To.Max.Draw       2.52      1.62       2.97      0.65
Avg.WinLoss.Ratio        1.03      0.98       0.94      0.99
Med.WinLoss.Ratio        1.09      1.10       0.99      1.05
Max.Equity           16555.02   6833.58   19063.41   3473.68
Min.Equity            -117.59   -396.06    -412.24  -1842.71
End.Equity           15840.82   5176.40   18882.47   3321.05

                         EWU        EWY        EWZ       EZU
Total.Net.Profit     8340.94   16345.10   29677.36   9371.42
Total.Days           1327.00    1329.00    1456.00   1282.00
Winning.Days          718.00     726.00     809.00    703.00
Losing.Days           609.00     603.00     647.00    579.00
Avg.Day.PL              6.29      12.30      20.38      7.31
Med.Day.PL             15.37      26.80      38.84     15.88
Largest.Winner        591.81     930.95    1552.63    653.02
Largest.Loser        -626.26    -921.64   -1664.19   -837.62
Gross.Profits       73312.40  131699.63  211601.85  78062.97
Gross.Losses       -64971.45 -115354.53 -181924.49 -68691.55
Std.Dev.Daily.PL      139.76     245.04     368.97    155.45
Percent.Positive       54.11      54.63      55.56     54.84
Percent.Negative       45.89      45.37      44.44     45.16
Profit.Factor           1.13       1.14       1.16      1.14
Avg.Win.Day           102.11     181.40     261.56    111.04
Med.Win.Day            80.81     149.33     208.05     84.24
Avg.Losing.Day       -106.69    -191.30    -281.18   -118.64
Med.Losing.Day        -74.99    -134.62    -203.45    -78.91
Avg.Daily.PL            6.29      12.30      20.38      7.31
Med.Daily.PL           15.37      26.80      38.84     15.88
Std.Dev.Daily.PL.1    139.76     245.04     368.97    155.45
Ann.Sharpe              0.71       0.80       0.88      0.75
Max.Drawdown        -2806.72   -4656.74   -8660.23  -3353.89
Profit.To.Max.Draw      2.97       3.51       3.43      2.79
Avg.WinLoss.Ratio       0.96       0.95       0.93      0.94
Med.WinLoss.Ratio       1.08       1.11       1.02      1.07
Max.Equity           9627.51   16548.01   31682.83  11221.49
Min.Equity           -253.67       0.00    -699.79   -119.44
End.Equity           8340.94   16345.10   29677.36   9371.42

                         IEF        IGE       IYR       IYZ       LQD
Total.Net.Profit      835.02   14116.64  12860.27   5906.68   2177.09
Total.Days           1300.00    1557.00   1358.00   1352.00   1353.00
Winning.Days          658.00     847.00    738.00    701.00    724.00
Losing.Days           642.00     710.00    620.00    651.00    629.00
Avg.Day.PL              0.64       9.07      9.47      4.37      1.61
Med.Day.PL              1.17      22.95     13.29      6.22      4.38
Largest.Winner        365.18     848.16   1014.33    478.75    200.55
Largest.Loser        -199.68   -1047.33   -840.63   -560.06   -260.62
Gross.Profits       24532.29  132479.70  90821.52  62514.78  23695.57
Gross.Losses       -23697.27 -118363.07 -77961.26 -56608.11 -21518.48
Std.Dev.Daily.PL       49.69     213.61    175.83    118.94     44.01
Percent.Positive       50.62      54.40     54.34     51.85     53.51
Percent.Negative       49.38      45.60     45.66     48.15     46.49
Profit.Factor           1.04       1.12      1.16      1.10      1.10
Avg.Win.Day            37.28     156.41    123.06     89.18     32.73
Med.Win.Day            28.82     124.52     88.98     69.57     26.67
Avg.Losing.Day        -36.91    -166.71   -125.74    -86.96    -34.21
Med.Losing.Day        -28.18    -125.16    -84.29    -62.95    -26.77
Avg.Daily.PL            0.64       9.07      9.47      4.37      1.61
Med.Daily.PL            1.17      22.95     13.29      6.22      4.38
Std.Dev.Daily.PL.1     49.69     213.61    175.83    118.94     44.01
Ann.Sharpe              0.21       0.67      0.85      0.58      0.58
Max.Drawdown        -1345.79   -4492.64  -4545.72  -3655.24  -1126.20
Profit.To.Max.Draw      0.62       3.14      2.83      1.62      1.93
Avg.WinLoss.Ratio       1.01       0.94      0.98      1.03      0.96
Med.WinLoss.Ratio       1.02       0.99      1.06      1.11      1.00
Max.Equity           1756.16   14420.81  13193.50   5906.68   2600.28
Min.Equity           -714.17    -360.99      0.00  -1458.57   -750.84
End.Equity            835.02   14116.64  12860.27   5906.68   2177.09

                         RWR      SHY       TLT       XLB        XLE
Total.Net.Profit    15725.34  2126.96  -1042.28   8143.08   16350.23
Total.Days           1373.00  1617.00   1152.00   1324.00    1551.00
Winning.Days          744.00   904.00    569.00    720.00     852.00
Losing.Days           629.00   713.00    583.00    604.00     699.00
Avg.Day.PL             11.45     1.32     -0.90      6.15      10.54
Med.Day.PL             14.97     1.31     -1.15     15.83      24.94
Largest.Winner       1126.73    57.15    532.71    715.64    1037.19
Largest.Loser        -976.30   -67.00   -377.39   -582.22   -1019.83
Gross.Profits      100846.82  8420.38  38752.96  84332.47  147238.93
Gross.Losses       -85121.48 -6293.43 -39795.24 -76189.40 -130888.71
Std.Dev.Daily.PL      193.61    12.14     92.65    159.83     242.37
Percent.Positive       54.19    55.91     49.39     54.38      54.93
Percent.Negative       45.81    44.09     50.61     45.62      45.07
Profit.Factor           1.18     1.34      0.97      1.11       1.12
Avg.Win.Day           135.55     9.31     68.11    117.13     172.82
Med.Win.Day            95.73     7.26     50.05     99.01     132.61
Avg.Losing.Day       -135.33    -8.83    -68.26   -126.14    -187.25
Med.Losing.Day        -91.57    -6.86    -50.02    -90.01    -132.46
Avg.Daily.PL           11.45     1.32     -0.90      6.15      10.54
Med.Daily.PL           14.97     1.31     -1.15     15.83      24.94
Std.Dev.Daily.PL.1    193.61    12.14     92.65    159.83     242.37
Ann.Sharpe              0.94     1.72     -0.16      0.61       0.69
Max.Drawdown        -4720.58  -258.24  -3334.35  -2518.13   -4156.71
Profit.To.Max.Draw      3.33     8.24     -0.31      3.23       3.93
Avg.WinLoss.Ratio       1.00     1.06      1.00      0.93       0.92
Med.WinLoss.Ratio       1.05     1.06      1.00      1.10       1.00
Max.Equity          16148.05  2169.34   1995.24   9004.95   17110.53
Min.Equity              0.00   -62.71  -1736.55   -116.14    -468.28
End.Equity          15725.34  2126.96  -1042.28   8143.08   16350.23

                         XLF       XLI       XLK       XLP       XLU
Total.Net.Profit     6938.82   8270.94   3773.49   5237.29   7443.30
Total.Days           1168.00   1320.00   1227.00   1429.00   1459.00
Winning.Days          623.00    722.00    670.00    780.00    805.00
Losing.Days           545.00    598.00    557.00    649.00    654.00
Avg.Day.PL              5.94      6.27      3.08      3.67      5.10
Med.Day.PL             10.20     11.53     13.24      8.69     13.99
Largest.Winner        584.93    747.16    691.12    415.09    393.51
Largest.Loser        -650.83   -608.16   -526.35   -566.03   -475.47
Gross.Profits       57073.77  64421.38  60132.26  46969.42  62856.16
Gross.Losses       -50134.96 -56150.44 -56358.77 -41732.13 -55412.87
Std.Dev.Daily.PL      129.53    123.59    127.43     83.31    108.03
Percent.Positive       53.34     54.70     54.60     54.58     55.17
Percent.Negative       46.66     45.30     45.40     45.42     44.83
Profit.Factor           1.14      1.15      1.07      1.13      1.13
Avg.Win.Day            91.61     89.23     89.75     60.22     78.08
Med.Win.Day            64.79     72.02     65.43     47.42     63.25
Avg.Losing.Day        -91.99    -93.90   -101.18    -64.30    -84.73
Med.Losing.Day        -59.41    -67.06    -71.16    -47.83    -59.11
Avg.Daily.PL            5.94      6.27      3.08      3.67      5.10
Med.Daily.PL           10.20     11.53     13.24      8.69     13.99
Std.Dev.Daily.PL.1    129.53    123.59    127.43     83.31    108.03
Ann.Sharpe              0.73      0.80      0.38      0.70      0.75
Max.Drawdown        -2212.82  -2700.70  -3680.30  -2095.40  -3243.95
Profit.To.Max.Draw      3.14      3.06      1.03      2.50      2.29
Avg.WinLoss.Ratio       1.00      0.95      0.89      0.94      0.92
Med.WinLoss.Ratio       1.09      1.07      0.92      0.99      1.07
Max.Equity           7130.66   9488.70   4245.23   5269.06  10132.95
Min.Equity           -106.64   -134.79   -776.77   -244.67   -772.21
End.Equity           6938.82   8270.94   3773.49   5237.29   7443.30

                         XLV       XLY
Total.Net.Profit    -2400.55   2813.65
Total.Days           1114.00   1123.00
Winning.Days          560.00    588.00
Losing.Days           554.00    535.00
Avg.Day.PL             -2.15      2.51
Med.Day.PL              3.02      8.24
Largest.Winner        883.88    693.65
Largest.Loser        -820.10   -524.37
Gross.Profits       35341.85  50246.96
Gross.Losses       -37742.40 -47433.31
Std.Dev.Daily.PL       93.29    119.81
Percent.Positive       50.27     52.36
Percent.Negative       49.73     47.64
Profit.Factor           0.94      1.06
Avg.Win.Day            63.11     85.45
Med.Win.Day            51.38     63.20
Avg.Losing.Day        -68.13    -88.66
Med.Losing.Day        -49.88    -65.09
Avg.Daily.PL           -2.15      2.51
Med.Daily.PL            3.02      8.24
Std.Dev.Daily.PL.1     93.29    119.81
Ann.Sharpe             -0.37      0.33
Max.Drawdown        -3650.41  -3721.65
Profit.To.Max.Draw     -0.66      0.76
Avg.WinLoss.Ratio       0.93      0.96
Med.WinLoss.Ratio       1.03      0.97
Max.Equity            318.90   4439.62
Min.Equity          -3331.51  -1497.63
End.Equity          -2400.55   2813.65

Once again, portfolio comparisons:

Portfolio period 100 delta 0

Basically, this variant seemingly maximizes market exposure. Here are the three relevant statistics:

> SharpeRatio.annualized(portfRets)
                                     [,1]
Annualized Sharpe Ratio (Rf=0%) 0.7911671
> Return.annualized(portfRets)
                       [,1]
Annualized Return 0.1111565
> maxDrawdown(portfRets)
[1] 0.2038124

And finally, an equity curve demonstrating the indicator at its reasonable limit (that is, zero–at the other end of the spectrum, when I used a delta of .4, there was only one trade on one of the instruments, and it was a bad trade, so that’s definitely not an interesting case).

XLB EC Period 100 Delta 0

As you can see, as the delta parameter becomes smaller and smaller, the sensitivity to a trend increases. At the limit, it essentially becomes akin to an either-or classifier. So basically, for those with the statistics backgrounds (and if you’ve understood everything thus far, you have one), then the confusion matrix becomes “go long in a trend”, “go long without a trend”, “don’t go long but miss a trend”, “stay out of the market in which there’s no trend”, and this variant essentially leans towards the idea of “I have a slight hunch there’s a trend. Oh well. That’s enough! Time to buy!” And so long as so much as even a hunch persists, the strategy will stay long.

Interestingly enough, as judging by the percentage correct and the trade statistics, the ability of the Trend Vigor indicator to correctly predict seems to be served by the statistics. That, or it could just be that in quite a few seemingly separate cases, I got lucky with my parameters (always a possibility).

One *last* variant to look at, with this evidence in hand, is whether the Trend Vigor, with its tendency to buy (or not buy) at a whim, yet getting these correct, is whether or not it would work on a shorter time-frame.

Let’s set the period from 100 to, say, 20. That is, a period of 20, and a delta of 0.

As you may guess, this changes the characteristics of the strategy in terms of what trade statistics considerably. It sacrifices the win-over-the-long-haul philosophy in favor of a style more akin to spray-and-pray, rat-ta-tat-tat, or twitch trading.

Here are the trade stats:

                        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     10328.66 11706.48 14951.72 10930.59 11660.57
Avg.Trade.PL         322.77   365.83   515.58   321.49   388.69
Med.Trade.PL         105.46   118.05   228.71     1.33   -12.68
Largest.Winner      2279.85  2396.63  3471.56  2690.74  2758.24
Largest.Loser      -1263.24  -988.61  -924.28  -983.47 -1871.14
Gross.Profits      14668.25 15556.53 19711.78 17893.46 17887.77
Gross.Losses       -4339.59 -3850.04 -4760.05 -6962.87 -6227.20
Std.Dev.Trade.PL     777.48   845.22  1144.47   958.73  1098.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          3.38     4.04     4.14     2.57     2.87
Avg.Win.Trade        698.49   818.76  1159.52  1052.56  1375.98
Med.Win.Trade        537.00   477.74   406.41  1147.88  1344.79
Avg.Losing.Trade    -394.51  -296.16  -396.67  -409.58  -366.31
Med.Losing.Trade    -344.54  -156.95  -443.07  -348.37  -298.35
Avg.Daily.PL         328.05   372.03   521.65   289.41   403.80
Med.Daily.PL         101.91   110.59   226.95   -41.34   -11.20
Std.Dev.Daily.PL     789.75   858.45  1165.00   954.88  1114.71
Ann.Sharpe             6.59     6.88     7.11     4.81     5.75
Max.Drawdown       -3211.45 -2427.49 -2405.94 -3523.79 -4453.04
Profit.To.Max.Draw     3.22     4.82     6.21     3.10     2.62
Avg.WinLoss.Ratio      1.77     2.76     2.92     2.57     3.76
Med.WinLoss.Ratio      1.56     3.04     0.92     3.29     4.51
Max.Equity         10842.33 13002.93 16586.93 12975.13 12865.77
Min.Equity           -16.31  -109.20     0.00  -403.80  -163.53
End.Equity         10328.66 11706.48 14951.72 10930.59 11660.57

                        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     12897.27  4660.14 14727.03  7944.62  7348.04
Avg.Trade.PL         444.73   137.06   545.45   256.28   272.15
Med.Trade.PL         181.76   -25.35   448.00   -65.56    73.74
Largest.Winner      3627.23  1400.58  3929.35  2827.61  2861.20
Largest.Loser       -985.69  -785.43  -959.90 -1435.07 -1208.44
Gross.Profits      16866.14  9250.53 18536.96 15689.70 12192.51
Gross.Losses       -3968.87 -4590.39 -3809.93 -7745.07 -4844.48
Std.Dev.Trade.PL    1017.17   550.76  1137.96  1044.37   915.22
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.25     2.02     4.87     2.03     2.52
Avg.Win.Trade        843.31   578.16   975.63  1045.98   762.03
Med.Win.Trade        492.64   405.30   531.92   707.58   373.84
Avg.Losing.Trade    -440.99  -255.02  -476.24  -484.07  -440.41
Med.Losing.Trade    -498.05  -188.85  -566.37  -367.15  -355.87
Avg.Daily.PL         462.31   104.67   560.53   191.39   279.48
Med.Daily.PL         186.54   -28.59   459.00   -70.68    50.79
Std.Dev.Daily.PL    1031.33   525.38  1157.74   996.64   932.54
Ann.Sharpe             7.12     3.16     7.69     3.05     4.76
Max.Drawdown       -3217.65 -4387.88 -3405.18 -4227.76 -2937.97
Profit.To.Max.Draw     4.01     1.06     4.32     1.88     2.50
Avg.WinLoss.Ratio      1.91     2.27     2.05     2.16     1.73
Med.WinLoss.Ratio      0.99     2.15     0.94     1.93     1.05
Max.Equity         13521.46  6000.56 15436.93  9038.22  8680.76
Min.Equity           -42.01  -224.21 -1025.47 -1277.92  -464.92
End.Equity         12897.27  4660.14 14727.03  7944.62  7348.04

                        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     12546.44 24852.10 11517.70 4753.61  9332.27
Avg.Trade.PL         392.08   753.09   397.16  153.34   274.48
Med.Trade.PL          65.75   462.80    62.94   97.07    25.89
Largest.Winner      3227.55  4129.19  2673.10  938.96  1874.11
Largest.Loser      -1138.25 -1397.89 -1504.99 -349.00  -939.08
Gross.Profits      19138.92 32892.49 16773.02 5715.50 14964.70
Gross.Losses       -6592.48 -8040.39 -5255.32 -961.89 -5632.43
Std.Dev.Trade.PL    1139.40  1521.21  1012.85  273.84   787.90
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          2.90     4.09     3.19    5.94     2.66
Avg.Win.Trade       1125.82  1731.18  1048.31  259.80   831.37
Med.Win.Trade        665.93  1333.10   835.84  190.61   821.62
Avg.Losing.Trade    -439.50  -574.31  -404.26 -106.88  -352.03
Med.Losing.Trade    -303.33  -562.67  -296.63  -80.24  -264.51
Avg.Daily.PL         388.31   762.17   408.36  153.34   206.26
Med.Daily.PL          13.15   470.00    62.27   97.07    24.11
Std.Dev.Daily.PL    1158.03  1544.64  1029.61  273.84   690.66
Ann.Sharpe             5.32     7.83     6.30    8.89     4.74
Max.Drawdown       -4645.24 -3257.05 -3413.71 -578.24 -2724.91
Profit.To.Max.Draw     2.70     7.63     3.37    8.22     3.42
Avg.WinLoss.Ratio      2.56     3.01     2.59    2.43     2.36
Med.WinLoss.Ratio      2.20     2.37     2.82    2.38     3.11
Max.Equity         12546.44 26158.50 13292.18 4906.20  9504.76
Min.Equity          -682.05     0.00     0.00  -33.44  -422.88
End.Equity         12546.44 24852.10 11517.70 4753.61  9332.27

                        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     11784.87  3862.91  5120.54 12724.61 2122.23
Avg.Trade.PL         406.37   113.62   170.68   438.78   84.89
Med.Trade.PL         185.62   -57.11    39.73   125.87   16.55
Largest.Winner      3974.51  1380.22  1515.52  3092.87  808.92
Largest.Loser       -785.87 -1172.77  -737.21  -849.73  -70.04
Gross.Profits      16606.09 10171.73  6591.01 17523.83 2332.06
Gross.Losses       -4821.22 -6308.82 -1470.47 -4799.22 -209.83
Std.Dev.Trade.PL    1145.72   616.42   417.69  1022.20  183.23
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          3.44     1.61     4.48     3.65   11.11
Avg.Win.Trade        922.56   678.12   329.55  1095.24  145.75
Med.Win.Trade        297.43   652.59   134.84   906.46   75.00
Avg.Losing.Trade    -438.29  -332.04  -147.05  -369.17  -23.31
Med.Losing.Trade    -349.87  -275.45   -82.17  -355.79  -21.51
Avg.Daily.PL         410.73    81.37   170.68   443.64   84.89
Med.Daily.PL         171.77   -57.61    39.73   106.12   16.55
Std.Dev.Daily.PL    1166.50   596.14   417.69  1040.62  183.23
Ann.Sharpe             5.59     2.17     6.49     6.77    7.35
Max.Drawdown       -3274.47 -3375.87 -1372.68 -2818.87 -155.30
Profit.To.Max.Draw     3.60     1.14     3.73     4.51   13.67
Avg.WinLoss.Ratio      2.10     2.04     2.24     2.97    6.25
Med.WinLoss.Ratio      0.85     2.37     1.64     2.55    3.49
Max.Equity         14392.21  5329.35  5186.13 14807.38 2164.16
Min.Equity          -279.58  -317.86   -49.93  -157.88   -4.04
End.Equity         11784.87  3862.91  5120.54 12724.61 2122.23

                        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      3413.99  5977.21  6441.87  5609.93  8660.57
Avg.Trade.PL         103.45   170.78   169.52   165.00   279.37
Med.Trade.PL          -3.63   -83.75    -9.57   -51.46   153.63
Largest.Winner      1565.81  1617.61  1866.44  2722.10  1877.40
Largest.Loser       -557.57  -609.79 -1481.92 -1198.56  -665.85
Gross.Profits       7060.83 12273.84 14304.04 11466.12 12686.72
Gross.Losses       -3646.84 -6296.63 -7862.18 -5856.19 -4026.15
Std.Dev.Trade.PL     460.12   672.56   815.91   776.04   679.43
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          1.94     1.95     1.82     1.96     3.15
Avg.Win.Trade        441.30   767.11   794.67   716.63   746.28
Med.Win.Trade        334.21   774.71   567.38   389.75   531.89
Avg.Losing.Trade    -214.52  -331.40  -393.11  -325.34  -287.58
Med.Losing.Trade    -251.27  -334.69  -362.33  -215.27  -286.47
Avg.Daily.PL         103.45   119.78   103.25   166.56   237.50
Med.Daily.PL          -3.63   -96.78   -14.83   -59.69   130.21
Std.Dev.Daily.PL     460.12   610.13   716.01   788.01   649.09
Ann.Sharpe             3.57     3.12     2.29     3.36     5.81
Max.Drawdown       -2817.81 -2503.48 -4987.44 -4930.20 -1956.37
Profit.To.Max.Draw     1.21     2.39     1.29     1.14     4.43
Avg.WinLoss.Ratio      2.06     2.31     2.02     2.20     2.60
Med.WinLoss.Ratio      1.33     2.31     1.57     1.81     1.86
Max.Equity          5371.15  6455.14  8728.55  7579.35  8667.19
Min.Equity          -158.45  -490.54  -246.66  -531.75  -420.93
End.Equity          3413.99  5977.21  6441.87  5609.93  8660.57

                        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      4961.98  4662.87 10652.74  2240.98 10791.01
Avg.Trade.PL         150.36   126.02   380.45    62.25   359.70
Med.Trade.PL          27.70    -3.74   239.19    20.12    47.17
Largest.Winner      1665.69  1210.01  2127.10  1071.64  2201.18
Largest.Loser       -848.60  -375.31 -1027.85 -1019.87  -526.48
Gross.Profits      10911.42  7698.10 13356.14  6743.69 14198.58
Gross.Losses       -5949.44 -3035.22 -2703.40 -4502.72 -3407.57
Std.Dev.Trade.PL     644.75   385.79   697.17   424.35   812.76
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.83     2.54     4.94     1.50     4.17
Avg.Win.Trade        641.85   452.83   636.01   337.18   887.41
Med.Win.Trade        596.95   439.53   567.87   268.84   769.48
Avg.Losing.Trade    -371.84  -151.76  -386.20  -281.42  -243.40
Med.Losing.Trade    -332.32  -132.19  -351.24  -198.33  -201.01
Avg.Daily.PL         153.44   126.43   392.89    63.18   318.03
Med.Daily.PL          -4.08    -3.95   244.66    15.94    16.97
Std.Dev.Daily.PL     654.82   391.25   707.28   430.50   793.86
Ann.Sharpe             3.72     5.13     8.82     2.33     6.36
Max.Drawdown       -3122.38 -1207.25 -1975.52 -1692.71 -2096.56
Profit.To.Max.Draw     1.59     3.86     5.39     1.32     5.15
Avg.WinLoss.Ratio      1.73     2.98     1.65     1.20     3.65
Med.WinLoss.Ratio      1.80     3.33     1.62     1.36     3.83
Max.Equity          5806.42  4786.14 10838.46  3229.36 10908.43
Min.Equity          -744.34  -230.94     0.00   -26.15  -187.64
End.Equity          4961.98  4662.87 10652.74  2240.98 10791.01

Some aggregate trade stats (that I implemented as I was writing this post, so forgive the fact that they weren’t in previous outputs):

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

In other words, over nearly a thousand relatively short-term momentum trades (can you say “whipsaw”?), the strategy still gets it right more than half the time, and the trades it *does* get right, on average, it gets them right by a ratio of 2.5 to 1. Of course, this backtest doesn’t take transaction costs into account, and when dealing with these shorter-term strategies, if you’re a retail investor out to try and rub two pennies together and you’re getting taken for a ride on the order of $10 per buy or sell order from ETrade, you’ll have to look at the average trade P&L. (Also, if you’re a retail investor, your bigger obstacle would be the $3,000,000 to be able to even trade something like this.)

Again, the daily statistics:

                         EFA       EPP       EWA       EWC       EWG
Total.Net.Profit    10328.66  11706.48  14951.72  10930.59  11660.57
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              7.85      8.85     11.47      8.43      9.10
Med.Day.PL             10.61     12.80     17.88     19.87     19.80
Largest.Winner        496.25    718.51    694.25    563.65    582.80
Largest.Loser        -479.06   -702.36   -817.83   -738.35   -582.80
Gross.Profits       62165.44  75323.28  85846.23  74892.07  77119.80
Gross.Losses       -51836.78 -63616.80 -70894.51 -63961.48 -65459.22
Std.Dev.Daily.PL      116.04    145.52    164.08    144.76    147.76
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.20      1.18      1.21      1.17      1.18
Avg.Win.Day            87.19    104.33    117.60    102.73    107.26
Med.Win.Day            69.61     82.93     96.06     83.06     87.10
Avg.Losing.Day        -85.96   -105.85   -123.73   -112.61   -116.48
Med.Losing.Day        -64.01    -70.20    -88.59    -77.41    -80.38
Avg.Daily.PL            7.85      8.85     11.47      8.43      9.10
Med.Daily.PL           10.61     12.80     17.88     19.87     19.80
Std.Dev.Daily.PL.1    116.04    145.52    164.08    144.76    147.76
Ann.Sharpe              1.07      0.97      1.11      0.92      0.98
Max.Drawdown        -3211.45  -2427.49  -2405.94  -3523.79  -4453.04
Profit.To.Max.Draw      3.22      4.82      6.21      3.10      2.62
Avg.WinLoss.Ratio       1.01      0.99      0.95      0.91      0.92
Med.WinLoss.Ratio       1.09      1.18      1.08      1.07      1.08
Max.Equity          10842.33  13002.93  16586.93  12975.13  12865.77
Min.Equity            -16.31   -109.20      0.00   -403.80   -163.53
End.Equity          10328.66  11706.48  14951.72  10930.59  11660.57

                         EWH       EWJ       EWS       EWT       EWU
Total.Net.Profit    12897.27   4660.14  14727.03   7944.62   7348.04
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             10.35      4.21     11.31      6.77      5.88
Med.Day.PL             14.00      9.37     22.80      8.93     12.28
Largest.Winner        780.02    553.05   1036.49   1451.05    536.21
Largest.Loser        -927.10   -562.11  -1149.10  -1250.21   -573.84
Gross.Profits       79332.19  58476.51  86625.31  84432.94  64333.36
Gross.Losses       -66434.93 -53816.37 -71898.28 -76488.32 -56985.33
Std.Dev.Daily.PL      160.07    132.14    166.55    190.61    131.32
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.09      1.20      1.10      1.13
Avg.Win.Day           118.94    102.95    119.32    138.87     96.02
Med.Win.Day            90.55     81.48     91.21    106.86     72.21
Avg.Losing.Day       -114.74    -99.66   -124.82   -135.38    -98.25
Med.Losing.Day        -82.06    -78.95    -93.30    -98.23    -69.18
Avg.Daily.PL           10.35      4.21     11.31      6.77      5.88
Med.Daily.PL           14.00      9.37     22.80      8.93     12.28
Std.Dev.Daily.PL.1    160.07    132.14    166.55    190.61    131.32
Ann.Sharpe              1.03      0.51      1.08      0.56      0.71
Max.Drawdown        -3217.65  -4387.88  -3405.18  -4227.76  -2937.97
Profit.To.Max.Draw      4.01      1.06      4.32      1.88      2.50
Avg.WinLoss.Ratio       1.04      1.03      0.96      1.03      0.98
Med.WinLoss.Ratio       1.10      1.03      0.98      1.09      1.04
Max.Equity          13521.46   6000.56  15436.93   9038.22   8680.76
Min.Equity            -42.01   -224.21  -1025.47  -1277.92   -464.92
End.Equity          12897.27   4660.14  14727.03   7944.62   7348.04

                         EWY        EWZ       EZU       IEF       IGE
Total.Net.Profit    12546.44   24852.10  11517.70   4753.61   9332.27
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             10.08      18.17      8.94      3.90      7.25
Med.Day.PL             21.94      37.02     16.02      3.66     18.41
Largest.Winner        738.74    1037.10    599.94    341.03    559.04
Largest.Loser        -808.23   -1146.86   -609.07   -193.92   -623.74
Gross.Profits       97414.83  136096.17  71253.39  24136.54  81842.78
Gross.Losses       -84868.38 -111244.08 -59735.69 -19382.93 -72510.51
Std.Dev.Daily.PL      195.32     238.67    138.16     47.45    157.77
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.15       1.22      1.19      1.25      1.13
Avg.Win.Day           141.80     176.75    101.50     37.31    115.27
Med.Win.Day           110.49     141.00     79.01     29.85     94.60
Avg.Losing.Day       -152.09    -186.03   -101.94    -33.83   -125.45
Med.Losing.Day       -109.42    -134.77    -70.49    -26.24    -95.78
Avg.Daily.PL           10.08      18.17      8.94      3.90      7.25
Med.Daily.PL           21.94      37.02     16.02      3.66     18.41
Std.Dev.Daily.PL.1    195.32     238.67    138.16     47.45    157.77
Ann.Sharpe              0.82       1.21      1.03      1.30      0.73
Max.Drawdown        -4645.24   -3257.05  -3413.71   -578.24  -2724.91
Profit.To.Max.Draw      2.70       7.63      3.37      8.22      3.42
Avg.WinLoss.Ratio       0.93       0.95      1.00      1.10      0.92
Med.WinLoss.Ratio       1.01       1.05      1.12      1.14      0.99
Max.Equity          12546.44   26158.50  13292.18   4906.20   9504.76
Min.Equity           -682.05       0.00      0.00    -33.44   -422.88
End.Equity          12546.44   24852.10  11517.70   4753.61   9332.27

                         IYR       IYZ       LQD       RWR      SHY
Total.Net.Profit    11784.87   3862.91   5120.54  12724.61  2122.23
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              8.98      3.18      3.97      9.61     1.51
Med.Day.PL             13.12      8.69      4.71      9.40     2.15
Largest.Winner       1266.62    499.01    267.59   1410.02    71.37
Largest.Loser       -1344.56   -517.73   -623.17  -1305.30   -65.40
Gross.Profits       85524.01  52701.88  23905.68  89163.11  7220.54
Gross.Losses       -73739.14 -48838.97 -18785.14 -76438.50 -5098.31
Std.Dev.Daily.PL      187.62    114.92     47.09    196.38    11.86
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.16      1.08      1.27      1.17     1.42
Avg.Win.Day           120.29     82.22     33.20    125.05     9.07
Med.Win.Day            83.38     57.42     25.92     83.55     6.47
Avg.Losing.Day       -122.69    -85.38    -32.96   -125.10    -8.40
Med.Losing.Day        -75.71    -60.20    -23.53    -77.73    -6.33
Avg.Daily.PL            8.98      3.18      3.97      9.61     1.51
Med.Daily.PL           13.12      8.69      4.71      9.40     2.15
Std.Dev.Daily.PL.1    187.62    114.92     47.09    196.38    11.86
Ann.Sharpe              0.76      0.44      1.34      0.78     2.02
Max.Drawdown        -3274.47  -3375.87  -1372.68  -2818.87  -155.30
Profit.To.Max.Draw      3.60      1.14      3.73      4.51    13.67
Avg.WinLoss.Ratio       0.98      0.96      1.01      1.00     1.08
Med.WinLoss.Ratio       1.10      0.95      1.10      1.07     1.02
Max.Equity          14392.21   5329.35   5186.13  14807.38  2164.16
Min.Equity           -279.58   -317.86    -49.93   -157.88    -4.04
End.Equity          11784.87   3862.91   5120.54  12724.61  2122.23

                         TLT       XLB       XLE       XLF       XLI
Total.Net.Profit     3413.99   5977.21   6441.87   5609.93   8660.57
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              2.90      4.74      4.93      4.87      6.74
Med.Day.PL              5.66     11.89     12.61      8.42     10.49
Largest.Winner        528.00    669.10    951.16   1615.41    609.93
Largest.Loser        -331.64   -696.80  -1194.78  -1400.78   -478.61
Gross.Profits       37930.87  69474.84  85294.45  66345.27  57592.48
Gross.Losses       -34516.87 -63497.63 -78852.59 -60735.35 -48931.91
Std.Dev.Daily.PL       84.71    141.74    170.38    182.33    116.56
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.10      1.09      1.08      1.09      1.18
Avg.Win.Day            61.88    102.17    121.50    109.30     81.00
Med.Win.Day            46.15     84.21     97.96     67.92     59.72
Avg.Losing.Day        -61.20   -109.10   -130.55   -111.24    -85.25
Med.Losing.Day        -43.92    -78.65   -101.67    -64.90    -59.16
Avg.Daily.PL            2.90      4.74      4.93      4.87      6.74
Med.Daily.PL            5.66     11.89     12.61      8.42     10.49
Std.Dev.Daily.PL.1     84.71    141.74    170.38    182.33    116.56
Ann.Sharpe              0.54      0.53      0.46      0.42      0.92
Max.Drawdown        -2817.81  -2503.48  -4987.44  -4930.20  -1956.37
Profit.To.Max.Draw      1.21      2.39      1.29      1.14      4.43
Avg.WinLoss.Ratio       1.01      0.94      0.93      0.98      0.95
Med.WinLoss.Ratio       1.05      1.07      0.96      1.05      1.01
Max.Equity           5371.15   6455.14   8728.55   7579.35   8667.19
Min.Equity           -158.45   -490.54   -246.66   -531.75   -420.93
End.Equity           3413.99   5977.21   6441.87   5609.93   8660.57

                         XLK       XLP       XLU       XLV       XLY
Total.Net.Profit     4961.98   4662.87  10652.74   2240.98  10791.01
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              4.08      3.63      7.67      1.90      8.74
Med.Day.PL             15.35      8.51     13.15      3.87      9.07
Largest.Winner        443.80    642.73    945.06    339.99   1098.25
Largest.Loser        -440.72   -380.30   -721.42   -479.49   -477.11
Gross.Profits       56694.07  38477.60  57865.62  39848.98  61218.76
Gross.Losses       -51732.09 -33814.73 -47212.88 -37608.01 -50427.75
Std.Dev.Daily.PL      119.48     74.90    104.74     87.22    130.20
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.10      1.14      1.23      1.06      1.21
Avg.Win.Day            84.12     54.58     75.15     64.59     93.75
Med.Win.Day            62.97     42.12     61.26     51.22     67.20
Avg.Losing.Day        -95.45    -58.40    -76.40    -67.04    -86.79
Med.Losing.Day        -65.34    -45.63    -53.32    -49.44    -59.22
Avg.Daily.PL            4.08      3.63      7.67      1.90      8.74
Med.Daily.PL           15.35      8.51     13.15      3.87      9.07
Std.Dev.Daily.PL.1    119.48     74.90    104.74     87.22    130.20
Ann.Sharpe              0.54      0.77      1.16      0.35      1.07
Max.Drawdown        -3122.38  -1207.25  -1975.52  -1692.71  -2096.56
Profit.To.Max.Draw      1.59      3.86      5.39      1.32      5.15
Avg.WinLoss.Ratio       0.88      0.93      0.98      0.96      1.08
Med.WinLoss.Ratio       0.96      0.92      1.15      1.04      1.13
Max.Equity           5806.42   4786.14  10838.46   3229.36  10908.43
Min.Equity           -744.34   -230.94      0.00    -26.15   -187.64
End.Equity           4961.98   4662.87  10652.74   2240.98  10791.01

A lot of the cash Sharpe ratios (now in the *daily* statistics, not the trade statistics) are nearing 1. Not exactly spectacular, by any stretch of the imagination, when considering a short-term trading strategy before commissions/slippage, but definitely nothing to scoff at. Something I notice just by eyeballing the statistics is that there definitely seems to be an edge in the percentage of days positive. Of course, I won’t rule out the fact that all of this may simply be the fact that many of these securities are equity indices, and thus, may have a slightly inherent long bias in them.

Let’s move onto the portfolio equity curve.

Period 20 delta 0

Looking at this equity curve, the first thing to note is that it’s strikingly similar to the SPY equity curve up until the crisis, and the drawdowns happen at about the same exact times. Maybe this means that all of my global equity ETFs that I chose for the data were correlated because at the end of the day, aside from the few fixed income ETFs available before 2003, that they’re still separate slices of the equities asset class, or that my volatility (and returns?) are mainly driven by the 9 XL sectors. What’s also worth noting is that the strategy attempted to go “dumpster diving”, to put it kindly–that is, still try to find those positive-momentum trades in the depths of the financial crisis. While it certainly seemed to try, in this case, the best move would have been to do nothing at all. However, when the market rebounded, the strategy quickly made up its losses (and then some).

For the final time in this post, the three portfolio statistics:

> SharpeRatio.annualized(portfRets)
                                     [,1]
Annualized Sharpe Ratio (Rf=0%) 0.9692246
> Return.annualized(portfRets)
                       [,1]
Annualized Return 0.1113647
> maxDrawdown(portfRets)
[1] 0.1801516

In other words, an 11% return, at a maximum drawdown of 18%. I am of course, still not pleased with the last two numbers, since a maximum drawdown larger than the annualized return means that it’s quite possible to simply have a down year. However, the idea of an 18% drawdown while seemingly keeping pace with an S&P 500 (with a simplistic asset allocation and order-sizing strategy, no less) in its good years is nothing to scoff at. (In my last job, I was responsible for developing the analytics package in terms of portfolio management. Suffice to say that there are a lot more ways to slice up performance.)

Finally, just for fun, here’s the equity curve and the indicator of XLB for this two-parameter (three if you count trigger lag, and four if you count the threshold setting) configuration:

XLB EC P20 D0

In other words, for those that prefer the “lots and lots of little ones” to the “long-term trend-following” alternative, there you go.

Interesting to note, comparing the few portfolio equity curves I’ve shown in this post, overall, the performances look somewhat similar regardless of the philosophy–whether a very long-term trend-following approach, or a more short-term orientation. The difference shows up in the trade statistics, but as they say about roads leading to Rome…in my opinion, this probably counts as a vote for the robustness of the strategy.

Now, to conclude this exploration, here are some things I can take away from it:

By adjusting the period and delta parameters, it’s possible to take what was originally a market mode filter and:

A) keep it as a double-purpose trend follower and market mode indicator
B) turn it into a long-term trend indicator
C) turn it into a short(er) term momentum trader.

Paradoxically (at least according to the basic risk/reward blabber found in typical academic finance), it seems that by lowering delta and having a willingness to take on “more” risk in the form of greater market exposure, one actually achieves a better annualized Sharpe Ratio than with the default, more risk-averse, setting.

Next time, I’ll look at more intelligent risk-weighting schemes.

Thanks for reading.

A positive batting average trend follower? Introducing Trend Vigor.

Since this is the first post on this blog, a quick start up for those who may be reading this who don’t have my exact technical background: this blog will mostly use R, and backtesting will be done in the quantstrat package.

For those of you who follow me from a non-technical background, send me a message, and I’ll help you get started. For those simply not acquainted with the quantstrat package, this is the link to the definitive, comprehensive guide on quantstrat.

Click to access Humme+Peterson.pdf

To motivate this post, consider some common wisdom about both mean-reverting and trend-following strategies. Mean reverting strategies often sport a high percentage of positive trades, but the few negative trades can hammer the equity curve. On the other side of the equation, trend-following strategies run on a philosophy of “let your winners run and cut your losers”, resulting in many small losses and a few wins that make up for them. However, what if there were an indicator that behaved like the best of both worlds? That is, capitalize on trends, while cutting out a good portion of whipsaws?

The Trend Vigor Indicator, or TVI as I call it in my DSTrading package, available on my github (see my about page for the link), created by Dr. John Ehlers (whom I thank for providing the completed code), attempts to do just that. Here’s a link to the original presentation (code incomplete):

Click to access Trend%20Modes%20and%20Cycle%20Modes.pdf

As Dr. Ehlers says on the fifth slide, correctly identifying market mode means a great deal. Something I noticed is that the plot for the trend vigor index seems to be very smooth in general, so when the trend vigor rises, it generally doesn’t whipsaw around very much about any particular quantity (at least at the daily resolution), so there may be a strategy to take advantage of this possible property.

Here’s the corresponding function from the DSTrading package, which I will use in the following demo. There may also be a trend vigor calculation with one of Dr. Ehlers’s adaptive period computation algorithms built in. In any case, the way it works is this: it takes in a time series, and two parameters: a period, which is identical to the n parameter in indicators such as SMA and so on, and a delta, which is a trigonometric parameter to adjust the computation of the bandpass filter (I am not overly familiar with the rationale behind signal processing, so I’ll leave the commentary on the finer points of this parameter to someone more experienced in this field).

TVI then outputs a time series of a 0-centered trend vigor indicator, along with a pair of oscillators (signal and lead), which I may touch on in the future.

"TVI" <- function(x, period = 20, delta = 0.2, triggerLag = 1, ...) {
    if (period != 0) {
        # static, length-1 period
        beta <- cos(2 * pi/period)
        gamma <- 1/cos(4 * pi * delta/period)
        alpha <- gamma - sqrt(gamma * gamma - 1)
        BP <- 0.5 * (1 - alpha) * (x - lag(x, 2))
        BP[1] <- BP[2] <- 0
        BP <- filter(BP, c(beta * (1 + alpha), -1 * alpha), method = "recursive")
        BP <- xts(BP, order.by = index(x))
        signal <- BP - lag(BP, round(period/2))
        lead <- 1.4 * (BP - lag(BP, round(period/4)))

        BP2 <- BP * BP
        LBP2 <- lag(BP2, round(period/4))
        power <- runSum(BP2, period) + runSum(LBP2, period)
        RMS <- sqrt(power/period)
        PtoP <- 2 * sqrt(2) * RMS

        a1 <- exp(-sqrt(2) * pi/period)
        b1 <- 2 * a1 * cos(sqrt(2) * pi/period)
        coef2 <- b1
        coef3 <- -a1 * a1
        coef1 <- 1 - coef2 - coef3
        trend <- coef1 * (x - lag(x, period))
        trend[is.na(trend)] <- 0
        trend <- filter(trend, c(coef2, coef3), method = "recursive")
        trend <- xts(trend, order.by = index(x))
        vigor <- trend/PtoP
        vigor[vigor > 2] <- 2
        vigor[vigor < -2] <- -2
        trigger <- lag(vigor, triggerLag)
        out <- cbind(vigor, signal, lead, trigger)
        colnames(out) <- c("vigor", "signal", "lead", "trigger")
        return(out)
    } else {
        stop("Dynamic period computation not implemented yet.")
        # TODO -- DYNAMIC PERIOD TREND VIGOR
    }
}

So in order to test this indicator, I wrote a quantstrat demo to test its momentum properties. First, we will fetch the data, which consists of some ETFs that have been trading since before 2003. This is the data file I will source for this demo (called demoData.R), along with many others.

require(DSTrading)
require(quantstrat)
options(width=80)
source("demoData.R") #contains all of the data-related boilerplate.

Here are the exact contents of demoData.R

options("getSymbols.warning4.0"=FALSE)
rm(list=ls(.blotter), envir=.blotter)
initDate='1990-12-31'

currency('USD')
Sys.setenv(TZ="UTC")

symbols <- c("XLB", #SPDR Materials sector
             "XLE", #SPDR Energy sector
             "XLF", #SPDR Financial sector
             "XLP", #SPDR Consumer staples sector
             "XLI", #SPDR Industrial sector
             "XLU", #SPDR Utilities sector
             "XLV", #SPDR Healthcare sector
             "XLK", #SPDR Tech sector
             "XLY", #SPDR Consumer discretionary sector
             "RWR", #SPDR Dow Jones REIT ETF
             
             "EWJ", #iShares Japan
             "EWG", #iShares Germany
             "EWU", #iShares UK
             "EWC", #iShares Canada
             "EWY", #iShares South Korea
             "EWA", #iShares Australia
             "EWH", #iShares Hong Kong
             "EWS", #iShares Singapore
             "IYZ", #iShares U.S. Telecom
             "EZU", #iShares MSCI EMU ETF
             "IYR", #iShares U.S. Real Estate
             "EWT", #iShares Taiwan
             "EWZ", #iShares Brazil
             "EFA", #iShares EAFE
             "IGE", #iShares North American Natural Resources
             "EPP", #iShares Pacific Ex Japan
             "LQD", #iShares Investment Grade Corporate Bonds
             "SHY", #iShares 1-3 year TBonds
             "IEF", #iShares 3-7 year TBonds
             "TLT" #iShares 20+ year Bonds
)

#SPDR ETFs first, iShares ETFs afterwards
if(!"XLB" %in% ls()) { 
  suppressMessages(getSymbols(symbols, from="2003-01-01", to="2010-12-31", src="yahoo", adjust=TRUE))  
}

stock(symbols, currency="USD", multiplier=1)

The reason I’m using these symbols is fairly simple: they’re representative of a fairly broad aspect of both the U.S. economy and other developed economies abroad (E.G. Japan, Germany), and contain a fair amount of “staple” ETFs (SPDR sectors, EFA, internationals, etc.).

Let’s begin the demo. The strategy will be simple–the indicator will be the trend vigor calculation, and the strategy will go long on the next open when the trend vigor crosses above 1, sell the next open when it crosses below 1.4, and will stop out on the next open when the trend vigor crosses under 1 if it never crossed 1.4 within the duration of the position.

The general syntax of indicators, signals, and rules in quantstrat (for the uninitiated) is fairly straightforward:

add.indicator/add.signal/add.rule is a function which takes in the name of the strategy as the first argument (which I always use strategy.st for), a name of an R function in the name argument, the arguments to the function as the argument to arguments (that is, arguments=list(x=quote(Cl(mktdata)), period=100, delta=0.2) is the argument to the TVI function which is the value for the name argument in the add.indicator function), and finally, a label. While the labels may seem like so much window dressing, they are critical in terms of linking indicators to signals, signals to rules, and everything to any optimization/robustness testing you may deecide to do. Do not forget them.

While I kept Dr. Ehlers’s default period setting, I found that the strategy works best starting at 60 days for the period, and has a solid performance until the mid-hundreds, at which point it generates too few trades per instrument to really be able to look at any individual statistics.

Here’s the strategy.

#To rerun the strategy, re-run everything from this line down.

strategy.st <- portfolio.st <- account.st <- "TVItrendFollowingLong"
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')
initOrders(portfolio.st, initDate=initDate)
strategy(strategy.st, store=TRUE)

#indicator

add.indicator(strategy.st, name="TVI", arguments=list(x=quote(Cl(mktdata)), period=100, delta=0.2), label="TVI")

#signals

add.signal(strategy.st, name="sigThreshold", 
           arguments=list(threshold=1, column="vigor.TVI", relationship="gte", cross=TRUE),
           label="longEntry")

add.signal(strategy.st, name="sigThreshold",
           arguments=list(threshold=1.4, column="vigor.TVI", relationship="lt", cross=TRUE),
           label="longExit")

add.signal(strategy.st, name="sigThreshold",
           arguments=list(threshold=1, column="vigor.TVI", relationship="lt", cross=TRUE),
           label="wrongExit")

#rules

add.rule(strategy.st, name="ruleSignal", 
         arguments=list(sigcol="longEntry", sigval=TRUE, orderqty=100, 
                        ordertype="market", orderside="long", replace=FALSE, prefer="Open"), 
         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)

add.rule(strategy.st, name="ruleSignal", 
         arguments=list(sigcol="wrongExit", sigval=TRUE, orderqty="all", 
                        ordertype="market", orderside="long", replace=FALSE, prefer="Open"), 
         type="exit", path.dep=TRUE)

The strategy is then run with the applyStrategy call. I set verbose to FALSE for the purpose of not displaying the order log in this blog post, but by default, quantstrat will start printing out trades at this point. Printing out trades serves two purposes (in my experience): first off, you know your strategy is actually doing something, and secondly, even if it is, the attentive eye will also see if the strategy is not behaving intuitively (that is, is it loading up more lots when you thought it should only be trading 1 lot at a time? This happens often with strategies that crisscross above and below a threshold, such as with simple RSI strategies.)

#apply strategy

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

 #tradeStats

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

The last four lines are some more “accounting boilerplate” that are necessary for the following analytics.

Here are the trade statistics:

tStats <- tradeStats(Portfolios = portfolio.st, use = "trades", inclZeroDays = FALSE)
print(data.frame(t(tStats[, -c(1:2)])))

Here’s the output:

                          EFA      EPP      EWA       EWC      EWG      EWH
 Num.Txns              11.000   11.000   11.000   13.0000   11.000   15.000
 Num.Trades             6.000    6.000    6.000    7.0000    6.000    8.000
 Net.Trading.PL      2565.775 1969.314 1286.254  467.3296  814.737  606.872
 Avg.Trade.PL         427.629  328.219  214.376   66.7614  135.789   75.859
 Med.Trade.PL         406.141  187.906  133.158  134.4598   32.897   98.591
 Largest.Winner       848.301  907.877  599.901  349.9296  591.163  180.214
 Largest.Loser          0.000 -124.794  -95.424 -256.5205  -59.893  -95.641
 Gross.Profits       2565.775 2163.065 1393.249  992.6210  942.630  703.020
 Gross.Losses           0.000 -193.750 -106.995 -525.2914 -127.893  -96.148
 Std.Dev.Trade.PL     353.537  461.074  285.169  239.4493  257.994   92.620
 Percent.Positive     100.000   66.667   66.667   57.1429   66.667   75.000
 Percent.Negative       0.000   33.333   33.333   42.8571   33.333   25.000
 Profit.Factor            Inf   11.164   13.022    1.8897    7.370    7.312
 Avg.Win.Trade        427.629  540.766  348.312  248.1553  235.658  117.170
 Med.Win.Trade        406.141  584.662  330.518  254.1158  175.014  109.259
 Avg.Losing.Trade         NaN  -96.875  -53.498 -175.0971  -63.947  -48.074
 Med.Losing.Trade          NA  -96.875  -53.498 -143.9421  -63.947  -48.074
 Avg.Daily.PL         494.769  407.654  230.788   42.4390  176.547   86.768
 Med.Daily.PL         571.279  289.949  134.004    4.8155   64.354  105.539
 Std.Dev.Daily.PL     349.896  467.346  315.644  252.6538  265.974   94.326
 Ann.Sharpe            22.447   13.847   11.607    2.6665   10.537   14.603
 Max.Drawdown       -1035.238 -817.160 -519.809 -765.6489 -442.170 -529.427
 Profit.To.Max.Draw     2.478    2.410    2.474    0.6104    1.843    1.146
 Avg.WinLoss.Ratio        NaN    5.582    6.511    1.4172    3.685    2.437
 Med.WinLoss.Ratio         NA    6.035    6.178    1.7654    2.737    2.273
 Max.Equity          3154.421 2386.521 1330.685  536.1786 1115.907  947.518
 Min.Equity            -1.416   -5.738    0.000 -229.4703  -10.326   -7.227
 End.Equity          2565.775 1969.314 1286.254  467.3296  814.737  606.872

                          EWJ       EWS        EWT      EWU        EWY       EWZ
 Num.Txns             15.0000   15.0000   13.00000   15.000    13.0000    13.000
 Num.Trades            8.0000    8.0000    7.00000    8.000     7.0000     7.000
 Net.Trading.PL      126.0921  527.5159  352.38231  496.885  3903.4781  5650.267
 Avg.Trade.PL         15.7615   65.9395   50.34033   62.111   557.6397   807.181
 Med.Trade.PL         -4.8031   48.6563   15.20059   53.201   507.7895   425.888
 Largest.Winner      211.4631  287.4863  181.33002  170.439  1911.0697  3090.026
 Largest.Loser      -109.4557 -183.5601  -98.93976  -26.825  -645.4187  -762.177
 Gross.Profits       369.6269  746.4612  536.96182  572.167  4548.8968  6431.642
 Gross.Losses       -243.5348 -218.9453 -184.57951  -75.282  -645.4187  -781.375
 Std.Dev.Trade.PL    105.5657  156.0082  121.48260   84.271   766.8694  1323.564
 Percent.Positive     37.5000   75.0000   57.14286   62.500    85.7143    71.429
 Percent.Negative     62.5000   25.0000   42.85714   37.500    14.2857    28.571
 Profit.Factor         1.5178    3.4094    2.90911    7.600     7.0480     8.231
 Avg.Win.Trade       123.2090  124.4102  134.24045  114.433   758.1495  1286.328
 Med.Win.Trade        99.0951   70.0932  170.21560  138.704   522.5712   533.596
 Avg.Losing.Trade    -48.7070 -109.4727  -61.52650  -25.094  -645.4187  -390.687
 Med.Losing.Trade    -29.1036 -109.4727  -70.52540  -25.206  -645.4187  -390.687
 Avg.Daily.PL          9.5748   69.4619   32.17724   74.305   585.8121   944.911
 Med.Daily.PL         -5.6972   56.0302    0.04312   63.148   522.5712   479.742
 Std.Dev.Daily.PL    112.4465  168.1641  122.22309   83.050   836.0858  1393.859
 Ann.Sharpe            1.3517    6.5571    4.17923   14.203    11.1226    10.761
 Max.Drawdown       -355.7105 -255.8450 -466.69819 -307.027 -1576.6419 -1600.155
 Profit.To.Max.Draw    0.3545    2.0619    0.75505    1.618     2.4758     3.531
 Avg.WinLoss.Ratio     2.5296    1.1365    2.18183    4.560     1.1747     3.292
 Med.WinLoss.Ratio     3.4049    0.6403    2.41354    5.503     0.8097     1.366
 Max.Equity          422.7339  547.8001  369.07717  650.692  4695.6618  6644.273
 Min.Equity            0.0000  -27.7323  -97.62103  -29.595  -106.6402   -58.404
 End.Equity          126.0921  527.5159  352.38231  496.885  3903.4781  5650.267

                         EZU       IEF        IGE      IYR       IYZ       LQD
 Num.Txns             13.000   16.0000      13.00   11.000   19.0000   12.0000
 Num.Trades            7.000    8.0000       7.00    6.000   10.0000    6.0000
 Net.Trading.PL     1182.003  727.7658 -3.733e+01 1925.684  174.6551  -83.6846
 Avg.Trade.PL        168.858   90.9707 -5.333e+00  320.947   17.4655  -13.9474
 Med.Trade.PL        116.812   60.5784  1.500e+02  310.430  -36.2849  -43.9321
 Largest.Winner      706.295  356.5054  6.172e+02  807.768  447.8273  257.6271
 Largest.Loser       -21.553 -224.7938 -1.047e+03 -294.785 -158.5646 -278.1925
 Gross.Profits      1256.372 1093.0415  1.342e+03 2220.469  707.1572  447.8795
 Gross.Losses        -74.369 -365.2757 -1.380e+03 -294.785 -532.5021 -531.5641
 Std.Dev.Trade.PL    255.791  211.5468  5.380e+02  367.789  179.1449  206.1184
 Percent.Positive     71.429   75.0000  5.714e+01   83.333   40.0000   33.3333
 Percent.Negative     28.571   25.0000  4.286e+01   16.667   60.0000   66.6667
 Profit.Factor        16.894    2.9924  9.729e-01    7.533    1.3280    0.8426
 Avg.Win.Trade       251.274  182.1736  3.356e+02  444.094  176.7893  223.9397
 Med.Win.Trade       126.562  168.8602  2.875e+02  328.352  113.7095  223.9397
 Avg.Losing.Trade    -37.184 -182.6379 -4.598e+02 -294.785  -88.7504 -132.8910
 Med.Losing.Trade    -37.184 -182.6379 -1.881e+02 -294.785  -82.9667 -121.9668
 Avg.Daily.PL        205.803   90.9707 -6.897e+01  336.975    1.5594  -13.9474
 Med.Daily.PL        121.687   60.5784  2.740e+00  328.352  -39.9546  -43.9321
 Std.Dev.Daily.PL    258.938  211.5468  5.598e+02  408.851  182.3684  206.1184
 Ann.Sharpe           12.617    6.8265 -1.956e+00   13.084    0.1357   -1.0742
 Max.Drawdown       -756.388 -753.7337 -1.189e+03 -977.604 -415.3754 -648.4695
 Profit.To.Max.Draw    1.563    0.9655 -3.139e-02    1.970    0.4205   -0.1290
 Avg.WinLoss.Ratio     6.758    0.9975  7.297e-01    1.507    1.9920    1.6851
 Med.WinLoss.Ratio     3.404    0.9246  1.529e+00    1.114    1.3705    1.8361
 Max.Equity         1650.980 1400.1652  4.661e+02 1932.684  332.9343  251.3202
 Min.Equity          -27.256 -321.9691 -7.230e+02 -190.088 -335.9970 -397.1493
 End.Equity         1182.003  727.7658 -3.733e+01 1925.684  174.6551  -83.6846

                          RWR      SHY        TLT      XLB        XLE      XLF
 Num.Txns              11.000   13.000    14.0000   15.000    17.0000   12.000
 Num.Trades             6.000    7.000     7.0000    8.000     9.0000    6.000
 Net.Trading.PL      1995.629 1142.519  1442.2875  980.284  -456.6602  323.884
 Avg.Trade.PL         332.605  163.217   206.0411  122.536   -50.7400   53.981
 Med.Trade.PL         335.682   61.755   269.8718  113.830  -152.9856  100.260
 Largest.Winner       773.739  901.261   809.9610  661.063  1136.1168  223.785
 Largest.Loser       -292.223  -41.231  -484.5142 -323.312 -1360.1798 -189.485
 Gross.Profits       2287.852 1183.751  1926.8017 1620.063  2243.5774  575.037
 Gross.Losses        -292.223  -41.231  -484.5142 -639.779 -2700.2376 -251.153
 Std.Dev.Trade.PL     379.963  330.145   388.5266  334.521   723.7411  153.249
 Percent.Positive      83.333   85.714    85.7143   62.500    44.4444   66.667
 Percent.Negative      16.667   14.286    14.2857   37.500    55.5556   33.333
 Profit.Factor          7.829   28.710     3.9768    2.532     0.8309    2.290
 Avg.Win.Trade        457.570  197.292   321.1336  324.013   560.8943  143.759
 Med.Win.Trade        359.312   63.647   295.1517  357.324   484.7987  142.446
 Avg.Losing.Trade    -292.223  -41.231  -484.5142 -213.260  -540.0475 -125.577
 Med.Losing.Trade    -292.223  -41.231  -484.5142 -229.386  -339.2491 -125.577
 Avg.Daily.PL         327.263  179.497   206.0411   88.994  -130.5507   53.981
 Med.Daily.PL         312.051   39.657   269.8718   49.687  -198.6073  100.260
 Std.Dev.Daily.PL     424.560  358.565   388.5266  346.489   730.1456  153.249
 Ann.Sharpe            12.237    7.947     8.4185    4.077    -2.8384    5.592
 Max.Drawdown       -1078.974 -176.880 -1935.3483 -782.001 -2802.9605 -286.089
 Profit.To.Max.Draw     1.850    6.459     0.7452    1.254    -0.1629    1.132
 Avg.WinLoss.Ratio      1.566    4.785     0.6628    1.519     1.0386    1.145
 Med.WinLoss.Ratio      1.230    1.544     0.6092    1.558     1.4290    1.134
 Max.Equity          2007.629 1177.262  3079.6926  983.284  1605.9939  591.275
 Min.Equity          -387.039  -63.396  -660.0092  -43.384 -1196.9666  -75.179
 End.Equity          1995.629 1142.519  1442.2875  980.284  -456.6602  323.884

                         XLI      XLK       XLP      XLU        XLV      XLY
 Num.Txns             11.000   13.000   11.0000   13.000   15.00000    9.000
 Num.Trades            6.000    7.000    6.0000    7.000    8.00000    5.000
 Net.Trading.PL     1711.104  803.342  323.3662 1004.075   30.93792 1211.524
 Avg.Trade.PL        285.184  114.763   53.8944  143.439    3.86724  242.305
 Med.Trade.PL        326.887  105.678   65.8982    7.115   -9.87414  147.312
 Largest.Winner      519.577  438.553  356.5055  681.636  288.56124  761.154
 Largest.Loser         0.000 -107.612 -210.7667 -295.709 -187.12589  -82.008
 Gross.Profits      1711.104  972.832  591.8219 1349.316  466.45591 1293.532
 Gross.Losses          0.000 -169.490 -268.4557 -345.241 -435.51798  -82.008
 Std.Dev.Trade.PL    194.940  190.582  188.6608  346.799  146.85429  330.468
 Percent.Positive    100.000   57.143   66.6667   57.143   50.00000   80.000
 Percent.Negative      0.000   42.857   33.3333   42.857   50.00000   20.000
 Profit.Factor           Inf    5.740    2.2045    3.908    1.07104   15.773
 Avg.Win.Trade       285.184  243.208  147.9555  337.329  116.61398  323.383
 Med.Win.Trade       326.887  214.301   96.6660  330.282   68.64046  247.765
 Avg.Losing.Trade        NaN  -56.497 -134.2278 -115.080 -108.87950  -82.008
 Med.Losing.Trade         NA  -34.689 -134.2278  -27.216  -94.01504  -82.008
 Avg.Daily.PL        317.385  116.277   46.7108  171.065   -5.57699  293.669
 Med.Daily.PL        405.014   81.035   41.9843   60.238  -60.36201  247.765
 Std.Dev.Daily.PL    199.312  208.726  210.0097  371.366  155.97459  357.804
 Ann.Sharpe           25.279    8.843    3.5308    7.312   -0.56760   13.029
 Max.Drawdown       -359.821 -431.415 -309.4029 -577.717 -418.76748 -496.847
 Profit.To.Max.Draw    4.755    1.862    1.0451    1.738    0.07388    2.438
 Avg.WinLoss.Ratio       NaN    4.305    1.1023    2.931    1.07104    3.943
 Med.WinLoss.Ratio        NA    6.178    0.7202   12.135    0.73010    3.021
 Max.Equity         1713.104  852.989  332.3662 1332.267  174.64061 1464.480
 Min.Equity            0.000 -124.148 -177.2952 -105.827 -399.20704 -100.523
 End.Equity         1711.104  803.342  323.3662 1004.075   30.93792 1211.524

Looking at the statistics on a per-trade basis on a 100-share trade size, the majority of configurations come away with a clear profit. While I did not set any transaction costs/slippage, as this strategy is a long to medium term horizon strategy, I wouldn’t worry too much over it. The statistics that impress me are the percentage correct and the profit factor. Looking at EWJ, even when the percentage correct is less than 50%, the strategy still manages to eke out a profit (profit factor 1.5). A few instruments lose), but on a whole, for an indicator that’s supposed to be a mere filter, this isn’t a particularly bad start.

For those wondering about the annualized “Sharpe Ratio” as it is calculated with trade statistics, this is my interpretation of it: if you aggregated every single trade’s profit and loss into one day apiece, averaged them, and divided by the standard error, which is the standard deviation divided by the square root of 252 (trading days in a year).

Here are the daily statistics:

dStats <- dailyStats(Portfolios = portfolio.st, use = "Equity")
rownames(dStats) <- gsub("\\.DailyEndEq", "", rownames(dStats))
print(data.frame(t(dStats[, -1])))
                          EFA       EPP      EWA      EWC      EWG      EWH
 Total.Days            886.00    669.00   636.00   566.00   675.00   842.00
 Winning.Days          490.00    370.00   359.00   300.00   370.00   442.00
 Losing.Days           396.00    299.00   277.00   266.00   305.00   400.00
 Avg.Day.PL              2.90      2.94     2.02     0.83     1.21     0.72
 Med.Day.PL              5.96      5.06     4.63     2.26     1.81     1.65
 Largest.Winner        196.41    164.03   123.88   113.03    99.29   120.60
 Largest.Loser        -275.87   -234.28  -135.60  -126.79  -117.34  -122.37
 Gross.Profits       19050.85  13211.44  8517.36  6635.32  7027.38  7348.06
 Gross.Losses       -16485.08 -11242.12 -7231.10 -6167.99 -6212.64 -6741.19
 Std.Dev.Daily.PL       54.62     50.83    34.68    30.69    27.08    24.61
 Percent.Positive       55.30     55.31    56.45    53.00    54.81    52.49
 Percent.Negative       44.70     44.69    43.55    47.00    45.19    47.51
 Profit.Factor           1.16      1.18     1.18     1.08     1.13     1.09
 Avg.Win.Day            38.88     35.71    23.73    22.12    18.99    16.62
 Med.Win.Day            30.35     26.11    17.14    16.54    14.44    11.84
 Avg.Losing.Day        -41.63    -37.60   -26.11   -23.19   -20.37   -16.85
 Med.Losing.Day        -28.57    -23.21   -15.90   -15.08   -13.21   -11.00
 Avg.Daily.PL            2.90      2.94     2.02     0.83     1.21     0.72
 Med.Daily.PL            5.96      5.06     4.63     2.26     1.81     1.65
 Std.Dev.Daily.PL.1     54.62     50.83    34.68    30.69    27.08    24.61
 Ann.Sharpe              0.84      0.92     0.93     0.43     0.71     0.46
 Max.Drawdown        -1035.24   -817.16  -519.81  -765.65  -442.17  -529.43
 Profit.To.Max.Draw      2.48      2.41     2.47     0.61     1.84     1.15
 Avg.WinLoss.Ratio       0.93      0.95     0.91     0.95     0.93     0.99
 Med.WinLoss.Ratio       1.06      1.12     1.08     1.10     1.09     1.08
 Max.Equity           3154.42   2386.52  1330.69   536.18  1115.91   947.52
 Min.Equity             -1.42     -5.74     0.00  -229.47   -10.33    -7.23
 End.Equity           2565.77   1969.31  1286.25   467.33   814.74   606.87

                         EWJ      EWS      EWT      EWU       EWY       EWZ
 Total.Days           569.00   970.00   597.00   763.00    989.00   1075.00
 Winning.Days         298.00   536.00   316.00   410.00    546.00    605.00
 Losing.Days          271.00   434.00   281.00   353.00    443.00    470.00
 Avg.Day.PL             0.22     0.54     0.59     0.65      3.95      5.26
 Med.Day.PL             1.87     1.61     1.67     1.68      9.35      7.49
 Largest.Winner        44.31    67.76    72.61    67.65    389.70    563.64
 Largest.Loser        -57.97   -84.06  -116.84   -98.01   -354.19   -623.29
 Gross.Profits       3238.75  4779.24  4216.67  5613.57  30944.68  38572.35
 Gross.Losses       -3112.66 -4251.73 -3864.29 -5116.69 -27041.21 -32922.08
 Std.Dev.Daily.PL      14.18    13.75    18.17    18.65     82.68    102.52
 Percent.Positive      52.37    55.26    52.93    53.74     55.21     56.28
 Percent.Negative      47.63    44.74    47.07    46.26     44.79     43.72
 Profit.Factor          1.04     1.12     1.09     1.10      1.14      1.17
 Avg.Win.Day           10.87     8.92    13.34    13.69     56.68     63.76
 Med.Win.Day            8.64     6.00    11.02    11.24     40.88     36.97
 Avg.Losing.Day       -11.49    -9.80   -13.75   -14.49    -61.04    -70.05
 Med.Losing.Day        -8.87    -6.43   -10.08   -10.41    -40.22    -40.02
 Avg.Daily.PL           0.22     0.54     0.59     0.65      3.95      5.26
 Med.Daily.PL           1.87     1.61     1.67     1.68      9.35      7.49
 Std.Dev.Daily.PL.1    14.18    13.75    18.17    18.65     82.68    102.52
 Ann.Sharpe             0.25     0.63     0.52     0.55      0.76      0.81
 Max.Drawdown        -355.71  -255.84  -466.70  -307.03  -1576.64  -1600.16
 Profit.To.Max.Draw     0.35     2.06     0.76     1.62      2.48      3.53
 Avg.WinLoss.Ratio      0.95     0.91     0.97     0.94      0.93      0.91
 Med.WinLoss.Ratio      0.97     0.93     1.09     1.08      1.02      0.92
 Max.Equity           422.73   547.80   369.08   650.69   4695.66   6644.27
 Min.Equity             0.00   -27.73   -97.62   -29.59   -106.64    -58.40
 End.Equity           126.09   527.52   352.38   496.89   3903.48   5650.27

                          EZU      IEF       IGE       IYR      IYZ      LQD
 Total.Days            661.00   670.00    510.00    582.00   715.00   561.00
 Winning.Days          366.00   339.00    272.00    307.00   362.00   290.00
 Losing.Days           295.00   331.00    238.00    275.00   353.00   271.00
 Avg.Day.PL              1.79     1.09     -0.07      3.31     0.24    -0.15
 Med.Day.PL              4.40     0.88      3.76      6.55     0.86     1.63
 Largest.Winner        173.19   171.24    215.52    235.32    70.10   109.77
 Largest.Loser        -269.85  -159.58   -227.11   -251.01  -102.91  -125.10
 Gross.Profits       12212.18 10589.20  10077.87  15816.00  5627.62  7328.19
 Gross.Losses       -11030.18 -9861.44 -10115.20 -13890.32 -5452.96 -7411.88
 Std.Dev.Daily.PL       48.55    41.28     53.89     65.85    20.72    34.60
 Percent.Positive       55.37    50.60     53.33     52.75    50.63    51.69
 Percent.Negative       44.63    49.40     46.67     47.25    49.37    48.31
 Profit.Factor           1.11     1.07      1.00      1.14     1.03     0.99
 Avg.Win.Day            33.37    31.24     37.05     51.52    15.55    25.27
 Med.Win.Day            26.82    23.78     31.78     44.00    12.42    19.64
 Avg.Losing.Day        -37.39   -29.79    -42.50    -50.51   -15.45   -27.35
 Med.Losing.Day        -24.40   -22.30    -30.05    -38.11   -11.24   -21.70
 Avg.Daily.PL            1.79     1.09     -0.07      3.31     0.24    -0.15
 Med.Daily.PL            4.40     0.88      3.76      6.55     0.86     1.63
 Std.Dev.Daily.PL.1     48.55    41.28     53.89     65.85    20.72    34.60
 Ann.Sharpe              0.58     0.42     -0.02      0.80     0.19    -0.07
 Max.Drawdown         -756.39  -753.73  -1189.16   -977.60  -415.38  -648.47
 Profit.To.Max.Draw      1.56     0.97     -0.03      1.97     0.42    -0.13
 Avg.WinLoss.Ratio       0.89     1.05      0.87      1.02     1.01     0.92
 Med.WinLoss.Ratio       1.10     1.07      1.06      1.15     1.10     0.90
 Max.Equity           1650.98  1400.17    466.12   1932.68   332.93   251.32
 Min.Equity            -27.26  -321.97   -723.05   -190.09  -336.00  -397.15
 End.Equity           1182.00   727.77    -37.33   1925.68   174.66   -83.68

                          RWR      SHY       TLT       XLB       XLE      XLF
 Total.Days            574.00  1190.00    614.00    780.00    727.00   471.00
 Winning.Days          309.00   668.00    321.00    429.00    398.00   246.00
 Losing.Days           265.00   522.00    293.00    351.00    329.00   225.00
 Avg.Day.PL              3.48     0.96      2.35      1.26     -0.63     0.69
 Med.Day.PL              5.92     1.00      6.03      4.30      8.25     1.82
 Largest.Winner        269.45    32.68    471.43    129.97    416.59    83.33
 Largest.Loser        -293.03   -43.49   -333.98   -162.54   -350.68  -156.62
 Gross.Profits       17031.46  4452.86  19634.89  11099.37  22312.96  4470.08
 Gross.Losses       -15035.83 -3310.34 -18192.61 -10119.09 -22769.62 -4146.20
 Std.Dev.Daily.PL       72.55     8.62     86.91     36.57     88.11    24.85
 Percent.Positive       53.83    56.13     52.28     55.00     54.75    52.23
 Percent.Negative       46.17    43.87     47.72     45.00     45.25    47.77
 Profit.Factor           1.13     1.35      1.08      1.10      0.98     1.08
 Avg.Win.Day            55.12     6.67     61.17     25.87     56.06    18.17
 Med.Win.Day            45.43     5.03     40.71     21.69     39.10    13.76
 Avg.Losing.Day        -56.74    -6.34    -62.09    -28.83    -69.21   -18.43
 Med.Losing.Day        -45.55    -4.93    -45.35    -19.65    -46.93   -12.94
 Avg.Daily.PL            3.48     0.96      2.35      1.26     -0.63     0.69
 Med.Daily.PL            5.92     1.00      6.03      4.30      8.25     1.82
 Std.Dev.Daily.PL.1     72.55     8.62     86.91     36.57     88.11    24.85
 Ann.Sharpe              0.76     1.77      0.43      0.55     -0.11     0.44
 Max.Drawdown        -1078.97  -176.88  -1935.35   -782.00  -2802.96  -286.09
 Profit.To.Max.Draw      1.85     6.46      0.75      1.25     -0.16     1.13
 Avg.WinLoss.Ratio       0.97     1.05      0.99      0.90      0.81     0.99
 Med.WinLoss.Ratio       1.00     1.02      0.90      1.10      0.83     1.06
 Max.Equity           2007.63  1177.26   3079.69    983.28   1605.99   591.27
 Min.Equity           -387.04   -63.40   -660.01    -43.38  -1196.97   -75.18
 End.Equity           1995.63  1142.52   1442.29    980.28   -456.66   323.88

                         XLI      XLK      XLP      XLU      XLV      XLY
 Total.Days           703.00   806.00   453.00   845.00   632.00   641.00
 Winning.Days         396.00   452.00   247.00   469.00   316.00   348.00
 Losing.Days          307.00   354.00   206.00   376.00   316.00   293.00
 Avg.Day.PL             2.43     1.00     0.71     1.19     0.05     1.89
 Med.Day.PL             3.53     2.90     1.91     2.71     0.01     2.96
 Largest.Winner       117.17    98.93    76.23    91.19    78.78   165.94
 Largest.Loser       -105.71   -93.48   -67.43  -144.31   -97.34  -127.92
 Gross.Profits       7981.67  7157.63  2899.29  8376.04  5328.55  7759.21
 Gross.Losses       -6270.56 -6354.29 -2575.92 -7371.96 -5297.62 -6547.68
 Std.Dev.Daily.PL      26.72    22.19    15.94    25.64    21.81    30.39
 Percent.Positive      56.33    56.08    54.53    55.50    50.00    54.29
 Percent.Negative      43.67    43.92    45.47    44.50    50.00    45.71
 Profit.Factor          1.27     1.13     1.13     1.14     1.01     1.19
 Avg.Win.Day           20.16    15.84    11.74    17.86    16.86    22.30
 Med.Win.Day           16.69    12.37     9.31    14.55    14.23    18.28
 Avg.Losing.Day       -20.43   -17.95   -12.50   -19.61   -16.76   -22.35
 Med.Losing.Day       -15.22   -12.58    -9.61   -12.72   -13.16   -15.99
 Avg.Daily.PL           2.43     1.00     0.71     1.19     0.05     1.89
 Med.Daily.PL           3.53     2.90     1.91     2.71     0.01     2.96
 Std.Dev.Daily.PL.1    26.72    22.19    15.94    25.64    21.81    30.39
 Ann.Sharpe             1.45     0.71     0.71     0.74     0.04     0.99
 Max.Drawdown        -359.82  -431.41  -309.40  -577.72  -418.77  -496.85
 Profit.To.Max.Draw     4.76     1.86     1.05     1.74     0.07     2.44
 Avg.WinLoss.Ratio      0.99     0.88     0.94     0.91     1.01     1.00
 Med.WinLoss.Ratio      1.10     0.98     0.97     1.14     1.08     1.14
 Max.Equity          1713.10   852.99   332.37  1332.27   174.64  1464.48
 Min.Equity             0.00  -124.15  -177.30  -105.83  -399.21  -100.52
 End.Equity          1711.10   803.34   323.37  1004.07    30.94  1211.52

Looking at the daily statistics, while the statistics aren’t exactly spectacular on the daily time frame, keep in mind that these configurations are ones that hold for very long periods of time, and thus are subject to the usual sloshings of the individual securities over a long period of time. The thing to see here is that this indicator does a good job of creating an edge in most instruments.

Continuing–let’s look at the equity curve of XLB.

tmp <- TVI(Cl(XLB), period = 100)
add_TA(tmp$vigor)

XLB Equity Curve

Something to note is that the exits I programmed aren’t exactly the best, and suffer from the same weaknesses as the usual trend followers–namely, that unsophisticated trend-following strategies tend to “give back their profts” as the trend they were following winds down. However, looking at the plot of the indicator at the bottom, and given how it does not seem to be something very prone to whipsaws, a potential trading strategy going forward may be to do something Dr. Ehlers has done in another one of his presentations, and create signals on the relationship of the signal compared to its 1-day lagged version.

Finally, out of a tagential interest, let’s look at some portfolio statistics. Note that this probably makes the least sense out of anything presented here since there is no intelligent asset allocation scheme at work here.

portPL <- .blotter$portfolio.TVItrendFollowingLong$summary$Net.Trading.PL
(SharpeRatio.annualized(portPL, geometric=FALSE))

                                 Net.Trading.PL
Annualized Sharpe Ratio (Rf=0%)          0.623

plot(cumsum(portPL)["2003::"])

Portfolio Equity Curve

From a returns perspective, this doesn’t make too much sense, as there’s no initial equity, but it exists to just get a perspective of the strategy’s performance at a portfolio level. Overall, it seems the system is profitable, but drawdowns come quickly, meaning that as a strategy in and of itself, Trend Vigor is definitely worth looking at. That stated, its original use was as a filter, and odds are, there exist indicators that are probably more dedicated to trend following such as the FRAMA, ichimoku, and so on.

So, overall, this blog post has shown a few things:

1) It is possible to create a trend-following strategy with a win percentage greater than that of 50%.

2) While the trend vigor indicator is a filter, it may be possible to put a dedicated trend-following filter on top of it (such as the FRAMA–more on that in the future), to possibly get even better results.

3) This is (definitely) not a complete trading system. The exit logic definitely leaves something to be desired (for instance, if the trend vigor reaches its maximum (2)–which seems to be every time, waiting for it to drop under 1.4 is definitely suboptimal), and it seems more improvements can be made.

Furthermore, there is more to investigate in the study of this indicator:

1) In this case, given the smoothness of the trend vigor, is it possible to be more aggressive with it? For instance, although it avoided the financial crisis completely, it did not re-enter the market until late 2009, missing a chunk of the trend, and furthermore, it also managed to give back most of those profits (but not all). Can this be rectified?

2) How does the strategy perform on the short end?

3) What can be done to keep strategies built on this indicator from “giving back open equity”?

While I myself have more indicators to write about, I also feel that input from readers may be worth testing as well.

Thanks for reading.