Apama 10.3.1 | Apama Documentation | 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 scenario variable or DataView field as the timestamp. If you use apama.timestamp, you need to design the scenario or 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 scenario, 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 scenario variable or 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 scenario or DataView needs to set the value of each in the scope of a single rule. Following is an example of this in an Event Modeler rule.
Here local variables _open, _high, _low, and _close are used throughout the scenario 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 scenario variable or 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 scenario or DataView needs to set the value of each in the scope of a single rule. Following is an example of this in an Event Modeler rule.
Here local variables _open, _high, _low, and _close are used throughout the scenario 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.

Copyright © 2013-2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.