The solution is to use IndicatorModifiable object instead of Indicator. It supports two additional methods:
Code: Select all
void addPoint(long timestamp, double value);
void clear(long fromTimestamp, long toTimestamp);
Javadoc
In general, the above and similar information can be found in the API javadoc. Notice the first two items there: AllDataModule, and Api. This is essentially the entire API for addons. The AllDataModule page describes what interfaces your addon can implement to receive the data that it needs. The Api page describes how your addon can call the API. For instance, to create an object of IndicatorModifiable
Code: Select all
@Override
public void initialize(String alias, InstrumentInfo info, Api api, InitialState initialState) {
double initialValue = 0;
IndicatorModifiable line = api.registerIndicatorModifiable("My indicator", GraphType.PRIMARY, initialValue);
}