The Ultimate Strength Index

The RSI (Relative Strength Index) is a popular indicator used in many trading systems for filters or triggers. In TASC 12/2024 John Ehlers proposed a replacement for this indicator. His USI (Ultimate Strength Index) has the advantage of symmetry – the range is -1 to 1 – and, especially important, less lag. So it can trigger trades earlier. Like the RSI, it enhances cycles and trends in the data, which makes it well suited for various sorts of trading systems. Let’s look how to realize it in code.

The USI is based on another indicator by John Ehlers, the Ultimate Smoother. It was covered in a previous article. Here’s again its code in C:

var UltimateSmoother (var *Data, int Length)
{
  var f = (1.414*PI) / Length;
  var a1 = exp(-f);
  var c2 = 2*a1*cos(f);
  var c3 = -a1*a1;
  var c1 = (1+c2-c3)/4;
  vars US = series(*Data,4);
  return US[0] = (1-c1)*Data[0] + (2*c1-c2)*Data[1] - (c1+c3)*Data[2] + c2*US[1] + c3*US[2];
}

Similar to the RSI, the Ultimate Strength Index calculates the normalized differences of the ups and downs in the price curve, after no-lag smoothing. Here’s Ehlers’ EasyLanguage code converted to C:

var UltimateStrength (int Length)
{
  vars SU = series(max(0,priceC(0) - priceC(1)));
  var USU = UltimateSmooth(series(SMA(SU,4)),Length);
  vars SD = series(max(0,priceC(1) - priceC(0)));
  var USD = UltimateSmooth(series(SMA(SD,4)),Length);
  return (USU-USD)/fix0(USU+USD);
}

The fix0 function is a convenience function that corrects possible divisions by zero. For checking the correctness of our conversion, we’re plotting the USI with two different time periods on a SPX chart. The code:

void run()
{
  BarPeriod = 1440;
  StartDate = 20230801;
  EndDate = 20240801;
  assetAdd("SPX","STOOQ:^SPX");
  asset("SPX");
  plot("USI(112)",UltimateStrength(112),NEW|LINE,BLUE);
  plot("USI(28)",UltimateStrength(28),NEW|LINE,BLUE);
}

The resulting chart replicates the ES chart in Ehlers’ article:

We can see that the long time frame USI enhances the begin and end of trends, the short time frame USI makes the cycles visible. The code can be downloaded from the 2024 script repository.

One thought on “The Ultimate Strength Index”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.