Skip to main content
Source: src/Annotations/SessionRangeBox.cs · Calculated on: desktop or server A box around the high and the low of every session, with its size in ticks written on it.

What it shows

  • Creating annotations and adding them to a group.
  • Absolute coordinates: bars on X, prices on Y.
  • Two groups, one per kind of annotation.
  • Updating the annotation of the session in progress, removing the old ones.

Groups

A group holds annotations or other groups, not both. The boxes and the labels get a group each, inside the group of the indicator:

Placing a box on the bars

The same method is called when the session starts and every time it grows: setting an annotation again is how it is updated.

Limiting what is drawn

Without a limit, a chart with years of history would hold thousands of annotations nobody looks at.

Things to notice

  • A new session is detected with bar.IsNewDay, which follows the session times of the chart.
  • The indicator keeps its own list of sessions and clears it in OnLoad: the chart empties the groups before every calculation, but not your fields.

Try

  • Draw the middle of the range as a Line limited to the session.
  • Color the box by whether the session closed above or below its open.