• Get $30 off VIP with code SUMMER30. Ends July 27. Happy trading!

Conditional AddLabel Statement


Howdy and good afternoon/am,

I am trying to have conditional label set and I keep getting error invalid statement. I am defining cahold and cbhold with no problem but when i want to ocnditionally show the labels and colors, is where I'm getting the errors:

addLabel(yes, if cahold then "CA" then color.dark_green else if cblohd then "CB" then color.dark_red else color.gray);


Well-known member
The conditional should be where you currently have "yes" if you want to conditionally display the label...

AddLabel() uses the following parameters... You can have conditions for display as well as your colors...

AddLabel( boolean visible, Any text, CustomColor color)
Last edited:

Similar threads