AddLabel

AddLabel ( boolean visible , Any text , CustomColor color , int location );

Default values:

color: Color.RED location: Location.TOP_LEFT

Description

Adds a text label to the specified location on the chart. Note that you can also use this function to display some text in custom quotes (see example below).

Input parameters

Parameter Default value Description
visible - Defines condition upon which the label is displayed.
text - Defines text to be displayed in the label.
color Color.RED Defines color of the label.
location Location.TOP_LEFT Defines location of the label.

Example

AddLabel(yes, if close > Average(close, 20) then "Uptrend" else "Downtrend", location = Location.TOP_RIGHT);

Displays a label in the top-right corner of the chart with the text "Uptrend" if the close price is greater than its 20-bar average, and "Downtrend" otherwise. If used in Custom Quotes, the words "Uptrend" or "Downtrend" will appear in the quote cell based on the same condition.