QTrader
Menu

Long/short ratio

Series details

How many accounts hold longs against how many hold shorts on the market, every hour, as the exchange publishes it.

Source: The exchange you trade on

Markets: perp

Exchanges: Binance, Bybit, Bitget, OKX, Gate, Kraken

Min tf: 1h

Use in workbench

Coverage

First stored dates describe the database, not a guarantee of complete history for every market.

  • Binance · Perpetual futures · 2026-10-01 · 1h and above · Hourly
  • Bybit · Perpetual futures · 2026-10-14 · 1h and above · Hourly
  • Bitget · Perpetual futures · 2026-10-13 · 1h and above · Hourly
  • OKX · Perpetual futures · 2026-10-14 · 1h and above · Hourly
  • Gate · Perpetual futures · 2026-10-14 · 1h and above · Hourly
  • Kraken · Perpetual futures · 2026-10-14 · 1h and above · Hourly

Candle alignment

On hourly and longer code candles, the account long/short ratio uses the final hourly observation inside the candle. It is a ratio of account counts, not a measure of position size or a sum of hourly ratios.

Python example

long_short = market_data.long_short
trend = indicator.ema(close, 50)


# Most accounts short in an uptrend: room for a squeeze.
def enter_long():
    return long_short < 1 and close > trend


def exit_long():
    return long_short > 2
Open in workbench

Pine example

//@version=6
strategy("Against the crowd's longs", initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=0.1)
longShort = market_data.long_short
trend = ta.ema(close, 50)
// Most accounts short in an uptrend: room for a squeeze.
if longShort < 1 and close > trend
    strategy.entry("Long", strategy.long)
if longShort > 2
    strategy.close("Long")
Open in workbench

LLM prompt example

The long/short ratio of accounts is {market_data.long_short.current} (history: {market_data.long_short.full}). When most accounts are long and {candles} stall, expect a flush down; when most are short in an uptrend, a squeeze up.
Open in workbench

Check market support, historical coverage and timeframe alignment before comparing a backtest with current robot inputs. Missing data is not a zero observation.

Data coverage and backtest windows

Reload this page if interactive controls could not load.