UNPKG

sql-synergy

Version:

Synergy Wave TA

132 lines (131 loc) 3.51 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.WaveLines = void 0; const IConstants_1 = require("./IConstants"); class WaveLines { constructor(iStart, iDirection) { this.i5StepsDateIndex = -1; this.bPerfect = false; this.bBiggerChannelBroken = false; this.iStart = 0; this.iEnd = 0; this.iDir = 0; this.sName = "UnSet"; this.fMin = 0; this.fMax = 0; this.iStart = iStart; this.iDir = iDirection; } setTechnicals(oPC) { this.oPC = oPC; } set5StepsDateIndex(iDayIndex) { this.i5StepsDateIndex = iDayIndex; } get5StepsDateIndex() { return this.i5StepsDateIndex; } setPerfect(bPerfect) { this.bPerfect = bPerfect; } setBiggerChannelBroken(bBiggerChannelBroken) { this.bBiggerChannelBroken = bBiggerChannelBroken; } wasBiggerChannelBroken() { return this.bBiggerChannelBroken; } isPerfect() { return this.bPerfect; } setStart(iStart) { this.iStart = iStart; } setEnd(iEnd) { this.iEnd = iEnd; } getEnd() { return this.iEnd; } getLength() { if (this.oPC === undefined) return 0; if (this.isUp()) return this.oPC.getHigh()[this.iEnd] - this.oPC.getLow()[this.iStart]; return this.oPC.getLow()[this.iEnd] - this.oPC.getHigh()[this.iStart]; } isUp() { return this.iDir == IConstants_1.IConstants.UP; } getName() { return this.sName; } setName(sName) { this.sName = sName; } setMinMove(f) { this.fMin = f; } setMaxMove(f) { this.fMax = f; } getMinMove() { return this.fMin; } getMaxMove() { return this.fMax; } getHighIndex() { return (this.isUp() ? this.iEnd : this.iStart); } getLowIndex() { return (this.isUp() == false ? this.iEnd : this.iStart); } getHighPrice() { if (this.oPC === undefined) return 0; return (this.isUp() ? this.oPC.getHigh()[this.iEnd] : this.oPC.getHigh()[this.iStart]); } getLowPrice() { if (this.oPC === undefined) return 0; return (this.isUp() == false ? this.oPC.getLow()[this.iEnd] : this.oPC.getLow()[this.iStart]); } getEndPrice() { if (this.oPC === undefined) return 0; return (this.isUp() == false ? this.oPC.getLow()[this.iEnd] : this.oPC.getHigh()[this.iEnd]); } getStartPrice() { if (this.oPC === undefined) return 0; return (this.isUp() ? this.oPC.getLow()[this.iStart] : this.oPC.getHigh()[this.iStart]); } getStart() { return this.iStart; } getStartDate() { if (this.oPC === undefined) return 0; return this.oPC.getDate()[this.iStart]; } getEndDate() { if (this.oPC === undefined) return 0; return this.oPC.getDate()[this.iEnd]; } getDir() { return this.isUp() ? "-Up" : "-Dn"; } toString() { return this.getName() + this.getDir() + " " + this.getStartDate() + " " + this.getStartPrice() + " - " + this.getEndPrice() + " " + this.getEndDate(); } print() { console.log(toString()); } } exports.WaveLines = WaveLines; //class MergeWaves extends WaveLines //{ // MergeWaves ( WaveLines oWL1, ) //}