RealMarketAPI
📈
Docs/Technical Indicators

Technical Indicators

Use server indicator endpoints for SMA, EMA, RSI, MACD, and Support & Resistance — plus formulas and production-ready examples.

SMAEMAMACDRSI

Overview

Technical indicators are mathematical calculations applied to a security's price and/or volume to forecast future price movements and identify trading opportunities. The indicator APIs on this page return server-computed values for direct consumption, while formulas are included to explain the math behind each model. Every indicator still originates from OHLCV candle data returned by market data endpoints such as /api/v1/history endpoint — no third-party libraries required.

📊Trend-following

SMA & EMA smooth noise and reveal the underlying price direction.

🔀Momentum

MACD captures the strength and direction of a trend's acceleration.

📏Oscillators

RSI measures the speed of price changes to spot exhaustion zones.

🔗Composable

Chain indicators together for confirmation — e.g. RSI + EMA crossover.

⚠ Important: Technical indicators are derived from past price data and are not predictive on their own. Always combine them with proper risk management, context, and multiple confirmations before executing trades.
S

Simple Moving AverageSMA

Trend-following · Lagging

The Simple Moving Average computes the arithmetic mean of closing prices over a rolling window of n periods. It is the foundational building block of nearly every other indicator. The longer the period, the smoother — but laggier — the output.

Formula

SMA(n, t) = ( Close[t] + Close[t-1] + ... + Close[t-n+1] ) / n

API Endpoint

GET /api/v1/indicator/sma?apiKey=YOUR_API_KEY&SymbolCode=AAPL&TimeFrame=H1&Period=20

Common Periods

PeriodTimeframeTypical Use-Case
10M15 / H1Short-term momentum, scalp entries
20H1 / H4Intermediate trend & pullback zones
50H4 / D1Medium-term trend direction
100D1Major trend, institutional reference
200D1Long-term bull/bear market threshold

Signal Interpretation

bullishPrice crosses above SMA → potential uptrend start or pullback entry
bearishPrice crosses below SMA → potential downtrend or overhead resistance
bullishSMA-50 crosses above SMA-200 (Golden Cross) → strong long-term bull signal
bearishSMA-50 crosses below SMA-200 (Death Cross) → strong long-term bear signal
neutralPrice oscillating around SMA → choppy / range-bound market

Code Example

sma.js
const BASE    = "https://api.realmarketapi.com"
const API_KEY = "YOUR_API_KEY"
const PERIOD  = 20

const url = new URL("/api/v1/indicator/sma", BASE)
url.searchParams.set("apiKey", API_KEY)
url.searchParams.set("SymbolCode", "XAUUSD")
url.searchParams.set("TimeFrame", "H1")
url.searchParams.set("Period", String(PERIOD))

const res = await fetch(url.toString())
if (!res.ok) throw new Error("Request failed: " + res.status)

const data = await res.json()
console.log("SMA API response:", data)
E

Exponential Moving AverageEMA

Trend-following · Lagging · Faster than SMA

The Exponential Moving Average assigns exponentially decreasing weights to older closes, making it significantly more responsive than the SMA to recent price changes. EMA is the backbone of MACD and many crossover strategies.

Formula

Multiplier (k) = 2 / (n + 1) EMA[0] = SMA(closes, n) -- seed with SMA for first value EMA[t] = Close[t] × k + EMA[t-1] × (1 − k)

API Endpoint

GET /api/v1/indicator/ema?apiKey=YOUR_API_KEY&SymbolCode=AUDUSD&TimeFrame=H4&Period=50
Tip: Always seed EMA with an SMA over the first n candles. Starting EMA from a single price produces significant distortion in early values — known as "look-back contraction" — and can skew strategies relying on fresh API data.

Common Periods & Multipliers

PeriodMultiplier (k)Primary Use
90.2000Short-term momentum confirmation
120.1538MACD fast line
210.0952Intraday trend filter
260.0741MACD slow line
500.0392Trend bias filter (above = bullish)
2000.0100Long-term trend regime

