Parameters
Every public property of the indicator with a getter and a setter is a parameter. Deepdom shows it in the settings window and saves it with the workspace.
Three attributes control how a parameter appears:
[Category("General")]fromSystem.ComponentModelputs it in a section.[DisplayName("Minimum volume")]gives it a label. Without it, the name of the property is used.[VolCustom(...)]fromVolumetricaControlssets the order and the limits.
A property without a public setter is not a parameter, and fields are never parameters: keep the state of the calculation in fields.
The names of the properties are what the workspace saves. Renaming a property loses the value the user saved for it.
OnSet. When the user changes one, the chart calls OnSet again and loads the indicator again, so the calculation never has to watch for changes.
Colors
Colors are of typeColorRef, from VolumetricaAPI.Chart. A color parameter, the color of a series, of a point or of an annotation: every color is a ColorRef. The Color type of WPF is not available to an indicator.
Theme colors
Deepdom has a light and a dark theme, and each has its own green, red, bid and ask. A theme color is a reference the chart resolves with the theme of the user, so the indicator looks right on every theme. Use theme colors as the defaults of the color parameters:ColorReferenceEnum says what the color means (Ask, Bid, Up, Down, Neutral, Volume, Container, Border), ColorTypeEnum what it is used for (Stroke, Fill, Text). Both are in VolBookAPI.Structure. The chart gives these references the color of the current theme before every OnSet: the indicator just uses the property.
Alerts
An indicator can warn the user with a message, a sound or a spoken text:- Call them only in realtime. Every calculation method receives
isRt: during the history it isfalse, and an alert there would fire once for every past event. - Fire once per event. A condition which stays true is evaluated again at every update: remember that you already alerted for it.