Skip to main content
On this page

Pine Script Bid and Ask: 1-Tick Spread Data and Limits

· 5 min read
Pineify Team
Pine Script and AI trading workflow research team

Pine Script's bid and ask variables expose quoted prices on the 1T timeframe. On other chart timeframes, the variables return na. Use them with explicit checks for missing data; do not interpret a missing quote as a zero spread or assume it is the executable quote for your connected broker account.

What bid and ask represent​

The bid is the highest quoted buying price and the ask is the lowest quoted selling price. Their difference is the quoted spread. It is not universally "the broker's cut": the quote can reflect a venue's order book or a provider's pricing, and other execution costs may apply.

TradingView introduced these variables in its February 2025 Pine release notes. The chart-information documentation specifies their 1T availability. This article uses that direct chart context rather than promising a request.security workaround on every timeframe.

A minimal spread monitor​

This example reads the current chart's quotes and converts the spread into minimum price increments. It deliberately uses ticks rather than assuming that every symbol has the same pip size or dollar value.

//@version=6
indicator("1T Quoted Spread Monitor", overlay=false)
maxSpreadTicks = input.float(5.0, "Highlight above spread (ticks)", minval=0.0)
isOneTick = timeframe.period == "1T"
quotesAvailable = isOneTick and not na(bid) and not na(ask) and ask >= bid
spreadPrice = quotesAvailable ? ask - bid : na
spreadTicks = quotesAvailable ? spreadPrice / syminfo.mintick : na
plot(spreadTicks, "Quoted spread in ticks", color=color.blue, linewidth=2)
hline(0, "Zero", color=color.gray)
bgcolor(quotesAvailable and spreadTicks > maxSpreadTicks ? color.new(color.red, 85) : na)
var table status = table.new(position.top_right, 1, 1)
if barstate.islast
statusText = not isOneTick ? "Select a 1T chart" : not quotesAvailable ? "Bid/ask unavailable" : "Spread: " + str.tostring(spreadTicks, "#.##") + " ticks"
table.cell(status, 0, 0, statusText, text_color=color.white, bgcolor=color.gray)

The five-tick input is an illustrative display threshold, not a trading recommendation. The script leaves unavailable or crossed quotes missing and accepts a zero quoted spread when bid equals ask. It does not replace absent quotes with the bar's high and low.

Check availability before interpreting the plot​

Select a supported symbol and a 1T interval, then inspect the status message during market activity. Tick-chart access, symbol coverage, data permissions, and quote availability are separate questions. A Pineify subscription does not grant TradingView market-data entitlements or broker execution rights.

TradingView's tick-interval guide lists unsupported instruments and platform restrictions. It currently states that server-side alerts, Bar Replay, and deep backtesting are unavailable on tick-based intervals. Consequently, this example is a chart monitor, not a promised server-side spread-alert system.

A displayed value is an observation from the chart's data context. It does not prove that your order can execute at that price or size. Check the execution venue's quote, available size, and costs separately.

Keep ticks, pips, and money separate​

A tick here means syminfo.mintick, the symbol's minimum price increment. A forex pip is a market convention and is not universally ten minimum ticks. Converting a spread into account-currency cost also requires the instrument's contract size, position size, and any currency conversion.

As a hypothetical arithmetic example, a three-pip spread divided by a twenty-pip target distance is 15%. That ratio compares two distances; it is not a measured reduction in realized profit, which also depends on entry and exit execution and other costs.

Why high minus low is not a spread estimate​

A bar's high and low summarize traded or chart prices over a period. Bid and ask describe opposing quotes at a particular observation. A wide bar can coexist with a narrow spread, and a quiet bar can coexist with a wide spread. Label a high-low calculation as a price range, not as recovered bid/ask data.

Do not assume a live quote monitor creates a complete historical spread dataset. A backtest requiring quote-level costs needs suitable historical bid/ask observations and a documented execution model. An OHLC-only test cannot recover those observations from candle ranges.

Frequently asked questions​

Why are bid and ask missing on my chart?

Their documented chart context is 1T. Check the interval, symbol support, data access, and actual quote availability; do not replace missing values with zero.

Must I connect a specific broker?

The documented Pine variables refer to the chart's quote data. This guide does not establish a universal broker-login requirement or a verified list of supported broker accounts.

Can this example send spread alerts from a tick chart?

TradingView currently documents that server-side alerts are unavailable on tick-based intervals. The example therefore provides a visual monitor only.

Can candle high and low replace missing bid and ask?

No. They measure a bar's price range and do not reconstruct its quoted spread.

Browse the Pineify resources hub for related Pine Script guides.