Apama 10.15.0 | Building and Using Apama Dashboards | Building Dashboard Clients | Attaching Dashboards to Correlator Data | Using stock charts | Generating OHLC values
 
Generating OHLC values
If you generate OHLC values, you should also use a DataView field as the timestamp. If you use apama.timestamp, you need to design the DataView to generate update events only when the OHLC values change. Your dashboard will add an OHLC data point to a Stock Chart for every Update event it receives. If a DataView, for example, generates Update events in response to other variables changing and apama.timestamp is being used as the timestamp, then spurious OHLC data points will be added to the chart. If the chart were displaying a candlestick this would manifest itself as extra “sticks” appearing in the chart.
If you use a DataView field as the timestamp, data points will only be added to the chart when timestamp and/or OHLC values have changed.
Furthermore, the update of the OHLC values must occur as a whole; that is each Update event must contain the updated value of each of the Open, High, Low, and Close variables. If the update of each variable were to generate a separate Update event, you would also have spurious data points in the chart. This is because your dashboard has no way of knowing if the unchanged values are correct or not.
To update the OHLC variables in a single update event, your DataView needs to set the value of each in the scope of a single rule. For example:
Here local variables _open, _high, _low, and _close are used throughout to calculate the OHLC values. Within this rule, the output variables open, high, low, and close are being set to these values such that a single Update event contains the updated value of each.
If you use a DataView field as the timestamp, data points will only be added to the chart when timestamp and/or OHLC values have changed.
Furthermore, the update of the OHLC values must occur as a whole; that is each Update event must contain the updated value of each of the Open, High, Low, and Close variables. If the update of each variable were to generate a separate Update event, you would also have spurious data points in the chart. This is because your dashboard has no way of knowing if the unchanged values are correct or not.
To update the OHLC variables in a single update event, your DataView needs to set the value of each in the scope of a single rule.