ask - PineScript Variable
Overview
Section titled “Overview”ask returns the lowest price an active seller is willing to accept at the moment of the current tick. The series is only populated on tick charts ("1T"); on higher timeframes it yields na.
Remarks
Section titled “Remarks”- Values update only when a new tick arrives. Quote changes without trades are not reflected.
- Because the series is
naoutside tick charts, guard calculations withnot na(ask)or provide fallbacks. - Pair with
bidto compute spreads or monitor quote depth changes.
Example
Section titled “Example”//@version=5indicator("Bid-ask spread monitor", overlay=false)
spread = not na(ask) and not na(bid) ? ask - bid : na
plot(spread, "Spread", color=color.orange)bgcolor(spread > nz(spread[1]) ? color.new(color.red, 85) : na, title="Expanding spread highlight")