box
Draw a price zone between two bars. Use inside when.
box top, bottom from N bars ago [for N bars | extend right | until touched] [keep N] as "Title" color
Top and bottom are prices, read on the bar the rule fires; their order does not matter. The left edge is from N bars ago (default: that bar). The right edge is the same bar, unless: for N bars ends it N bars later, extend right keeps it growing with new bars, and until touched ends it on the first later bar whose high-low range reaches the zone (an untouched zone keeps growing). Outside a when, the box is drawn once, on the last bar. Each box statement keeps its newest 50 boxes; keep N (1 to 500) changes that. Without a color the box is blue. box stays usable as a variable name.
Return value
—
Note
- N in from and for can be an expression, for example barssince(...). It is rounded to whole bars.
Example
// Bullish fair-value gap, until price comes back into it when low > high[2] box low, high[2] from 2 bars ago until touched as "FVG" green