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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s