sql-synergy
Version:
Synergy Wave TA
44 lines (43 loc) • 1.37 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Step4 = void 0;
const Analyzer_1 = require("./Analyzer");
const RSI_1 = require("./RSI");
class Step4 extends Analyzer_1.Analyzer {
constructor(oPC, nDays = 10) {
super(oPC);
this.fS = [];
this.nDays = nDays;
this.fS = (new RSI_1.RSI()).getRSI(oPC.fC, nDays);
this.calculateSignals();
}
calculateSignals() {
let n = this.fS.length;
let iDir = 0;
this.fAction[0] = 0;
for (var i = 1; i < n; i++) {
if (iDir != 1 && this.fS[i] >= 30.0 && this.fS[i - 1] <= 30.0) {
iDir = 1;
this.fAction[i] = 1;
continue;
}
if (iDir != 1 && this.fS[i] >= 70.0 && this.fS[i - 1] <= 70.0) {
iDir = 1;
this.fAction[i] = 1;
continue;
}
if (iDir != -1 && this.fS[i] <= 30.0 && this.fS[i - 1] >= 30.0) {
iDir = -1;
this.fAction[i] = -1;
continue;
}
if (iDir != -1 && this.fS[i] <= 70.0 && this.fS[i - 1] >= 70.0) {
iDir = -1;
this.fAction[i] = -1;
continue;
}
// this.fAction[i] = 0 ;
}
}
}
exports.Step4 = Step4;