Skip to main content
BTC / USDT——ETH / USDT——SOL / USDT——BNB / USDT——XRP / USDT——DOGE / USDT——TON / USDT——AVAX / USDT——LINK / USDT——ADA / USDT——TRX / USDT——DOT / USDT——BTC / USDT——ETH / USDT——SOL / USDT——BNB / USDT——XRP / USDT——DOGE / USDT——TON / USDT——AVAX / USDT——LINK / USDT——ADA / USDT——TRX / USDT——DOT / USDT——
मूल्य निर्धारण

RSI (Relative Strength Index)

The classic 0–100 momentum oscillator — ready-to-paste code for MT4, MT5, TradeStation and TradingView.

RSI measures the speed and magnitude of recent price changes on a 0–100 scale. Readings above 70 signal overbought conditions and below 30 oversold; many traders also use the 50 line as a simple trend bias. Copy the version for your platform below.

MetaTrader 4 (MQL4)

MQL4 · RSI.mq4
#property indicator_separate_window
#property indicator_buffers 1

extern int RSI_Period = 14;
double RsiBuffer[];

int OnInit() {
  SetIndexBuffer(0, RsiBuffer);
  IndicatorShortName("RSI(" + RSI_Period + ")");
  return 0;
}

int OnCalculate(const int rates_total, const int prev_calculated, const double &close[]) {
  for (int i = prev_calculated; i < rates_total; i++)
    RsiBuffer[i] = iRSI(NULL, 0, RSI_Period, PRICE_CLOSE, i);
  return rates_total;
}

MetaTrader 5 (MQL5)

MQL5 · RSI.mq5
#property indicator_separate_window
#property indicator_buffers 1

input int RSI_Period = 14;
double RsiBuffer[];

int OnInit() {
  SetIndexBuffer(0, RsiBuffer);
  IndicatorSetString(INDICATOR_SHORTNAME, "RSI(" + IntegerToString(RSI_Period) + ")");
  return INIT_SUCCEEDED;
}

int OnCalculate(const int rates_total, const int prev_calculated,
  const datetime &time[], const double &open[], const double &high[],
  const double &low[], const double &close[], const long &tick_volume[],
  const long &volume[], const int &spread[]) {
  for (int i = prev_calculated; i < rates_total; i++)
    RsiBuffer[i] = iRSI(NULL, 0, RSI_Period, PRICE_CLOSE, i);
  return rates_total;
}

TradeStation (EasyLanguage)

EasyLanguage
inputs: Length(14);
variables: MyRSI(0);
MyRSI = RSI(Close, Length);
Plot1(MyRSI, "RSI");

TradingView (Pine Script)

Pine Script
//@version=5
indicator("RSI", overlay=false)
length = input.int(14, "RSI Length")
overbought = input.float(70.0, "Overbought")
oversold = input.float(30.0, "Oversold")
rsiValue = ta.rsi(close, length)
plot(rsiValue, title="RSI", color=color.purple, linewidth=2)
hline(overbought)
hline(oversold)
hline(50)

Want it inside dtcharts? Open the Script Converter, paste any version above, and it converts to a native indicator you can drop on the chart. Every snippet here is tested to convert cleanly.

क्या यह सहायक था?