label.style_labeldown
The constant is label.style_label_down — with an underscore between "label" and "down".
Quick answer
label.style_labeldown is a typo — the real constant is label.style_label_down, with an underscore between label and down. Pine's label style constants follow the pattern label.style_label_<direction>, so the four directional ones are label.style_label_up, label.style_label_down, label.style_label_left and label.style_label_right. Any spelling without that second underscore fails with "Undeclared identifier". The same trap catches label.style_labelup, which should be label.style_label_up.
The exact error
v5 → v6
The correct constant label.style_label_down exists in v4, v5 and v6 unchanged. This is a spelling error, not a version difference — nothing was renamed between versions.
Why this happens
Pine's label styles come in two families, and mixing them up is what causes the typo. The directional labels are named label.style_label_up, label.style_label_down, label.style_label_left and label.style_label_right — note the word label appears twice.
The shape styles drop the second label entirely: label.style_circle, label.style_square, label.style_diamond, label.style_cross, label.style_xcross, label.style_flag, label.style_triangleup, label.style_triangledown, label.style_arrowup, label.style_arrowdown, and label.style_none.
Because the shape family reads as label.style_<thing>, it is natural to assume the directional family is label.style_labeldown. It is not — the directional family keeps label as a separate word.
There is also label.style_text_outline for an outlined text label with no marker.
Autocomplete in the Pine Editor will confirm the exact spelling: type label.style_ and it lists every valid constant.
What actually works
//@version=6//@version=6
indicator("Label styles that actually compile", overlay = true)
pivotHigh = ta.pivothigh(high, 5, 5)
pivotLow = ta.pivotlow(low, 5, 5)
// WRONG - Undeclared identifier "label.style_labeldown"
// label.new(bar_index, high, "High", style = label.style_labeldown)
// RIGHT - the directional constants keep "label" as a separate word.
if not na(pivotHigh)
label.new(bar_index[5], high[5], "High",
style = label.style_label_down,
color = color.red,
textcolor = color.white,
size = size.small)
if not na(pivotLow)
label.new(bar_index[5], low[5], "Low",
style = label.style_label_up,
color = color.green,
textcolor = color.white,
size = size.small)Copy and paste into the TradingView Pine Editor, or let TradePilot adapt it to your exact case.
FAQ
label.style_labeldown — common questions
Why does label.style_labeldown give an undeclared identifier error?
Because that constant does not exist. The correct spelling is label.style_label_down, with an underscore between label and down. Pine's directional label styles are label.style_label_up, label.style_label_down, label.style_label_left and label.style_label_right.
What are all the valid Pine Script label styles?
Directional: label.style_label_up, label.style_label_down, label.style_label_left, label.style_label_right. Shapes: label.style_circle, label.style_square, label.style_diamond, label.style_cross, label.style_xcross, label.style_flag, label.style_triangleup, label.style_triangledown, label.style_arrowup, label.style_arrowdown. Plus label.style_none and label.style_text_outline.
Did label styles change between Pine Script v5 and v6?
No. label.style_label_down is spelled the same way in v4, v5 and v6. If you are hitting this error it is a typo, not a migration problem.
More Pine reference
Other functions and errors
math.clamp
"math.clamp" is not a real Pine Script function — here is the exact error and the fix.
ta.dmi
The exact fix for "Cannot use the history-referencing operator" on ta.dmi().
ta.rma2 / ta.dema2 / ta.tema2
"ta.rma2", "ta.dema2" and "ta.tema2" are not real Pine functions — here is what actually works.
Never hit this error again.
TradePilot writes Pine Script v6 that's verified to compile before it reaches you — and if your existing script has this error, Pine Studio fixes it, root cause and all, in one pass. Start with 7 days free on any plan; cancel any time before it ends.
7-day free trial · Cancel anytime · No charge until day 7