igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
62 lines (61 loc) • 2.51 kB
JavaScript
/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { StreamingIndicatorCalculationStrategy } from "./StreamingIndicatorCalculationStrategy";
import { String_$type, fromEnum, toEnum, markType } from "igniteui-react-core";
import { List$1 } from "igniteui-react-core";
/**
* @hidden
*/
export let RelativeStrengthIndexIndicatorStrategy = /*@__PURE__*/ (() => {
class RelativeStrengthIndexIndicatorStrategy extends StreamingIndicatorCalculationStrategy {
b(a, b) {
let c = new List$1(String_$type, 0);
c.add("CloseColumn");
return c;
}
a(a, b) {
let c = 0;
for (let d of fromEnum(this.c(a, b))) {
a.indicatorColumn.item(c, d);
c++;
}
return true;
}
*_c(a, b) {
let c = a.period;
let d = 2 / (c + 1);
let e = 0;
let f = 0;
let g = a.indicatorColumn;
let h = a.closeColumn;
if (g.count > 0) {
yield 0;
}
for (let i = 1; i < Math.min(a.period, g.count); ++i) {
let j = h.item(i) - h.item(i - 1);
let k = j > 0 ? j : 0;
let l = j > 0 ? 0 : -j;
e += k / (c - 1);
f += l / (c - 1);
yield 0;
}
for (let m = a.period; m < g.count; ++m) {
let n = h.item(m) - h.item(m - 1);
let o = n > 0 ? n : 0;
let p = n > 0 ? 0 : -n;
e = (e * (c - 1) + o) / c;
f = (f * (c - 1) + p) / c;
yield b.i(e != 0 ? 100 * e / (e + f) : 0);
}
}
c(a, b) {
return toEnum(() => this._c(a, b));
}
}
RelativeStrengthIndexIndicatorStrategy.$t = /*@__PURE__*/ markType(RelativeStrengthIndexIndicatorStrategy, 'RelativeStrengthIndexIndicatorStrategy', StreamingIndicatorCalculationStrategy.$);
return RelativeStrengthIndexIndicatorStrategy;
})();