Where plotshape() and plotchar() place a marker: above or below the bar, at the top or bottom of the pane, or at an absolute price.
location.* constants go in the location argument of plotshape and plotchar. location.abovebar and location.belowbar attach the marker to the bar's high or low, so it follows price. location.top and location.bottom pin it to the edge of the pane, which suits signals in a separate indicator pane. location.absolute puts it at the value of the plotted series itself.
With location.abovebar, location.belowbar, location.top and location.bottom the marker's vertical position ignores the series value; only whether the series is true matters. With location.absolute the series value is the price.
Constants
| Name | Value | Description |
|---|---|---|
location.abovebar | Above the bar's high; the default. | |
location.absolute | At the price given by the plotted series. | |
location.belowbar | Below the bar's low. | |
location.bottom | Pinned to the bottom edge of the pane. | |
location.top | Pinned to the top edge of the pane. |
Remarks
location.abovebaris the default.- Use
location.absolutewhen you want to mark a specific level, such as the exact price of a signal.
Example
//@version=6
indicator("Locations", overlay = true)
hi = ta.highest(high, 20)
lo = ta.lowest(low, 20)
plotshape(high == hi, "New high", shape.arrowdown, location.abovebar, color.red)
plotshape(low == lo, "New low", shape.arrowup, location.belowbar, color.green)
plotshape(hi, "Top level", shape.circle, location.absolute, color.new(color.gray, 60), size = size.tiny)See also
Runs on Sidechair