Skip to main content
An annotation is a shape or a text placed on the chart: a box around a session, a horizontal level, a label. Unlike a series, it is not tied to one bar.

Creating an annotation

Create it, set it, add it to a group. From then on it is drawn.
Common types: Line, Rectangle, Text, HorizontalLine, VerticalLine, HorizontalRay, Ellipse, Triangle, ArrowUp, ArrowDown, Diamond. To change an annotation later, set its properties again. To remove it, call group.RemoveAnnotation(annotation).

Coordinates

By default the coordinates are absolute: a bar and a value of the Y axis.
  • Y, Y2 are prices (or values of the area the annotation is in).
  • X, X2 are positions on the bars: the bar of index i is at i + 1. A bar is one unit wide, from i + 0.5 to i + 1.5. A value beyond the last bar is in the future.
Other coordinate types, set with CoordinateXType and CoordinateYType:

Groups

Annotations are kept in groups. The indicator has two of its own: A group holds either annotations or other groups, not both. For a few annotations, add them directly to IndVars.Ann_List. When you have different kinds, create one group per kind:
The chart empties the groups of the indicator before every calculation, so create your groups and your fixed annotations in OnLoad.

Which area

An annotation is drawn in the main area of the chart (the price) unless you say otherwise:

Text

Performance

Annotations which change often are cheap: only what changed is redrawn or sent. What costs is their number. When an indicator creates annotations for every bar, remove the old ones or limit how many sessions it draws, as the Session Range Box example does.