TradeClaw

Open-source AI market intelligence for traders who prefer evidence over noise.

Self-hosted by default

Product

  • Dashboard
  • Screener
  • Backtest
  • Track record
  • Live demo

Transparency

  • What we tested and killed
  • Methodology
  • Why long-term
  • Open data
  • Calibration

Resources

  • Blog
  • Docs
  • API reference
  • How it works
  • FAQ
  • Glossary

Community

  • Discord
  • Weekly digest
  • Contribute
  • Contributors
  • Sponsors

Open source

  • GitHub repo
  • Star history
  • Self-host guide
  • Security
  • Data freshness
  • Roadmap

© 2026 TradeClaw. MIT licensed.

Terms|Privacy|Trading involves risk. Signals are informational only and are not financial advice.
DashboardScreenerCopilotTrack Record
← Blog
RSITechnical AnalysisIndicators

RSI Explained: The Math Behind the Most Popular Trading Indicator

March 20, 2026 · 8 min read

RSI (Relative Strength Index) appears on the screen of virtually every trader. Created by J. Welles Wilder Jr. in 1978, it's one of the oldest and most used technical indicators. But most traders use it as a magic number — "below 30 = buy, above 70 = sell" — without understanding the math behind it.

What RSI Actually Measures

RSI measures the speed and magnitude of price changes. It compares the average gains on up-days to average losses on down-days over a rolling window (default: 14 periods). The result is a number between 0 and 100.

  • RSI above 70 — asset has been rising hard, may be overbought
  • RSI below 30 — asset has been falling hard, may be oversold
  • RSI at 50 — equal gains and losses, neutral momentum

The Formula

Wilder's formula in three steps:

Step 1: RS = Average Gain(n) / Average Loss(n)
Step 2: RSI = 100 − (100 / (1 + RS))
Smoothing: AvgGain = (prevAvgGain × (n−1) + currentGain) / n

Where n = 14 by default (Wilder's original choice).

TypeScript Implementation (from TradeClaw)

Here's the exact implementation we use — no third-party TA library, just math:

apps/web/app/lib/ta-engine.ts
function calculateRSI(closes: number[], period = 14) {
const result = new Array(closes.length).fill(NaN);
if (closes.length < period + 1) return result;

let gains = 0, losses = 0;

// Initial average: simple mean of first period
for (let i = 1; i <= period; i++) {
  const delta = closes[i] - closes[i - 1];
  if (delta > 0) gains += delta;
  else losses -= delta;
}

let avgGain = gains / period;
let avgLoss = losses / period;
result[period] = avgLoss === 0 ? 100 : 100 - (100 / (1 + avgGain / avgLoss));

// Wilder's smoothing for all subsequent values
for (let i = period + 1; i < closes.length; i++) {
  const delta = closes[i] - closes[i - 1];
  avgGain = (avgGain * (period - 1) + Math.max(0, delta)) / period;
  avgLoss = (avgLoss * (period - 1) + Math.max(0, -delta)) / period;
  result[i] = avgLoss === 0 ? 100 : 100 - (100 / (1 + avgGain / avgLoss));
}

return result;
}

How TradeClaw Uses RSI in Signal Scoring

RSI contributes up to 20 points in TradeClaw's 90-point signal scoring system:

RSI ValueBUY scoreSELL score
< 30 (Oversold)+20 pts−10 pts
30–40+15 pts+0 pts
40–50+8 pts+0 pts
50–60+0 pts+8 pts
60–70+0 pts+15 pts
> 70 (Overbought)−10 pts+20 pts

RSI Limitations

RSI alone isn't enough. These are its known weaknesses:

  • Trending markets — in a strong uptrend, RSI can stay above 70 for weeks. "Overbought" can mean "strong trend" not "reversal."
  • Period sensitivity — RSI(14) behaves very differently from RSI(5) or RSI(30). Shorter = more signals, more noise.
  • No price level context — RSI tells you about momentum, not whether the price is at a key level.

That's why TradeClaw combines RSI with MACD, EMA trend, Bollinger Bands, and Stochastic before emitting any signal. See the full scoring algorithm for details.

Save digest preferences

Choose preferences for rule-generated candidates and recorded outcome summaries. The rule score is not a probability or edge estimate; delivery timing is not guaranteed.

No spam, one-click unsubscribe. Customise preferences →

Keep reading

GrowthComparison

TradeClaw vs TradingView: When You'd Pick Each (Honestly)

TradingView and TradeClaw are not the same product. Here’s the honest comparison: where each one wins, what they cost over two years, and when you should use both together.

May 21, 2026 · 11 min read

R-multipleRisk Management

R-Multiples Explained: How TradeClaw Now Measures Trade Quality

Win rate is a trap. R-multiples and expectancy are the only metrics that tell you whether a trading strategy actually makes money over time. Here's how TradeClaw computes them, and why we smooth extreme outliers.

May 11, 2026 · 8 min read