R2Trend

Description

As the first step, the R2Trend (RSquared) strategy calculates the RSquared, a technical indicator which measures how closely a data set of close prices conforms to the linear regression trendline. If the correlation is found to be higher than a certain threshold (the default value is 0.42), the strategy measures the steepness of the trendline, using Linear Regression Slope. Based on the premise that steeper slopes signify stronger trends (when the absolute value of the slope found is greater than the specified value), the overall trending conditions are evaluated by the strategy as follows:

  • RSquared values being greater than both a lower threshold (trend level in the input parameters) and its own prior value while the trendline slope is greater than critical - read as indication of a strong uptrend;
  • RSquared values being greater than both a lower threshold (trend level in the input parameters) and its own prior value while the trendline slope is less than the negative critical - read as indication of a strong downtrend.

The first condition triggers a simulated buy-to open order if the close price rises above its own moving average. Vice versa, a simulated sell-to-open order is added when the second condition is true should the close price fall below the average.

Simulated exit orders are added based on crossovers of the close price plot with its moving average: when the close price crosses below the average, a simulated sell-to-close order is added; when it crosses above - the simulation of buy-to-close takes place.  

Input Parameters

length Defines the period for the calculation of the RSquared.
r average length Defines the period for the calculation of the moving average for RSquared optimization.
lag

Defines the lookback period for the prior RSquared value.

average length Defines the period for the calculation of the moving average.
trend level Defines the minimum RSquared level at which strong trending conditions are recognized.
max level Defines the maximum RSquared level at which strong trending conditions are recognized.
lr crit level Defines the minimum trendline slope at which strong trending conditions are recognized.
average type The type of moving average to be used in calculations: simple, exponential, weighted, Wilder's, or Hull.

Further Reading

 1. "Which Trend Indicator Wins?" by Markos Katsanos. Technical Analysis of Stocks & Commodities, October 2016.

Backtesting is the evaluation of a particular trading strategy using historical data. Results presented are hypothetical, and there is no guarantee that the same strategy implemented today would produce similar results.

Technical analysis is not recommended as a sole means of investment research.

For educational purposes only. Not a recommendation of a specific security or investment strategy.

You may also like
MomentumPercentDiff
The Momentum Percent Diff is a momentum-based technical indicator. Unlike the regular Momentum ...
IntradayMomentumIndex
The Intraday Momentum Index (IMI) is a variation of Relative Momentum Index which takes into ...
STARCBands
The Stoller Average Range Channel (STARC) Bands are two bands plotted around a short-term simple ...