Previous Day/Week High and Low
Category: Market Structure
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.
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
exchange | string | Yes | — | Exchange identifier, e.g. binance, bybit. |
symbol | string | Yes | — | Trading pair, e.g. BTCUSDT. |
timeframe | string | Yes | — | Candle interval: 1m, 5m, 15m, 1h, 4h, 1d, 1w. |
results | integer | No | 1 | Number of historical values. Use max for all available. |
backtrack | integer | No | 0 | Candles to skip from most recent. |
Indicator parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
period | string | No | day | `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. |
session | string | No | regular | US 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. |
market | string | No | crypto | Only 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.
{
"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.
| Field | Description |
|---|---|
prevHigh, prevLow, prevOpen, prevClose | Levels of the previous day or week (null until a full previous period is available) |
prevStart | Timestamp of the first candle of the previous period |
currentHigh, currentLow | High and low of the current day or week so far |
premarketHigh, premarketLow | US stocks with period=day: today's 04:00-09:30 pre-market levels (null for crypto) |
position | Close against the previous range: above, below or inside |
brokeHigh, brokeLow | true once the current period has traded beyond the previous high or low |
Errors
{
"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.
{ "pending": true, "key": "ta:binance:BTCUSDT:1h:prevhl:..." }{ "error": "Missing required: exchange, symbol, timeframe" }{ "error": "Invalid or missing API key." }{ "error": "Rate limit exceeded. Your plan allows 30 requests per 15 seconds." }