2-Period RSI

The Relative Strength Index (RSI) is a well-known momentum oscillator developed by J. Welles Wilder, which measures the speed and change of price movements. The RSI oscillates between zero and 100 and is typically used to identify overbought or oversold conditions in a market. While the typical RSI calculation uses a 14-period lookback, the 2-period RSI is a variation designed for shorter time frames to provide more sensitive and frequent signals. This approach is particularly useful for active traders who engage in short-term trades.

Understanding RSI

Before diving into the specifics of the 2-period RSI, it’s crucial to comprehend the basis of the traditional RSI. The RSI calculates a ratio of the upward movements to the total absolute size of all price movements within a specific time period:

RS = (Average [Gain](../g/gain.html) over N periods) / (Average Loss over N periods)
RSI = 100 - [100 / (1 + RS)]

In these formulas, “RS” refers to the Relative Strength, “Average Gain” is the mean of all gains during the selected period, and “Average Loss” is the mean of all losses during the chosen period.

2-Period RSI Calculation

For the 2-period RSI, the calculation adjusts the lookback period to only two periods instead of the conventional 14. This produces faster and more responsive indicators, allowing traders to capture shorter-term price changes more effectively.

Here’s how to compute it:

  1. Calculate the Average Gain and Loss: For each of the last two periods, determine if the price has increased or decreased, and by how much.

  2. Determine RS: Divide the average gain by the average loss to get the relative strength (RS).

  3. Plug RS into the RSI formula: Use the RS value in the RSI formula: RSI = 100 - [100 / (1 + RS)].

Example Calculation

If a trader is looking at a stock price for the last three days:

Average Gain = (2 + 2) / 2 = 2
Average Loss = 1 / 2 = 0.5
RS = 2 / 0.5 = 4
RSI = 100 - [100 / (1 + 3)] = 80

Trading with 2-Period RSI

Buy and Sell Signals

The main advantage of a 2-period RSI is that it provides more frequent signals than a 14-period RSI, making it viable for day trading or swing trading. Here are some typical signals:

Combining with Other Indicators

To enhance reliability, traders often combine the 2-period RSI with other indicators such as moving averages, MACD (Moving Average Convergence Divergence), or support and resistance levels. Using multiple indicators helps confirm signals and reduces false positives.

Backtesting and Optimization

Before deploying any trading strategy utilizing the 2-period RSI, it’s crucial to backtest it to understand its performance in various market conditions. Traders can optimize the lookback period and signal thresholds based on historical data to fine-tune the strategy.

Advantages and Limitations

Advantages

Limitations

Practical Application

Many trading platforms and brokerages offer built-in tools to calculate and plot the RSI, including the 2-period variant. Platforms like MetaTrader, TradingView, and ThinkOrSwim are widely used for such purposes.

MetaTrader Implementation

For custom indicator creation on MetaTrader, traders can use the MQL4/MQL5 scripting language. The following is a basic implementation outline:

int OnInit()
  {
   IndicatorBuffers(1);
   SetIndexBuffer(0,RSIBuffer);
   SetIndexStyle(0,DRAW_LINE);
   string short_name = "2-Period RSI";
   IndicatorShortName(short_name);
   IndicatorDigits(Digits);
   [return](../r/return.html)(INIT_SUCCEEDED);
  }
int OnCalculate(const int rates_total,
              const int prev_calculated,
              const datetime &time[],
              const double &[open](../o/open.html)[],
              const double &high[],
              const double &low[],
              const double &close[],
              const long &tick_volume[],
              const long &[volume](../v/volume.html)[],
              const int &spread[])
  {
   int limit = rates_total-prev_calculated;
   double [gain](../g/gain.html), loss;
   for(int i=rates_total-limit; i>=0; i--)
     {
      [gain](../g/gain.html) = 0.0;
      loss = 0.0;
      for(int j=1; j<=2; j++)
        {
         double diff = close[i-j+1] - close[i-j];
         if (diff > 0) [gain](../g/gain.html) += diff;
         else loss -= diff;
        }
      [gain](../g/gain.html) /= 2.0;
      loss /= 2.0;
      if (loss == 0.0) RSIBuffer[i] = 100;
      else if ([gain](../g/gain.html) == 0.0) RSIBuffer[i] = 0;
      else
        {
         double RS = [gain](../g/gain.html)/loss;
         RSIBuffer[i] = 100.0 - (100.0 / (1.0 + RS));
        }
     }
   [return](../r/return.html)(rates_total);
  }

TradingView Implementation

On TradingView, traders can utilize Pine Script to create a custom 2-period RSI indicator:

//@version=4
study(title="2-Period RSI", shorttitle="2-RSI", [overlay](../o/overlay.html)=false)
rsiLength = 2
source = close
rsiValue = rsi(source, rsiLength)
plot(rsiValue, title="2-Period RSI", color=color.blue)
hline(90, "[Overbought](../o/overbought.html)", color=color.red)
hline(10, "[Oversold](../o/oversold.html)", color=color.green)

ThinkOrSwim Implementation

ThinkOrSwim offers a custom scripting language called ThinkScript. Below is an example of a 2-period RSI implementation:

declare lower;
input length = 2;
def NetChgAvg = WildersAverage(close - close[1], length);
def TotChgAvg = WildersAverage(Absvalue(close - close[1]), length);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
plot RSI = 50 * (ChgRatio + 1);
RSI.SetDefaultColor(GetColor(1));
plot [Overbought](../o/overbought.html) = 90;
[Overbought](../o/overbought.html).SetDefaultColor(GetColor(5));
plot [Oversold](../o/oversold.html) = 10;
[Oversold](../o/oversold.html).SetDefaultColor(GetColor(5));

Conclusion

The 2-period RSI is a powerful tool for short-term traders looking to capture quick market movements. While it offers benefits of responsiveness and simplicity, traders should be aware of its limitations and employ complementary indicators and backtesting to optimize their strategies. By effectively integrating the 2-period RSI into a broader trading plan, traders can enhance their chances of successful trades in fast-paced market environments.