trading-signals 6.4.0 → 6.5.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/README.md CHANGED
@@ -144,6 +144,7 @@ Most of the time, the minimum amount of data depends on the interval / time peri
144
144
  1. Simple Moving Average (SMA)
145
145
  1. Stochastic Oscillator (STOCH)
146
146
  1. Stochastic RSI (STOCHRSI)
147
+ 1. Tom Demark's Sequential Indicator (TDS)
147
148
  1. True Range (TR)
148
149
  1. Weighted Moving Average (WMA)
149
150
  1. Wilder's Smoothed Moving Average (WSMA / WWS / SMMA / MEMA)
package/dist/index.cjs CHANGED
@@ -36,7 +36,7 @@ __export(index_exports, {
36
36
  ATR: () => ATR,
37
37
  AccelerationBands: () => AccelerationBands,
38
38
  BaseIndicatorSeries: () => BaseIndicatorSeries,
39
- Big: () => import_big27.default,
39
+ Big: () => import_big28.default,
40
40
  BigIndicatorSeries: () => BigIndicatorSeries,
41
41
  BollingerBands: () => BollingerBands,
42
42
  BollingerBandsWidth: () => BollingerBandsWidth,
@@ -73,6 +73,7 @@ __export(index_exports, {
73
73
  FasterSMA: () => FasterSMA,
74
74
  FasterStochasticOscillator: () => FasterStochasticOscillator,
75
75
  FasterStochasticRSI: () => FasterStochasticRSI,
76
+ FasterTDS: () => FasterTDS,
76
77
  FasterTR: () => FasterTR,
77
78
  FasterWMA: () => FasterWMA,
78
79
  FasterWSMA: () => FasterWSMA,
@@ -92,6 +93,7 @@ __export(index_exports, {
92
93
  SMA: () => SMA,
93
94
  StochasticOscillator: () => StochasticOscillator,
94
95
  StochasticRSI: () => StochasticRSI,
96
+ TDS: () => TDS,
95
97
  TR: () => TR,
96
98
  TechnicalIndicator: () => TechnicalIndicator,
97
99
  WMA: () => WMA,
@@ -106,7 +108,7 @@ __export(index_exports, {
106
108
  pushUpdate: () => pushUpdate
107
109
  });
108
110
  module.exports = __toCommonJS(index_exports);
109
- var import_big27 = __toESM(require("big.js"), 1);
111
+ var import_big28 = __toESM(require("big.js"), 1);
110
112
 
111
113
  // src/error/NotEnoughDataError.ts
112
114
  var NotEnoughDataError = class extends Error {
@@ -2144,8 +2146,98 @@ var FasterStochasticRSI = class extends NumberIndicatorSeries {
2144
2146
  }
2145
2147
  };
2146
2148
 
2147
- // src/WMA/WMA.ts
2149
+ // src/TDS/TDS.ts
2148
2150
  var import_big26 = __toESM(require("big.js"), 1);
2151
+ var TDS = class extends BigIndicatorSeries {
2152
+ closes = [];
2153
+ setupCount = 0;
2154
+ setupDirection = null;
2155
+ update(close, replace) {
2156
+ const closeBig = new import_big26.default(close);
2157
+ if (replace) {
2158
+ this.closes.pop();
2159
+ }
2160
+ this.closes.push(closeBig);
2161
+ if (this.closes.length < 5) {
2162
+ return null;
2163
+ }
2164
+ if (this.closes.length > 13) {
2165
+ this.closes.shift();
2166
+ }
2167
+ const index = this.closes.length - 1;
2168
+ const prev4 = this.closes[index - 4];
2169
+ if (closeBig.gt(prev4)) {
2170
+ if (this.setupDirection === "bearish") {
2171
+ this.setupCount = 1;
2172
+ this.setupDirection = "bullish";
2173
+ } else {
2174
+ this.setupCount++;
2175
+ this.setupDirection = "bullish";
2176
+ }
2177
+ } else if (closeBig.lt(prev4)) {
2178
+ if (this.setupDirection === "bullish") {
2179
+ this.setupCount = 1;
2180
+ this.setupDirection = "bearish";
2181
+ } else {
2182
+ this.setupCount++;
2183
+ this.setupDirection = "bearish";
2184
+ }
2185
+ }
2186
+ if (this.setupCount >= 9) {
2187
+ const result = new import_big26.default(this.setupDirection === "bullish" ? 1 : -1);
2188
+ this.setupCount = 0;
2189
+ this.setupDirection = null;
2190
+ return this.setResult(result, replace);
2191
+ }
2192
+ return null;
2193
+ }
2194
+ };
2195
+ var FasterTDS = class extends NumberIndicatorSeries {
2196
+ closes = [];
2197
+ setupCount = 0;
2198
+ setupDirection = null;
2199
+ update(close, replace) {
2200
+ if (replace) {
2201
+ this.closes.pop();
2202
+ }
2203
+ this.closes.push(close);
2204
+ if (this.closes.length < 5) {
2205
+ return null;
2206
+ }
2207
+ if (this.closes.length > 13) {
2208
+ this.closes.shift();
2209
+ }
2210
+ const index = this.closes.length - 1;
2211
+ const prev4 = this.closes[index - 4];
2212
+ if (close > prev4) {
2213
+ if (this.setupDirection === "bearish") {
2214
+ this.setupCount = 1;
2215
+ this.setupDirection = "bullish";
2216
+ } else {
2217
+ this.setupCount++;
2218
+ this.setupDirection = "bullish";
2219
+ }
2220
+ } else if (close < prev4) {
2221
+ if (this.setupDirection === "bullish") {
2222
+ this.setupCount = 1;
2223
+ this.setupDirection = "bearish";
2224
+ } else {
2225
+ this.setupCount++;
2226
+ this.setupDirection = "bearish";
2227
+ }
2228
+ }
2229
+ if (this.setupCount >= 9) {
2230
+ const result = this.setupDirection === "bullish" ? 1 : -1;
2231
+ this.setupCount = 0;
2232
+ this.setupDirection = null;
2233
+ return this.setResult(result, replace);
2234
+ }
2235
+ return null;
2236
+ }
2237
+ };
2238
+
2239
+ // src/WMA/WMA.ts
2240
+ var import_big27 = __toESM(require("big.js"), 1);
2149
2241
  var WMA = class extends MovingAverage {
2150
2242
  constructor(interval) {
2151
2243
  super(interval);
@@ -2156,9 +2248,9 @@ var WMA = class extends MovingAverage {
2156
2248
  pushUpdate(this.prices, replace, price, this.interval);
2157
2249
  if (this.prices.length === this.interval) {
2158
2250
  const weightedPricesSum = this.prices.reduce((acc, price2, index) => {
2159
- const weightedPrice = new import_big26.default(price2).mul(index + 1);
2251
+ const weightedPrice = new import_big27.default(price2).mul(index + 1);
2160
2252
  return acc.add(weightedPrice);
2161
- }, new import_big26.default(0));
2253
+ }, new import_big27.default(0));
2162
2254
  const weightBase = this.interval * (this.interval + 1) / 2;
2163
2255
  const weightedMa = weightedPricesSum.div(weightBase);
2164
2256
  return this.setResult(weightedMa, replace);
@@ -2231,6 +2323,7 @@ var FasterWMA = class extends FasterMovingAverage {
2231
2323
  FasterSMA,
2232
2324
  FasterStochasticOscillator,
2233
2325
  FasterStochasticRSI,
2326
+ FasterTDS,
2234
2327
  FasterTR,
2235
2328
  FasterWMA,
2236
2329
  FasterWSMA,
@@ -2250,6 +2343,7 @@ var FasterWMA = class extends FasterMovingAverage {
2250
2343
  SMA,
2251
2344
  StochasticOscillator,
2252
2345
  StochasticRSI,
2346
+ TDS,
2253
2347
  TR,
2254
2348
  TechnicalIndicator,
2255
2349
  WMA,
package/dist/index.d.cts CHANGED
@@ -704,6 +704,19 @@ declare class FasterStochasticRSI extends NumberIndicatorSeries {
704
704
  update(price: number, replace: boolean): number | null;
705
705
  }
706
706
 
707
+ declare class TDS extends BigIndicatorSeries {
708
+ private readonly closes;
709
+ private setupCount;
710
+ private setupDirection;
711
+ update(close: BigSource, replace: boolean): Big__default | null;
712
+ }
713
+ declare class FasterTDS extends NumberIndicatorSeries<number> {
714
+ private readonly closes;
715
+ private setupCount;
716
+ private setupDirection;
717
+ update(close: number, replace: boolean): number | null;
718
+ }
719
+
707
720
  declare class TR extends BigIndicatorSeries<HighLowClose> {
708
721
  private previousCandle?;
709
722
  private secondLastCandle?;
@@ -715,4 +728,4 @@ declare class FasterTR extends NumberIndicatorSeries<HighLowCloseNumber> {
715
728
  update(candle: HighLowCloseNumber, replace: boolean): number;
716
729
  }
717
730
 
718
- export { AC, ADX, AO, ATR, AccelerationBands, type BandsResult, BaseIndicatorSeries, BigIndicatorSeries, BollingerBands, BollingerBandsWidth, CCI, CG, DEMA, DMA, type DMAResult, DX, EMA, FasterAC, FasterADX, FasterAO, FasterATR, FasterAccelerationBands, type FasterBandsResult, FasterBollingerBands, FasterBollingerBandsWidth, FasterCCI, FasterCG, FasterDEMA, FasterDMA, type FasterDMAResult, FasterDX, FasterEMA, FasterLinearRegression, type FasterLinearRegressionResult, FasterMACD, type FasterMACDResult, FasterMAD, FasterMOM, FasterMovingAverage, type FasterMovingAverageTypes, FasterOBV, FasterPSAR, FasterPeriod, type FasterPeriodResult, FasterRMA, FasterROC, FasterRSI, FasterSMA, FasterStochasticOscillator, FasterStochasticRSI, type FasterStochasticResult, FasterTR, FasterWMA, FasterWSMA, type HighLow, type HighLowClose, type HighLowCloseNumber, type HighLowNumber, LinearRegression, type LinearRegressionConfig, type LinearRegressionResult, MACD, type MACDConfig, type MACDResult, MAD, MOM, MovingAverage, type MovingAverageTypes, NotEnoughDataError, NumberIndicatorSeries, OBV, type OpenHighLowClose, type OpenHighLowCloseNumber, type OpenHighLowCloseVolume, type OpenHighLowCloseVolumeNumber, PSAR, type PSARConfig, Period, type PeriodResult, RMA, ROC, RSI, SMA, StochasticOscillator, StochasticRSI, type StochasticResult, type Streak, TR, TechnicalIndicator, WMA, WSMA, getAverage, getFasterAverage, getFasterStandardDeviation, getMaximum, getMinimum, getStandardDeviation, getStreaks, pushUpdate };
731
+ export { AC, ADX, AO, ATR, AccelerationBands, type BandsResult, BaseIndicatorSeries, BigIndicatorSeries, BollingerBands, BollingerBandsWidth, CCI, CG, DEMA, DMA, type DMAResult, DX, EMA, FasterAC, FasterADX, FasterAO, FasterATR, FasterAccelerationBands, type FasterBandsResult, FasterBollingerBands, FasterBollingerBandsWidth, FasterCCI, FasterCG, FasterDEMA, FasterDMA, type FasterDMAResult, FasterDX, FasterEMA, FasterLinearRegression, type FasterLinearRegressionResult, FasterMACD, type FasterMACDResult, FasterMAD, FasterMOM, FasterMovingAverage, type FasterMovingAverageTypes, FasterOBV, FasterPSAR, FasterPeriod, type FasterPeriodResult, FasterRMA, FasterROC, FasterRSI, FasterSMA, FasterStochasticOscillator, FasterStochasticRSI, type FasterStochasticResult, FasterTDS, FasterTR, FasterWMA, FasterWSMA, type HighLow, type HighLowClose, type HighLowCloseNumber, type HighLowNumber, LinearRegression, type LinearRegressionConfig, type LinearRegressionResult, MACD, type MACDConfig, type MACDResult, MAD, MOM, MovingAverage, type MovingAverageTypes, NotEnoughDataError, NumberIndicatorSeries, OBV, type OpenHighLowClose, type OpenHighLowCloseNumber, type OpenHighLowCloseVolume, type OpenHighLowCloseVolumeNumber, PSAR, type PSARConfig, Period, type PeriodResult, RMA, ROC, RSI, SMA, StochasticOscillator, StochasticRSI, type StochasticResult, type Streak, TDS, TR, TechnicalIndicator, WMA, WSMA, getAverage, getFasterAverage, getFasterStandardDeviation, getMaximum, getMinimum, getStandardDeviation, getStreaks, pushUpdate };
package/dist/index.d.ts CHANGED
@@ -704,6 +704,19 @@ declare class FasterStochasticRSI extends NumberIndicatorSeries {
704
704
  update(price: number, replace: boolean): number | null;
705
705
  }
706
706
 
707
+ declare class TDS extends BigIndicatorSeries {
708
+ private readonly closes;
709
+ private setupCount;
710
+ private setupDirection;
711
+ update(close: BigSource, replace: boolean): Big__default | null;
712
+ }
713
+ declare class FasterTDS extends NumberIndicatorSeries<number> {
714
+ private readonly closes;
715
+ private setupCount;
716
+ private setupDirection;
717
+ update(close: number, replace: boolean): number | null;
718
+ }
719
+
707
720
  declare class TR extends BigIndicatorSeries<HighLowClose> {
708
721
  private previousCandle?;
709
722
  private secondLastCandle?;
@@ -715,4 +728,4 @@ declare class FasterTR extends NumberIndicatorSeries<HighLowCloseNumber> {
715
728
  update(candle: HighLowCloseNumber, replace: boolean): number;
716
729
  }
717
730
 
718
- export { AC, ADX, AO, ATR, AccelerationBands, type BandsResult, BaseIndicatorSeries, BigIndicatorSeries, BollingerBands, BollingerBandsWidth, CCI, CG, DEMA, DMA, type DMAResult, DX, EMA, FasterAC, FasterADX, FasterAO, FasterATR, FasterAccelerationBands, type FasterBandsResult, FasterBollingerBands, FasterBollingerBandsWidth, FasterCCI, FasterCG, FasterDEMA, FasterDMA, type FasterDMAResult, FasterDX, FasterEMA, FasterLinearRegression, type FasterLinearRegressionResult, FasterMACD, type FasterMACDResult, FasterMAD, FasterMOM, FasterMovingAverage, type FasterMovingAverageTypes, FasterOBV, FasterPSAR, FasterPeriod, type FasterPeriodResult, FasterRMA, FasterROC, FasterRSI, FasterSMA, FasterStochasticOscillator, FasterStochasticRSI, type FasterStochasticResult, FasterTR, FasterWMA, FasterWSMA, type HighLow, type HighLowClose, type HighLowCloseNumber, type HighLowNumber, LinearRegression, type LinearRegressionConfig, type LinearRegressionResult, MACD, type MACDConfig, type MACDResult, MAD, MOM, MovingAverage, type MovingAverageTypes, NotEnoughDataError, NumberIndicatorSeries, OBV, type OpenHighLowClose, type OpenHighLowCloseNumber, type OpenHighLowCloseVolume, type OpenHighLowCloseVolumeNumber, PSAR, type PSARConfig, Period, type PeriodResult, RMA, ROC, RSI, SMA, StochasticOscillator, StochasticRSI, type StochasticResult, type Streak, TR, TechnicalIndicator, WMA, WSMA, getAverage, getFasterAverage, getFasterStandardDeviation, getMaximum, getMinimum, getStandardDeviation, getStreaks, pushUpdate };
731
+ export { AC, ADX, AO, ATR, AccelerationBands, type BandsResult, BaseIndicatorSeries, BigIndicatorSeries, BollingerBands, BollingerBandsWidth, CCI, CG, DEMA, DMA, type DMAResult, DX, EMA, FasterAC, FasterADX, FasterAO, FasterATR, FasterAccelerationBands, type FasterBandsResult, FasterBollingerBands, FasterBollingerBandsWidth, FasterCCI, FasterCG, FasterDEMA, FasterDMA, type FasterDMAResult, FasterDX, FasterEMA, FasterLinearRegression, type FasterLinearRegressionResult, FasterMACD, type FasterMACDResult, FasterMAD, FasterMOM, FasterMovingAverage, type FasterMovingAverageTypes, FasterOBV, FasterPSAR, FasterPeriod, type FasterPeriodResult, FasterRMA, FasterROC, FasterRSI, FasterSMA, FasterStochasticOscillator, FasterStochasticRSI, type FasterStochasticResult, FasterTDS, FasterTR, FasterWMA, FasterWSMA, type HighLow, type HighLowClose, type HighLowCloseNumber, type HighLowNumber, LinearRegression, type LinearRegressionConfig, type LinearRegressionResult, MACD, type MACDConfig, type MACDResult, MAD, MOM, MovingAverage, type MovingAverageTypes, NotEnoughDataError, NumberIndicatorSeries, OBV, type OpenHighLowClose, type OpenHighLowCloseNumber, type OpenHighLowCloseVolume, type OpenHighLowCloseVolumeNumber, PSAR, type PSARConfig, Period, type PeriodResult, RMA, ROC, RSI, SMA, StochasticOscillator, StochasticRSI, type StochasticResult, type Streak, TDS, TR, TechnicalIndicator, WMA, WSMA, getAverage, getFasterAverage, getFasterStandardDeviation, getMaximum, getMinimum, getStandardDeviation, getStreaks, pushUpdate };
package/dist/index.js CHANGED
@@ -2037,8 +2037,98 @@ var FasterStochasticRSI = class extends NumberIndicatorSeries {
2037
2037
  }
2038
2038
  };
2039
2039
 
2040
- // src/WMA/WMA.ts
2040
+ // src/TDS/TDS.ts
2041
2041
  import Big26 from "big.js";
2042
+ var TDS = class extends BigIndicatorSeries {
2043
+ closes = [];
2044
+ setupCount = 0;
2045
+ setupDirection = null;
2046
+ update(close, replace) {
2047
+ const closeBig = new Big26(close);
2048
+ if (replace) {
2049
+ this.closes.pop();
2050
+ }
2051
+ this.closes.push(closeBig);
2052
+ if (this.closes.length < 5) {
2053
+ return null;
2054
+ }
2055
+ if (this.closes.length > 13) {
2056
+ this.closes.shift();
2057
+ }
2058
+ const index = this.closes.length - 1;
2059
+ const prev4 = this.closes[index - 4];
2060
+ if (closeBig.gt(prev4)) {
2061
+ if (this.setupDirection === "bearish") {
2062
+ this.setupCount = 1;
2063
+ this.setupDirection = "bullish";
2064
+ } else {
2065
+ this.setupCount++;
2066
+ this.setupDirection = "bullish";
2067
+ }
2068
+ } else if (closeBig.lt(prev4)) {
2069
+ if (this.setupDirection === "bullish") {
2070
+ this.setupCount = 1;
2071
+ this.setupDirection = "bearish";
2072
+ } else {
2073
+ this.setupCount++;
2074
+ this.setupDirection = "bearish";
2075
+ }
2076
+ }
2077
+ if (this.setupCount >= 9) {
2078
+ const result = new Big26(this.setupDirection === "bullish" ? 1 : -1);
2079
+ this.setupCount = 0;
2080
+ this.setupDirection = null;
2081
+ return this.setResult(result, replace);
2082
+ }
2083
+ return null;
2084
+ }
2085
+ };
2086
+ var FasterTDS = class extends NumberIndicatorSeries {
2087
+ closes = [];
2088
+ setupCount = 0;
2089
+ setupDirection = null;
2090
+ update(close, replace) {
2091
+ if (replace) {
2092
+ this.closes.pop();
2093
+ }
2094
+ this.closes.push(close);
2095
+ if (this.closes.length < 5) {
2096
+ return null;
2097
+ }
2098
+ if (this.closes.length > 13) {
2099
+ this.closes.shift();
2100
+ }
2101
+ const index = this.closes.length - 1;
2102
+ const prev4 = this.closes[index - 4];
2103
+ if (close > prev4) {
2104
+ if (this.setupDirection === "bearish") {
2105
+ this.setupCount = 1;
2106
+ this.setupDirection = "bullish";
2107
+ } else {
2108
+ this.setupCount++;
2109
+ this.setupDirection = "bullish";
2110
+ }
2111
+ } else if (close < prev4) {
2112
+ if (this.setupDirection === "bullish") {
2113
+ this.setupCount = 1;
2114
+ this.setupDirection = "bearish";
2115
+ } else {
2116
+ this.setupCount++;
2117
+ this.setupDirection = "bearish";
2118
+ }
2119
+ }
2120
+ if (this.setupCount >= 9) {
2121
+ const result = this.setupDirection === "bullish" ? 1 : -1;
2122
+ this.setupCount = 0;
2123
+ this.setupDirection = null;
2124
+ return this.setResult(result, replace);
2125
+ }
2126
+ return null;
2127
+ }
2128
+ };
2129
+
2130
+ // src/WMA/WMA.ts
2131
+ import Big27 from "big.js";
2042
2132
  var WMA = class extends MovingAverage {
2043
2133
  constructor(interval) {
2044
2134
  super(interval);
@@ -2049,9 +2139,9 @@ var WMA = class extends MovingAverage {
2049
2139
  pushUpdate(this.prices, replace, price, this.interval);
2050
2140
  if (this.prices.length === this.interval) {
2051
2141
  const weightedPricesSum = this.prices.reduce((acc, price2, index) => {
2052
- const weightedPrice = new Big26(price2).mul(index + 1);
2142
+ const weightedPrice = new Big27(price2).mul(index + 1);
2053
2143
  return acc.add(weightedPrice);
2054
- }, new Big26(0));
2144
+ }, new Big27(0));
2055
2145
  const weightBase = this.interval * (this.interval + 1) / 2;
2056
2146
  const weightedMa = weightedPricesSum.div(weightBase);
2057
2147
  return this.setResult(weightedMa, replace);
@@ -2123,6 +2213,7 @@ export {
2123
2213
  FasterSMA,
2124
2214
  FasterStochasticOscillator,
2125
2215
  FasterStochasticRSI,
2216
+ FasterTDS,
2126
2217
  FasterTR,
2127
2218
  FasterWMA,
2128
2219
  FasterWSMA,
@@ -2142,6 +2233,7 @@ export {
2142
2233
  SMA,
2143
2234
  StochasticOscillator,
2144
2235
  StochasticRSI,
2236
+ TDS,
2145
2237
  TR,
2146
2238
  TechnicalIndicator,
2147
2239
  WMA,
package/package.json CHANGED
@@ -104,5 +104,5 @@
104
104
  "test:types": "npm run lint:types"
105
105
  },
106
106
  "type": "module",
107
- "version": "6.4.0"
107
+ "version": "6.5.0"
108
108
  }