🔍

Previous Day/Week High and Low (PDH/PDL) returns the previous day's or week's high, low, open and close, the current period's running high and low, and whether price is above, below or inside the previous range. For US stocks, levels use the regular 09:30-16:00 New York session by default and also return today's pre-market high and low; crypto uses UTC days. Works on intraday timeframes down to 1m.

Common parameters

All indicator requests share these parameters. See Single Indicator for details.

NameTypeRequiredDefaultDescription
exchangestringYes—Exchange identifier, e.g. binance, bybit.
symbolstringYes—Trading pair, e.g. BTCUSDT.
timeframestringYes—Candle interval: 1m, 5m, 15m, 1h, 4h, 1d, 1w.
resultsintegerNo1Number of historical values. Use max for all available.
backtrackintegerNo0Candles to skip from most recent.

Indicator parameters

NameTypeRequiredDefaultDescription
periodstringNoday`day` (previous day high/low) or `week` (previous week high/low). Stocks follow the New York calendar, crypto uses UTC days and Monday 00:00 UTC weeks.
sessionstringNoregularUS stocks only: `regular` builds levels from the 09:30-16:00 New York session (13:00 on early-close days), `extended` from 04:00-20:00 including pre-market and after-hours.
marketstringNocryptoOnly for POST with your own candles, which carry no exchange: `stocks` to apply US stock sessions, otherwise `crypto`.

Example

curl -G https://v2.taapi.io/indicator/prevhl \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "exchange=binance" \
  --data-urlencode "symbol=BTCUSDT" \
  --data-urlencode "timeframe=1h" \
  --data-urlencode "period=day" \
  --data-urlencode "session=regular" \
  --data-urlencode "market=crypto"
const res = await fetch(
  'https://v2.taapi.io/indicator/prevhl?exchange=binance&symbol=BTCUSDT&timeframe=1h',
  { headers: { Authorization: 'Bearer YOUR_API_KEY' } }
);
const data = await res.json();
import requests

resp = requests.get(
    'https://v2.taapi.io/indicator/prevhl',
    headers={'Authorization': 'Bearer YOUR_API_KEY'},
    params={'exchange': 'binance', 'symbol': 'BTCUSDT', 'timeframe': '1h'}
)
print(resp.json())

Response

Results are always wrapped in arrays, even when only one value is returned.

200 OK
{
  "prevHigh": [349.163],
  "prevLow": [342.383],
  "prevOpen": [346.655],
  "prevClose": [344.819],
  "prevStart": [1793367000],
  "currentHigh": [null],
  "currentLow": [null],
  "premarketHigh": [344.843],
  "premarketLow": [342.795],
  "position": ["inside"],
  "brokeHigh": [false],
  "brokeLow": [false],
  "timestamp": [1793620200]
}

Example: exchange=stocks&symbol=AAPL&timeframe=1m during Monday's pre-market. The previous day is Friday's regular session; the current day has no regular-session levels yet, so currentHigh and currentLow are null, while today's pre-market levels are already set.

Days and weeks. US stocks follow the New York calendar. With session=regular (default) the levels come from the 09:30-16:00 session only (13:00 on NYSE early-close days); session=extended uses 04:00-20:00, including pre-market and after-hours. Crypto uses UTC days and weeks starting Monday 00:00 UTC, matching the exchanges' daily and weekly candles. Holidays and weekends are skipped: the previous day is the last day with trading.

Timeframes. Works down to 1m: TAAPI fetches a longer candle series behind the scenes, so the previous day or week is always in reach. For stocks, use 1m, 5m or 15m (longer candles would mix pre-market and regular trading). period=day needs a timeframe of 1d or shorter.

Values never repaint. currentHigh, currentLow and the break flags include the still-forming candle; add backtrack=1 for closed candles only. With POST and your own candles, pass market=stocks to apply US stock sessions.

FieldDescription
prevHigh, prevLow, prevOpen, prevCloseLevels of the previous day or week (null until a full previous period is available)
prevStartTimestamp of the first candle of the previous period
currentHigh, currentLowHigh and low of the current day or week so far
premarketHigh, premarketLowUS stocks with period=day: today's 04:00-09:30 pre-market levels (null for crypto)
positionClose against the previous range: above, below or inside
brokeHigh, brokeLowtrue once the current period has traded beyond the previous high or low

Errors

Response
{
  "prevHigh": [349.163],
  "prevLow": [342.383],
  "prevOpen": [346.655],
  "prevClose": [344.819],
  "prevStart": [1793367000],
  "currentHigh": [null],
  "currentLow": [null],
  "premarketHigh": [344.843],
  "premarketLow": [342.795],
  "position": ["inside"],
  "brokeHigh": [false],
  "brokeLow": [false],
  "timestamp": [1793620200]
}

Data is being fetched. Retry after 1–2 seconds.

Response
{ "pending": true, "key": "ta:binance:BTCUSDT:1h:prevhl:..." }
Response
{ "error": "Missing required: exchange, symbol, timeframe" }
Response
{ "error": "Invalid or missing API key." }
Response
{ "error": "Rate limit exceeded. Your plan allows 30 requests per 15 seconds." }

← Back to Indicators Directory