Skip to main content
An indicator draws through the chart API: it creates an area, series and annotations, and then works with the interfaces of VolumetricaCore (IChartSeries, IChartPoint, IAnnotation, IAnnGroup, IAxis), which are the same as in Deepchart. Their members are listed in Drawing interfaces.

Chart areas

An indicator whose values are not prices (a volume, a percentage) draws in an area of its own, created in OnSet:
CreateCA(isVertical, description) creates the area and keeps its reference in CA; its height is CASize, which the user can change. ChartAreaRef.Main is the price area. Vbk.GetAxisX(area) and Vbk.GetAxisY(area) give the axes of any area, including the main one, as IAxis: set their options after creating the area. The chart is rebuilt at every load: OnSet creates the area every time, after the setDefault check.

Series

A series draws one point per bar: a line, a histogram, a marker. It is created in OnSet, right after the area:
Add one point for every bar, in OnOpen, hidden until it has a value:
The point of index i belongs to the bar of index i. Keep this true: add a point for every bar. Then set the value where you calculate it:

Annotations

An annotation is a shape or a text placed anywhere: a level, a box, a label. Annotations are kept in groups: create a group in OnLoad, then create each annotation, set it and add it to the group. From then on it is drawn.
Common types: Line, Rectangle, Text, HorizontalLine, VerticalLine, Ellipse, Circle, Diamond, Triangle. 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 of the area.
  • Y, Y2 are prices in the main area, values of the axis in the area of the indicator.
  • 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.
Other coordinate types, set with CoordinateXType and CoordinateYType:

Which area

Set Area on the group and on every annotation: ChartAreaRef.Main for the price area, CA.Value for the area of the indicator. A group with PlotForeground = true is drawn, with everything it contains, over the bars and the other indicators.

Lines extended to the right

A HorizontalLine with IsExtended goes from X to the right edge of the chart, whatever the user scrolls:

Tooltip

The chart builds the tooltip of a bar from a line of each indicator. Answer only for your area, and return null when there is nothing to say:

Performance

Annotations which change often are cheap: only what changed is redrawn. What costs is their number. When an indicator creates annotations for every trade, remove the old ones, as the Big Trade Marker example does.