AddChartBubble ( boolean time condition , double price location , Any text , CustomColor color , boolean up );
Default values:
color: Color.RED
up: Yes
Description
Adds a bubble with a text to the specified location when the specified condition is true.
Note that you can break down the text into several lines; this can be done using \n
escape sequence (see Example 2 for details).
Input parameters
Parameter | Default value | Description |
---|---|---|
time condition | - | Defines condition upon which the bubble is displayed |
price location | - | Defines price at which the tip of the bubble is displayed |
text | - | Defines text to be displayed in the bubble |
color | Color.RED | Defines color of the bubble |
up | Yes | Defines whether the bubble should be displayed above the price location (otherwise it will be displayed below) |
Example
input timeFrame = {default DAY, "2 DAYS", "3 DAYS", "4 DAYS", WEEK, MONTH, "OPT EXP"};
AddChartBubble(high == high(period = timeFrame), high, "High of " + timeFrame + ": " + high, Color.green, yes);
AddChartBubble(low == low(period = timeFrame), low, "Low of " + timeFrame + ": " + low, Color.green, no);
This example shows bubbles with values and a description on the selected time frame extremums.
Example 2 (Multiline Display)
AddChartBubble(GetYYYYMMDD() != GetYYYYMMDD()[1], high, "O: " + open(period = "DAY") + "\nChg: " + ( open(period = "DAY") - open(period = "DAY")[1] ), Color.PLUM, yes);
This example adds chart bubbles after rollover lines, which display daily Open price and its change since previous day's Open.