trading-signals 7.4.2 → 7.4.3

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
@@ -795,8 +795,9 @@ var ROC = class extends TrendIndicatorSeries {
795
795
  return this.interval;
796
796
  }
797
797
  update(price, replace) {
798
- const comparePrice = pushUpdate(this.prices, replace, price, this.interval);
799
- if (comparePrice) return this.setResult((price - comparePrice) / comparePrice, replace);
798
+ const comparePrice = this.prices.length === this.interval ? this.prices[0] : null;
799
+ pushUpdate(this.prices, replace, price, this.interval);
800
+ if (comparePrice !== null) return this.setResult((price - comparePrice) / comparePrice, replace);
800
801
  return null;
801
802
  }
802
803
  calculateSignalState(result) {
package/dist/index.mjs CHANGED
@@ -794,8 +794,9 @@ var ROC = class extends TrendIndicatorSeries {
794
794
  return this.interval;
795
795
  }
796
796
  update(price, replace) {
797
- const comparePrice = pushUpdate(this.prices, replace, price, this.interval);
798
- if (comparePrice) return this.setResult((price - comparePrice) / comparePrice, replace);
797
+ const comparePrice = this.prices.length === this.interval ? this.prices[0] : null;
798
+ pushUpdate(this.prices, replace, price, this.interval);
799
+ if (comparePrice !== null) return this.setResult((price - comparePrice) / comparePrice, replace);
799
800
  return null;
800
801
  }
801
802
  calculateSignalState(result) {
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "description": "Technical indicators to run technical analysis with JavaScript / TypeScript.",
6
6
  "devDependencies": {
7
7
  "generate-changelog": "^1.8.0",
8
- "tsdown": "^0.17.4"
8
+ "tsdown": "^0.18.4"
9
9
  },
10
10
  "exports": {
11
11
  ".": {
@@ -87,5 +87,5 @@
87
87
  "test:units:watch": "vitest --watch"
88
88
  },
89
89
  "type": "module",
90
- "version": "7.4.2"
90
+ "version": "7.4.3"
91
91
  }