Signal Interpretation

bullishPrice above EMA — underlying trend is upward; look for long entries on pullbacks
bearishPrice below EMA — underlying trend is downward; look for short entries on bounces
bullishEMA-9 crosses above EMA-21 on H1/H4 — short-term momentum flipping bullish
bearishEMA-9 crosses below EMA-21 — momentum turning bearish, reduce long exposure
neutralMultiple EMAs bunched together — low directional conviction; avoid trend-following

Code Example

ema.js
const BASE    = "https://api.realmarketapi.com"
const API_KEY = "YOUR_API_KEY"
const PERIOD  = 12

const url = new URL("/api/v1/indicator/ema", BASE)
url.searchParams.set("apiKey", API_KEY)
url.searchParams.set("SymbolCode", "XAUUSD")
url.searchParams.set("TimeFrame", "H1")
url.searchParams.set("Period", String(PERIOD))

const res = await fetch(url.toString())
if (!res.ok) throw new Error("Request failed: " + res.status)

const data = await res.json()
console.log("EMA API response:", data)
M

Moving Average Convergence/DivergenceMACD

Trend-following · Momentum · Components: Line · Signal · Histogram

MACD was developed by Gerald Appel in the late 1970s and remains one of the most widely used indicators. It reveals the relationship between two EMAs — measuring how fast a trend is accelerating or decelerating — and generates three components used for trade signals.

Formula

MACD Line = EMA(12) − EMA(26) Signal Line = EMA(9) of MACD Line Histogram = MACD Line − Signal Line

API Endpoint

GET /api/v1/indicator/macd?apiKey=YOUR_API_KEY&SymbolCode=AUDUSD&TimeFrame=H1&FastPeriod=12&SlowPeriod=26&SignalPeriod=9

Components

MACD Line

Difference between EMA-12 and EMA-26. Crosses zero when short-term trend reverses direction.

Signal Line

EMA(9) of the MACD Line. Smooths it for cleaner crossover signals.

Histogram

MACD Line minus Signal Line. Growing bars = strengthening momentum; shrinking = weakening.

Standard Parameters

ParameterDefaultNotes
Fast EMA12Captures short-term momentum
Slow EMA26Represents longer-term trend
Signal EMA9Smooths the MACD line for cleaner entries
Minimum candles35+Need ≥ 26 + 9 = 35 bars min for valid values

Signal Interpretation

bullishMACD Line crosses above Signal Line → bullish momentum crossover — classic buy trigger
bearishMACD Line crosses below Signal Line → bearish momentum crossover — classic sell trigger
bullishMACD Line crosses above zero → short-term EMA overtakes long-term, trend turned positive
bearishMACD Line crosses below zero → trend turned negative
bullishHistogram bars growing above zero → bullish momentum is strengthening
bearishHistogram bars shrinking toward zero from above → bullish trend losing steam — watch for reversal
neutralDivergence: price makes new high but MACD doesn't → trend weakening, possible reversal ahead

Code Example

macd.js
const BASE         = "https://api.realmarketapi.com"
const API_KEY      = "YOUR_API_KEY"
const FAST_PERIOD  = 12
const SLOW_PERIOD  = 26
const SIGNAL_PERIOD = 9

const url = new URL("/api/v1/indicator/macd", BASE)
url.searchParams.set("apiKey", API_KEY)
url.searchParams.set("SymbolCode", "XAUUSD")
url.searchParams.set("TimeFrame", "H1")
url.searchParams.set("FastPeriod", String(FAST_PERIOD))
url.searchParams.set("SlowPeriod", String(SLOW_PERIOD))
url.searchParams.set("SignalPeriod", String(SIGNAL_PERIOD))

const res = await fetch(url.toString())
if (!res.ok) throw new Error("Request failed: " + res.status)

const data = await res.json()
console.log("MACD API response:", data)
R

Relative Strength IndexRSI

Momentum oscillator · Range: 0 – 100

