Skip to main content
Every public property of the indicator with a getter and a setter is a parameter. Deepchart shows it in the settings window, saves it with the workspace and, for an indicator calculated on the server, sends its value with the request.
The initial value of the property is the default of the parameter.

Supported types

Layout

Three attributes control how a parameter appears:
  • [Category("General")] from System.ComponentModel puts it in a section.
  • [DisplayName("Price source")] gives it a label. Without it, the name of the property is used.
  • [VolCustom(...)] from VolumetricaControls sets the order and the limits.
The most used values of VolCustom:

Nested objects

A parameter can be a class with its own properties. The settings window shows it as a group:
Always give the property an instance as its initial value.

Properties that are not parameters

  • A property without a public setter is not a parameter. The series definitions use this: public ChartSeriesDefinition Average { get; private set; }.
  • 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. A property you remove is ignored when a workspace saved before is loaded.

Reading the parameters

Read them wherever you need: they are set before OnSet. When the user changes one, the chart calls OnSet again and recalculates the indicator, so the calculation never has to watch for changes.

Parameters resolved by the chart

A parameter your code reads changes the calculation: when the user changes it, the indicator is calculated again. A parameter which only changes how something looks does not need that. Declare it with one of these types and assign it as it is:
What you assign is “the parameter LevelWidth”, not its value: the chart of each user resolves it with what that user has set. For an indicator calculated on the server, a change of one of these parameters is applied at once, without a new calculation. Rules:
  • Assign it, do not use it in the calculation. On the server these parameters always hold their default. LevelWidth * 2, LastLevels - 1 and ShowLevels.Value compile, and on the server they give the default. if (ShowLevels) does not compile, on purpose.
  • With a condition, keep the reference: levels.Visible = inRange ? ShowLevels : false;
  • Give it the meaning and the range of what it is assigned to. The chart uses the value of the user as it is: -1 in MaxCountShown is no limit, 100 in WithOpacityScale leaves the opacity as it is. Set MinValue and MaxValue to match.
  • When a flag decides what is calculated, it is a plain bool.
  • Always draw the group. A hidden group is still calculated and sent: that is what makes the switch immediate.
A parameter can become one of these types and keep its name. The values the users saved in their workspaces and templates are still read: an int that becomes a PlotIntRef, a number that becomes a LineWidthRef, a DashStyle that becomes a LineStyleRef, a bool that becomes a PlotBoolRef. What a group does with Visible, PlotForeground and MaxCountShown is in Annotations. The changes of a color bound to a parameter are in Colors.