The function setResult In indicator.ts will export wrong value while the 'replace' parameter is true, beacuse 'this.previousResult' always replaced by 'this.result'. it should not be replaced if 'replace' parameter is true
protected setResult(value: number, replace: boolean = false): number {
if (replace && this.previousHighest !== undefined) {
this.highest = value > this.previousHighest ? value : this.previousHighest;
} else if (this.highest === undefined || value > this.highest) {
this.previousHighest = this.highest;
this.highest = value;
}
if (replace && this.previousLowest) {
this.lowest = value < this.previousLowest ? value : this.previousLowest;
} else if (this.lowest === undefined || value < this.lowest) {
this.previousLowest = this.lowest;
this.lowest = value;
}
this.previousResult = this.result;
return (this.result = value);
}
The function setResult In indicator.ts will export wrong value while the 'replace' parameter is true, beacuse 'this.previousResult' always replaced by 'this.result'. it should not be replaced if 'replace' parameter is true
Fixed it by