In traditional trading systems, they are called indicators; in machine learning systems, they are called predictors, independent variables, or features. They are the data series that we hope contains signals that precede profitable trades.

Assume we are working with daily data, and have a data point for each day. We want to develop a classification model that separates the data points into two classes — whether to hold a long position or remain flat. And assume we have an ideal indicator that has a range of values from 0 to 100. We are looking for a functional relationship where the value of the indicator determines the value of the class. An ideal indicator gives a perfect separation and the task is easy.

Assume the ideal indicator is the 2-period RSI, and it is perfect. The lower the value of the RSI, the better the long position. Whenever the RSI is below 50, we want to beLong; whenever it is above 50, we want to beFlat. We are separating the trade position based on the RSI value. We are separating the chart with a horizontal line — beLong above the classification line, beFlat below the classification line — based on the value of a vertical line — beLong to the left of the RSI==50 line, beFlat to the right of the RSI==50 line.

This is a classical functional relationship. Pick an *input* value along the horizontal axis (the independent variable), go up to find the line representing the function (the string of dots), go left to find the associated *output* value (the target).

That was too good to be true. In the next example, there is some noise and relationship is still good, but not perfect.

We have to compromise. If we continue to divide the days with a vertical line at RSI==50, we get some losing trades. See the small dotted box to the left of the RSI==50 line. If we want to avoid all losing trades, we must change the value at which the vertical line is drawn from RSI==50 to RSI==38. That removes all the losing trades, but also eliminates some profitable trades. See the dotted box to the right of the RSI==38 vertical line.

Where should the vertical line be set? We are trading off allowing real losses (when RSI==50) against lost opportunity (when RSI==38). We should compute the risk-normalized profit potential of these alternatives and choose the one that gives the highest CAR25. Our research, backed by compelling mathematics, shows that avoiding losing trades is more valuable than forgoing profit opportunity. We do not know exactly where to place the vertical line until we have performed the risk-normalization calculation of safe-f and CAR25.

Unfortunately, the relationship between RSI and trade is far less clear when real data is examined. The next chart shows the relationship between the 2-period RSI and the gain for the next day for several years for SPY. The best value for the RSI indicator — the vertical line — as determined by optimization, is 36. The correlation suggests the relationship is almost random. The 2-period RSI is one of the better indicators, yet it is inadequate.

### Feature engineering

Discovering or designing indicators that have predictive value is the most important aspect of trading system development. It is the aspect where you will spend most of your time and effort. For traditional trading systems, this is described as indicator optimization. As you read machine learning literature, it is called feature engineering.

What features have, or at least have the potential to have, predictive value?

Recall the mantra:

- Trade frequently
- Trade accurately
- Hold a short period
- Avoid losses
- Mark-to-market daily

The optimum holding period is one or two days. Since the gain per trade for a one or two day trade is relatively low, we need a high number of them per year — say 25 or more. The trading signal changes only when the indicator changes. So trading frequently requires indicators that change frequently. There must be something unique about the indicator that gives the signal. In mathematical terms, there must be a high proportion of days when the indicator function has a zero. For example, when the 2-period RSI is equal to 36 the corresponding equation that has a zero is RSI(2)-36 == 0.

At high enough frequency to give enough trades per year, all indicators based on price are equivalent. RSI, z-score, fast stochastic, detrended price oscillator, etc. Pick your favorite. But just one.

You might find more value in adding auxiliary variables that are not based on the price of the issue being traded. For examples: interest rates, currencies, commodities, and intra-market variables. Tune those to have a high frequency of zeros, as well.

### Filters

A commonly heard suggestion is to “trade with the trend,” where the trend is defined by an upward sloping long-lookback moving average. For example, permit long positions only when MA(C,200) > 0.0.

The only way to determine whether that is a good idea or not is to fit the model using that rule and run two tests — one using the filter, the second not using the filter. Then evaluate CAR25 for each.

My experience is that filters that block long periods of time are counterproductive. But you should test using your data, your indicators, and your risk tolerance.