VAn is the object an indicator uses to read the chart and to create points and annotations. Its type is IMethodCloudAPI, which extends IMethodAPI. Members marked desktop are [DesktopOnly].
Drawing
Bars
Symbol and chart
Prices
Calculation
Other data
Messages
Shared values
An indicator can make named values available to the other indicators of the chart, bar by bar. It registers inOnInit and writes with its own IndVars; the others read by the id it registered with. A value is a number or a text.
- Order. The indicators are calculated in the order of the chart. The value of the bar being calculated is there only when the indicator which writes it comes before the one which reads it.
- Recalculation. The values are emptied every time the indicator which shares them is calculated again, right before its
OnLoad. The indicators which read them are not calculated again with it. - Same id. When two indicators register with the same id, the first one of the chart keeps it and the other shares nothing: give each its own id.
Levels touched by the price
CreateAnnInteractionManager follows horizontal levels, usually extended to the right, and ends each one when the price touches it. The line stops at the bar of the touch (X2), IsExtended and ShowPrice become false, and onTrigger is called with the annotation (null: nothing to call). It works on the desktop and on the server.
Context menu
An indicator can add its own items to the menu the user opens with a right click on the chart. OverrideOnContextMenu and add the items there with VAn.AddMenuItem: they are shown in a submenu with the name of the indicator.
- Area.
area == ChartAreawhen the user clicks the area of the indicator, also when it is the main area of the chart;area == ChartAreaRef.Mainwhen the main area is clicked and the indicator is in another one;nullfor any other area. - Every right click. The menu is built again every time it opens, so add the items every time, enabled or not by what is true at that moment.
- After a click the chart is loaded again. Set
NeedRecalculatewhen the indicator has to be calculated again. - Errors. An exception in
OnContextMenuor in a click stops the indicator, as in its other methods.