trading-signals 7.1.1 → 7.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -236,7 +236,7 @@ var AO = class extends TrendIndicatorSeries {
236
236
  };
237
237
 
238
238
  // src/momentum/MOM/MOM.ts
239
- var MOM = class extends IndicatorSeries {
239
+ var MOM = class extends TrendIndicatorSeries {
240
240
  constructor(interval) {
241
241
  super();
242
242
  this.interval = interval;
@@ -255,6 +255,19 @@ var MOM = class extends IndicatorSeries {
255
255
  }
256
256
  return null;
257
257
  }
258
+ calculateSignalState(result) {
259
+ const hasResult = result !== null && result !== void 0;
260
+ if (!hasResult) {
261
+ return TradingSignal.UNKNOWN;
262
+ }
263
+ if (result > 0) {
264
+ return TradingSignal.BULLISH;
265
+ }
266
+ if (result < 0) {
267
+ return TradingSignal.BEARISH;
268
+ }
269
+ return TradingSignal.SIDEWAYS;
270
+ }
258
271
  };
259
272
 
260
273
  // src/momentum/AC/AC.ts
package/dist/index.d.cts CHANGED
@@ -123,13 +123,14 @@ declare class AO extends TrendIndicatorSeries<HighLow<number>> {
123
123
  protected calculateSignalState(result: number | null | undefined): "BEARISH" | "BULLISH" | "SIDEWAYS" | "UNKNOWN";
124
124
  }
125
125
 
126
- declare class MOM extends IndicatorSeries {
126
+ declare class MOM extends TrendIndicatorSeries {
127
127
  readonly interval: number;
128
128
  private readonly history;
129
129
  private readonly historyLength;
130
130
  constructor(interval: number);
131
131
  getRequiredInputs(): number;
132
132
  update(value: number, replace: boolean): number | null;
133
+ protected calculateSignalState(result?: number | null | undefined): "BEARISH" | "BULLISH" | "SIDEWAYS" | "UNKNOWN";
133
134
  }
134
135
 
135
136
  declare class AC extends TrendIndicatorSeries<HighLow<number>> {
package/dist/index.d.ts CHANGED
@@ -123,13 +123,14 @@ declare class AO extends TrendIndicatorSeries<HighLow<number>> {
123
123
  protected calculateSignalState(result: number | null | undefined): "BEARISH" | "BULLISH" | "SIDEWAYS" | "UNKNOWN";
124
124
  }
125
125
 
126
- declare class MOM extends IndicatorSeries {
126
+ declare class MOM extends TrendIndicatorSeries {
127
127
  readonly interval: number;
128
128
  private readonly history;
129
129
  private readonly historyLength;
130
130
  constructor(interval: number);
131
131
  getRequiredInputs(): number;
132
132
  update(value: number, replace: boolean): number | null;
133
+ protected calculateSignalState(result?: number | null | undefined): "BEARISH" | "BULLISH" | "SIDEWAYS" | "UNKNOWN";
133
134
  }
134
135
 
135
136
  declare class AC extends TrendIndicatorSeries<HighLow<number>> {
package/dist/index.js CHANGED
@@ -154,7 +154,7 @@ var AO = class extends TrendIndicatorSeries {
154
154
  };
155
155
 
156
156
  // src/momentum/MOM/MOM.ts
157
- var MOM = class extends IndicatorSeries {
157
+ var MOM = class extends TrendIndicatorSeries {
158
158
  constructor(interval) {
159
159
  super();
160
160
  this.interval = interval;
@@ -173,6 +173,19 @@ var MOM = class extends IndicatorSeries {
173
173
  }
174
174
  return null;
175
175
  }
176
+ calculateSignalState(result) {
177
+ const hasResult = result !== null && result !== void 0;
178
+ if (!hasResult) {
179
+ return TradingSignal.UNKNOWN;
180
+ }
181
+ if (result > 0) {
182
+ return TradingSignal.BULLISH;
183
+ }
184
+ if (result < 0) {
185
+ return TradingSignal.BEARISH;
186
+ }
187
+ return TradingSignal.SIDEWAYS;
188
+ }
176
189
  };
177
190
 
178
191
  // src/momentum/AC/AC.ts
package/package.json CHANGED
@@ -5,16 +5,14 @@
5
5
  "description": "Technical indicators to run technical analysis with JavaScript / TypeScript.",
6
6
  "devDependencies": {
7
7
  "@arethetypeswrong/cli": "^0.18.2",
8
- "@vitest/coverage-v8": "^4.0.14",
9
- "dependency-cruiser": "^17.3.1",
8
+ "dependency-cruiser": "^17.3.2",
10
9
  "generate-changelog": "^1.8.0",
11
- "tsup": "^8.5.0",
12
- "tsx": "^4.20.6"
10
+ "tsup": "^8.5.1"
13
11
  },
14
12
  "exports": {
15
13
  ".": {
16
14
  "import": "./dist/index.js",
17
- "default": "./dist/index.cjs"
15
+ "require": "./dist/index.cjs"
18
16
  },
19
17
  "./package.json": "./package.json"
20
18
  },
@@ -85,5 +83,5 @@
85
83
  "test:units:watch": "vitest --watch"
86
84
  },
87
85
  "type": "module",
88
- "version": "7.1.1"
86
+ "version": "7.2.0"
89
87
  }