Developed by J. Welles Wilder Jr. in 1978, RSI measures the magnitude and velocity of recent price changes to evaluate overbought or oversold conditions. It oscillates between 0 and 100 and is typically applied with a 14-period window.

Formula

// Step 1 — price changes ΔClose[t] = Close[t] − Close[t-1] Gain[t] = max(ΔClose[t], 0) Loss[t] = max(−ΔClose[t], 0) // Step 2 — Wilder smoothed averages (after seeding with SMA for first window) AvgGain[t] = ( AvgGain[t-1] × (n-1) + Gain[t] ) / n AvgLoss[t] = ( AvgLoss[t-1] × (n-1) + Loss[t] ) / n // Step 3 — RSI RS = AvgGain / AvgLoss RSI = 100 − ( 100 / (1 + RS) )

API Endpoint

GET /api/v1/indicator/rsi?apiKey=YOUR_API_KEY&SymbolCode=AAPL&TimeFrame=D1&Period=14

RSI Zones

RSI ValueZoneInterpretation
70 – 100OverboughtAsset may be overextended; momentum could reverse downward
50 – 69Bullish zoneBullish momentum dominant; trend is upward
31 – 49Bearish zoneBearish momentum dominant; trend is downward
0 – 30OversoldAsset may be undervalued; potential bounce or reversal
50MidlineCrossover of midline signals potential trend shift

Signal Interpretation

bearishRSI > 70 — overbought; consider tightening stops or waiting for reversal confirmation
bullishRSI < 30 — oversold; watch for bullish reversal, especially with candlestick confirmation
bullishRSI crosses above 50 from below — momentum shifted bullish
bearishRSI crosses below 50 from above — momentum shifted bearish
bearishBearish divergence: price makes new high but RSI doesn't — hidden weakness
bullishBullish divergence: price makes new low but RSI doesn't — hidden strength
neutralRSI trending around 40–60 for extended periods — sideways / low-volatility environment

Code Example

rsi.js
const BASE    = "https://api.realmarketapi.com"
const API_KEY = "YOUR_API_KEY"
const PERIOD  = 14

const url = new URL("/api/v1/indicator/rsi", BASE)
url.searchParams.set("apiKey", API_KEY)
url.searchParams.set("SymbolCode", "XAUUSD")
url.searchParams.set("TimeFrame", "H1")
url.searchParams.set("Period", String(PERIOD))

const res = await fetch(url.toString())
if (!res.ok) throw new Error("Request failed: " + res.status)

const data = await res.json()
console.log("RSI API response:", data)
SR

Support & ResistanceServer-computed API

Price structure · Key levels · Requires Pro+

The Support & Resistance endpoint returns server-computed key price levels directly. Like the SMA/EMA/RSI/MACD indicator APIs, it analyses historical candle data to identify price zones where buyers (support) or sellers (resistance) have repeatedly stepped in, ranked by touch count.

🟢Support

A price floor. Bulls have historically defended this level. The higher the touch count, the stronger the zone.

🔎Resistance

A price ceiling. Bears have historically sold at or near this level. Multiple rejections = strong resistance.

📊Touch Count

How many times price has tested a level. Higher counts indicate institutional memory and greater reliability.

⏰Last Touched

Recency matters. A level tested last week is more relevant than one tested 6 months ago.

Endpoint

GET /api/v1/indicator/support-resistance?apiKey=YOUR_API_KEY&symbolCode=XAUUSD&timeFrame=H1
🔒 Requires Pro plan or above. This endpoint computes levels from historical candle data. The Free plan does not include historical data access and will receive a 403 response. View plans →

Response Structure

response.json
{
  "SymbolCode": "XAUUSD",
  "TimeFrame":  "H1",
  "Supports": [
    { "Price": 3182.50, "TouchCount": 4, "LastTouchedAt": "2026-03-15T10:00:00Z" },
    { "Price": 3155.00, "TouchCount": 3, "LastTouchedAt": "2026-03-14T14:00:00Z" }
  ],
  "Resistances": [
    { "Price": 3245.00, "TouchCount": 5, "LastTouchedAt": "2026-03-15T17:00:00Z" },
    { "Price": 3280.75, "TouchCount": 2, "LastTouchedAt": "2026-03-12T08:00:00Z" }
  ]
}

