Speculative sign smoothing and nearest neighbors

By D. Thomakos

One of the fascinating aspects on research in financial forecasting is that it knows no bounds on the potential applicability of trading rules. In this post I offer a simplistic, what else, approach on sign smoothing that combines a simple forecasting rule and nearest neighbors for learning and works extremely well by being robust in different parameterizations and has only one prerequisite: volatility! The main idea is outlined below and the computations, of which there are more than usual can be found in my github repository - consult the Python code for a lot of additional information. Consider thus the following rule for sign forecasting, where I denote by [math]s_{t}[/math] the sign of the return at time t

[math] s_{t+1|t} \doteq \gamma_{t} s_{t} + (1-\gamma_{t})\Delta s_{t} [/math] 

[math] s_{t+1|t} \doteq \Delta s_{t} + \gamma_{t}s_{t-1} [/math] 

This rule is a linear combination of the last observed sign and the sign difference. Perfect foresight would lead to a solution for the value of the time parameter [math]\gamma_{t}[/math] as in:

[math]\gamma_{t|t+1} \doteq (s_{t+1} - \Delta s_{t})/s_{t-1} = (\Delta s_{t+1} + s_{t-1})/s_{t-1}[/math]

which is certainly a trainable parameter from some existing data. Note that the range of [math] \gamma_{t|t+1}[/math] is the set [math] {\cal G} \doteq \left\{-1, +1, +3\right\}[/math], and as such is "richer" than just the two values of the sign of returns. Consider then computing the value of [math]\gamma_{t|t+1}[/math] from the data and then forecasting it to use in the out-of-sample determination of the predicted sign [math]\widehat{s}_{t+1|t}[/math]. Since the value of the time-varying parameter depends on a simple two-period Markov scheme, details on request, it has a nice interpretation. For the forecast of this parameter, let's call it [math]\widehat{\gamma}_{t|t+1}[/math], I am using a nearest neighbors (NN) approach because it fits perfectly with the idea that sign changes imply changes in the value of the parameter, and this value changes over time. For the NN application I am using a trajectory matrix approach to formulate rolling windows and to the forecast based on distances of the last observed vector of the trajectory matrix to all of the rest vectors of the trajectory matrix. Please consult the code for further details on the parametrizations being used. The final, usable forecast, is denoted by [math]\widehat{s}_{t+1|t} \doteq \Delta s_{t} + \widehat{\gamma}_{t|t+1}s_{t-1}[/math], which is used for trading. 

As I have done in many previous posts, I will be reporting some empirical results based on aggregation across parametric combinations for the suggested method. This way I am trying to illustrate the efficacy of a method and its generic inferential ability. The evaluation will be on daily rebalancing and data from 2022 (this starting year, I remind the readers, has been used in many previous posts and makes the results of other methods fully comparable). The ETFs being used here are standard fare and are: VXX, DBC, DBA, TNA, OIH, DBB, TLT and WEAT. All of them are highly volatile and amenable to market timing as I have illustrated in the past. The results are summarized in Table 1 below.

Screenshot 2024-11-25 005743

Table 1. Performance attribution of the speculative sign smoothing and NN strategy. Daily rebalancing, data starting in 2022, statistics are across all combinations of parameters for NN, delay is always 1-day, maximum embedding dimension is 30 days. Please consult the Python code for more details. 

The results are rather speculatively provocative. Given the many parametric combinations that were available and the good percentages of successful generation of positive excess returns (with the exception of DBA), the results indicate that the proposed method works very, very well, providing ample space to create an even better performance in applications - the use of some cross-validation method is here highly applicable and recommended, since many parametric combinations work. A curious aspect of the above results, which the perceptive reader must have grasped by now, is the absence of index ETFs such as SPY or QQQ. Here is your exercise then: first, try to examine for which parametric combinations these ETFs can be profitably traded with the current method and, second, go back in time and experiment with the weekly and monthly frequency (hint: change the delay too!). Once you complete this exercise you should be satisfied about the universal applicability of this method; add it to your speculative toolbox!