Page 1 of 1

Indicator recalculation

Posted: Tue Feb 16, 2021 1:11 pm
by DGDario
Hi,
I've developed an indicator that has a parameter configurable.
The only way to recalculate the past when the parameter's configuration changes is saving the data at every interval?

Re: Indicator recalculation

Posted: Tue Feb 16, 2021 2:47 pm
by Andry API support
Hi,
If you are using Simplified API you need to call reload() method of your Api object on a parameter change.

Code: Select all

private Api api;

@Override
public void initialize(String alias, InstrumentInfo info, Api api, InitialState initialState) {
    this.api = api;

Code: Select all

//on settings updated
    api.reload();
If you are using Core API you need to call the invalidate() method of the InvalidateInterface object associated with your indicator.

Re: Indicator recalculation

Posted: Wed Feb 17, 2021 9:14 am
by DGDario
I've tryed with the api.reload() but it doesn't recalculate the indicator for the past data

Check the image:
https://ibb.co/30QHw9P

Re: Indicator recalculation

Posted: Wed Feb 17, 2021 10:36 am
by Andry API support
Does you module implement HistoricalDataListener or HistoricalModeListener?

Re: Indicator recalculation

Posted: Wed Feb 17, 2021 5:49 pm
by DGDario
Implementing HistoricalDataListener works! thank you Andrey