Signal Interpretation

bullishPrice approaching a support level with high TouchCount — potential bounce zone; look for bullish confirmation candles
bearishPrice approaching a resistance level with high TouchCount — potential reversal zone; consider tightening stops on longs
bullishPrice closes above a resistance level — resistance has been broken and may now act as new support
bearishPrice closes below a support level — support has been broken and may now act as new resistance
neutralLevels with low TouchCount (1–2) are weaker and less reliable — use only with strong additional confluence
neutralCombine SR levels with RSI (overbought/oversold) and EMA slope for high-probability entries

Code Example

support-resistance.js
const res = await fetch(
  "https://api.realmarketapi.com/api/v1/indicator/support-resistance?apiKey=YOUR_API_KEY&symbolCode=XAUUSD&timeFrame=H1"
)
const { Supports, Resistances } = await res.json()

// Nearest support below current price
const currentPrice = 3210.00
const nearestSupport = Supports
  .filter(s => s.Price < currentPrice)
  .sort((a, b) => b.Price - a.Price)[0]

// Nearest resistance above current price
const nearestResistance = Resistances
  .filter(r => r.Price > currentPrice)
  .sort((a, b) => a.Price - b.Price)[0]

console.log(`Nearest support:    ${nearestSupport?.Price}  (×${nearestSupport?.TouchCount} touches)`)
console.log(`Nearest resistance: ${nearestResistance?.Price}  (×${nearestResistance?.TouchCount} touches)`)
▶

Try it live in the Playground

Run a live /api/v1/indicator/support-resistance request with your API key — see the real response instantly in your browser.

Open Playground

Combining Indicators

No single indicator is reliable enough to trade in isolation. Effective strategies stack multiple indicators from different categories — trend, momentum, and oscillator — to get confluent signals that dramatically improve signal quality.

🔗

EMA + RSI — Trend Continuation

  1. 1Filter direction: price above EMA-50 = only look for longs
  2. 2Wait for RSI to dip into 40–50 (pullback without going oversold)
  3. 3Enter when RSI starts rising back above 50
  4. 4Stop below EMA-50; target previous high
🔀

MACD + RSI — Reversal Entry

  1. 1Identify RSI < 30 (oversold) or RSI > 70 (overbought)
  2. 2Wait for MACD histogram to start shrinking (momentum fading)
  3. 3Enter on MACD line × Signal line crossover
  4. 4Tight stop beyond the recent swing; RSI returning to 50 as target zone
✖

SMA Golden/Death Cross

  1. 1Plot SMA-50 and SMA-200 on D1 timeframe
  2. 2Golden Cross (50 > 200): long-term bull — buy dips above SMA-50
  3. 3Death Cross (50 < 200): long-term bear — sell rallies below SMA-50
  4. 4Confirm regime shift with MACD above/below zero
📐

MACD Divergence + EMA Slope

  1. 1Observe price making new lows while MACD histogram shrinks (bullish divergence)
  2. 2Confirm EMA-20 slope is flattening or turning up
  3. 3Enter on EMA-9/21 bullish crossover for timing
  4. 4Invalidate if price breaks the previous swing low

Minimum Data Requirements

candle-requirements.json
{
  "SMA-20":   { "minCandles": 20,  "endpoint": "GET /api/v1/history", "pageSize": 50  },
  "EMA-26":   { "minCandles": 52,  "endpoint": "GET /api/v1/history", "pageSize": 100 },
  "MACD":     { "minCandles": 70,  "endpoint": "GET /api/v1/history", "pageSize": 150 },
  "RSI-14":   { "minCandles": 30,  "endpoint": "GET /api/v1/history", "pageSize": 50  },
  "All four": { "minCandles": 70,  "endpoint": "GET /api/v1/history", "pageSize": 200 }
}