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
Limiting what is drawn
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
Linelimited to the session. - Color the box by whether the session closed above or below its open.