lightweight-charts-indicators 0.1.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.
Files changed (149) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +271 -0
  3. package/dist/adr.d.ts +57 -0
  4. package/dist/adr.d.ts.map +1 -0
  5. package/dist/adx.d.ts +34 -0
  6. package/dist/adx.d.ts.map +1 -0
  7. package/dist/alma.d.ts +61 -0
  8. package/dist/alma.d.ts.map +1 -0
  9. package/dist/aroon.d.ts +34 -0
  10. package/dist/aroon.d.ts.map +1 -0
  11. package/dist/atr.d.ts +59 -0
  12. package/dist/atr.d.ts.map +1 -0
  13. package/dist/awesome-oscillator.d.ts +34 -0
  14. package/dist/awesome-oscillator.d.ts.map +1 -0
  15. package/dist/bb-bandwidth.d.ts +41 -0
  16. package/dist/bb-bandwidth.d.ts.map +1 -0
  17. package/dist/bb-percent-b.d.ts +37 -0
  18. package/dist/bb-percent-b.d.ts.map +1 -0
  19. package/dist/bb.d.ts +65 -0
  20. package/dist/bb.d.ts.map +1 -0
  21. package/dist/bbtrend.d.ts +36 -0
  22. package/dist/bbtrend.d.ts.map +1 -0
  23. package/dist/bop.d.ts +57 -0
  24. package/dist/bop.d.ts.map +1 -0
  25. package/dist/bull-bear-power.d.ts +32 -0
  26. package/dist/bull-bear-power.d.ts.map +1 -0
  27. package/dist/cci.d.ts +33 -0
  28. package/dist/cci.d.ts.map +1 -0
  29. package/dist/chaikin-mf.d.ts +33 -0
  30. package/dist/chaikin-mf.d.ts.map +1 -0
  31. package/dist/chaikin-oscillator.d.ts +37 -0
  32. package/dist/chaikin-oscillator.d.ts.map +1 -0
  33. package/dist/chande-kroll-stop.d.ts +47 -0
  34. package/dist/chande-kroll-stop.d.ts.map +1 -0
  35. package/dist/chande-mo.d.ts +32 -0
  36. package/dist/chande-mo.d.ts.map +1 -0
  37. package/dist/choppiness.d.ts +34 -0
  38. package/dist/choppiness.d.ts.map +1 -0
  39. package/dist/coppock-curve.d.ts +37 -0
  40. package/dist/coppock-curve.d.ts.map +1 -0
  41. package/dist/dema.d.ts +33 -0
  42. package/dist/dema.d.ts.map +1 -0
  43. package/dist/dmi.d.ts +49 -0
  44. package/dist/dmi.d.ts.map +1 -0
  45. package/dist/donchian.d.ts +60 -0
  46. package/dist/donchian.d.ts.map +1 -0
  47. package/dist/dpo.d.ts +34 -0
  48. package/dist/dpo.d.ts.map +1 -0
  49. package/dist/ease-of-movement.d.ts +35 -0
  50. package/dist/ease-of-movement.d.ts.map +1 -0
  51. package/dist/elder-force.d.ts +33 -0
  52. package/dist/elder-force.d.ts.map +1 -0
  53. package/dist/ema.d.ts +33 -0
  54. package/dist/ema.d.ts.map +1 -0
  55. package/dist/envelope.d.ts +38 -0
  56. package/dist/envelope.d.ts.map +1 -0
  57. package/dist/fisher-transform.d.ts +44 -0
  58. package/dist/fisher-transform.d.ts.map +1 -0
  59. package/dist/historical-volatility.d.ts +36 -0
  60. package/dist/historical-volatility.d.ts.map +1 -0
  61. package/dist/hma.d.ts +32 -0
  62. package/dist/hma.d.ts.map +1 -0
  63. package/dist/ichimoku.d.ts +64 -0
  64. package/dist/ichimoku.d.ts.map +1 -0
  65. package/dist/index.cjs +5532 -0
  66. package/dist/index.d.ts +207 -0
  67. package/dist/index.d.ts.map +1 -0
  68. package/dist/index.mjs +5511 -0
  69. package/dist/keltner.d.ts +68 -0
  70. package/dist/keltner.d.ts.map +1 -0
  71. package/dist/klinger.d.ts +46 -0
  72. package/dist/klinger.d.ts.map +1 -0
  73. package/dist/lsma.d.ts +33 -0
  74. package/dist/lsma.d.ts.map +1 -0
  75. package/dist/ma-cross.d.ts +34 -0
  76. package/dist/ma-cross.d.ts.map +1 -0
  77. package/dist/ma-ribbon.d.ts +63 -0
  78. package/dist/ma-ribbon.d.ts.map +1 -0
  79. package/dist/macd.d.ts +34 -0
  80. package/dist/macd.d.ts.map +1 -0
  81. package/dist/mass-index.d.ts +31 -0
  82. package/dist/mass-index.d.ts.map +1 -0
  83. package/dist/mcginley-dynamic.d.ts +32 -0
  84. package/dist/mcginley-dynamic.d.ts.map +1 -0
  85. package/dist/median.d.ts +35 -0
  86. package/dist/median.d.ts.map +1 -0
  87. package/dist/mfi.d.ts +32 -0
  88. package/dist/mfi.d.ts.map +1 -0
  89. package/dist/momentum.d.ts +32 -0
  90. package/dist/momentum.d.ts.map +1 -0
  91. package/dist/obv.d.ts +30 -0
  92. package/dist/obv.d.ts.map +1 -0
  93. package/dist/parabolic-sar.d.ts +62 -0
  94. package/dist/parabolic-sar.d.ts.map +1 -0
  95. package/dist/price-oscillator.d.ts +40 -0
  96. package/dist/price-oscillator.d.ts.map +1 -0
  97. package/dist/pvt.d.ts +30 -0
  98. package/dist/pvt.d.ts.map +1 -0
  99. package/dist/rma.d.ts +33 -0
  100. package/dist/rma.d.ts.map +1 -0
  101. package/dist/roc.d.ts +32 -0
  102. package/dist/roc.d.ts.map +1 -0
  103. package/dist/rsi.d.ts +32 -0
  104. package/dist/rsi.d.ts.map +1 -0
  105. package/dist/rvi.d.ts +32 -0
  106. package/dist/rvi.d.ts.map +1 -0
  107. package/dist/sma.d.ts +61 -0
  108. package/dist/sma.d.ts.map +1 -0
  109. package/dist/smi-ergodic-oscillator.d.ts +36 -0
  110. package/dist/smi-ergodic-oscillator.d.ts.map +1 -0
  111. package/dist/smi-ergodic.d.ts +37 -0
  112. package/dist/smi-ergodic.d.ts.map +1 -0
  113. package/dist/smma.d.ts +32 -0
  114. package/dist/smma.d.ts.map +1 -0
  115. package/dist/stdev.d.ts +31 -0
  116. package/dist/stdev.d.ts.map +1 -0
  117. package/dist/stoch-rsi.d.ts +38 -0
  118. package/dist/stoch-rsi.d.ts.map +1 -0
  119. package/dist/stoch.d.ts +33 -0
  120. package/dist/stoch.d.ts.map +1 -0
  121. package/dist/supertrend.d.ts +60 -0
  122. package/dist/supertrend.d.ts.map +1 -0
  123. package/dist/tema.d.ts +33 -0
  124. package/dist/tema.d.ts.map +1 -0
  125. package/dist/trend-strength.d.ts +34 -0
  126. package/dist/trend-strength.d.ts.map +1 -0
  127. package/dist/trix.d.ts +43 -0
  128. package/dist/trix.d.ts.map +1 -0
  129. package/dist/tsi.d.ts +36 -0
  130. package/dist/tsi.d.ts.map +1 -0
  131. package/dist/ultimate-oscillator.d.ts +48 -0
  132. package/dist/ultimate-oscillator.d.ts.map +1 -0
  133. package/dist/volume-oscillator.d.ts +34 -0
  134. package/dist/volume-oscillator.d.ts.map +1 -0
  135. package/dist/vortex.d.ts +32 -0
  136. package/dist/vortex.d.ts.map +1 -0
  137. package/dist/vwma.d.ts +32 -0
  138. package/dist/vwma.d.ts.map +1 -0
  139. package/dist/williams-alligator.d.ts +44 -0
  140. package/dist/williams-alligator.d.ts.map +1 -0
  141. package/dist/williams-r.d.ts +33 -0
  142. package/dist/williams-r.d.ts.map +1 -0
  143. package/dist/wma.d.ts +32 -0
  144. package/dist/wma.d.ts.map +1 -0
  145. package/dist/woodies-cci.d.ts +35 -0
  146. package/dist/woodies-cci.d.ts.map +1 -0
  147. package/dist/zigzag.d.ts +73 -0
  148. package/dist/zigzag.d.ts.map +1 -0
  149. package/package.json +65 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Odyssée
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,271 @@
1
+ # lightweight-charts-indicators
2
+
3
+ **[Live Demo](https://deepentropy.github.io/lightweight-charts-indicators/)**
4
+
5
+ 70+ technical analysis indicators for TradingView's lightweight-charts library. PineScript v6 compatible and validated against TradingView's built-in indicators.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install lightweight-charts-indicators oakscriptjs lightweight-charts
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ```typescript
16
+ import { SMA, RSI, MACD, BollingerBands } from 'lightweight-charts-indicators';
17
+ import type { Bar } from 'oakscriptjs';
18
+
19
+ const bars: Bar[] = [
20
+ { time: 1, open: 100, high: 105, low: 95, close: 102, volume: 1000 },
21
+ // ... more bars
22
+ ];
23
+
24
+ // Simple Moving Average
25
+ const smaResult = SMA.calculate(bars, { len: 14 });
26
+
27
+ // RSI
28
+ const rsiResult = RSI.calculate(bars, { length: 14 });
29
+
30
+ // MACD
31
+ const macdResult = MACD.calculate(bars, { fastLength: 12, slowLength: 26, signalLength: 9 });
32
+
33
+ // Bollinger Bands
34
+ const bbResult = BollingerBands.calculate(bars, { length: 20, mult: 2 });
35
+ ```
36
+
37
+ ## Lightweight-Charts Integration Example
38
+
39
+ Here's a complete example showing how to integrate indicators with TradingView's lightweight-charts:
40
+
41
+ ```typescript
42
+ import { createChart, ColorType, LineSeries, CandlestickSeries } from 'lightweight-charts';
43
+ import { SMA, RSI, BollingerBands } from 'lightweight-charts-indicators';
44
+ import type { Bar } from 'oakscriptjs';
45
+
46
+ // Sample OHLCV data
47
+ const bars: Bar[] = [
48
+ { time: 1609459200, open: 100, high: 105, low: 98, close: 103, volume: 1000 },
49
+ { time: 1609545600, open: 103, high: 108, low: 101, close: 107, volume: 1200 },
50
+ { time: 1609632000, open: 107, high: 110, low: 104, close: 105, volume: 900 },
51
+ // ... more bars
52
+ ];
53
+
54
+ // Create the main chart
55
+ const chartContainer = document.getElementById('chart')!;
56
+ const chart = createChart(chartContainer, {
57
+ layout: {
58
+ background: { type: ColorType.Solid, color: '#1e1e1e' },
59
+ textColor: '#d1d4dc',
60
+ },
61
+ width: 800,
62
+ height: 400,
63
+ });
64
+
65
+ // Add candlestick series
66
+ const candlestickSeries = chart.addSeries(CandlestickSeries);
67
+ candlestickSeries.setData(bars.map(bar => ({
68
+ time: bar.time as number,
69
+ open: bar.open,
70
+ high: bar.high,
71
+ low: bar.low,
72
+ close: bar.close,
73
+ })));
74
+
75
+ // Calculate and add SMA overlay
76
+ const smaResult = SMA.calculate(bars, { len: 20, src: 'close' });
77
+ const smaSeries = chart.addSeries(LineSeries, { color: '#2962FF', lineWidth: 2 });
78
+ smaSeries.setData(smaResult.plots.plot0);
79
+
80
+ // Calculate and add Bollinger Bands
81
+ const bbResult = BollingerBands.calculate(bars, { length: 20, mult: 2 });
82
+ const bbUpperSeries = chart.addSeries(LineSeries, { color: '#787B86', lineWidth: 1 });
83
+ const bbMiddleSeries = chart.addSeries(LineSeries, { color: '#FF6D00', lineWidth: 1 });
84
+ const bbLowerSeries = chart.addSeries(LineSeries, { color: '#787B86', lineWidth: 1 });
85
+ bbUpperSeries.setData(bbResult.plots.plot0); // Upper band
86
+ bbMiddleSeries.setData(bbResult.plots.plot1); // Basis (middle)
87
+ bbLowerSeries.setData(bbResult.plots.plot2); // Lower band
88
+
89
+ // Create a separate pane for RSI (oscillator)
90
+ const rsiContainer = document.getElementById('rsi-chart')!;
91
+ const rsiChart = createChart(rsiContainer, {
92
+ layout: {
93
+ background: { type: ColorType.Solid, color: '#1e1e1e' },
94
+ textColor: '#d1d4dc',
95
+ },
96
+ width: 800,
97
+ height: 150,
98
+ });
99
+
100
+ const rsiResult = RSI.calculate(bars, { length: 14, src: 'close' });
101
+ const rsiSeries = rsiChart.addSeries(LineSeries, { color: '#7E57C2', lineWidth: 2 });
102
+ rsiSeries.setData(rsiResult.plots.plot0);
103
+
104
+ // Sync the time scales
105
+ chart.timeScale().subscribeVisibleLogicalRangeChange(range => {
106
+ if (range) rsiChart.timeScale().setVisibleLogicalRange(range);
107
+ });
108
+ ```
109
+
110
+ ## Available Indicators (70+)
111
+
112
+ ### Moving Averages
113
+
114
+ | Indicator | Export | Description |
115
+ |-----------|--------|-------------|
116
+ | Simple Moving Average | `SMA` | Arithmetic mean over a specified period |
117
+ | Exponential Moving Average | `EMA` | Weighted average giving more weight to recent prices |
118
+ | Weighted Moving Average | `WMA` | Linearly increasing weights |
119
+ | Smoothed Moving Average (RMA) | `RMA` | Wilder smoothing (alpha = 1/length) |
120
+ | Double EMA | `DEMA` | Reduces lag by applying EMA twice |
121
+ | Triple EMA | `TEMA` | Further reduces lag with triple exponential smoothing |
122
+ | Hull Moving Average | `HMA` | Reduces lag while maintaining smoothness |
123
+ | Least Squares Moving Average | `LSMA` | Uses linear regression to fit a line |
124
+ | Arnaud Legoux Moving Average | `ALMA` | Gaussian distribution to reduce lag |
125
+ | Volume Weighted Moving Average | `VWMA` | Moving average weighted by volume |
126
+ | Smoothed Moving Average | `SMMA` | Wilder smoothing moving average |
127
+ | McGinley Dynamic | `McGinleyDynamic` | Adaptive moving average that adjusts to market speed |
128
+ | MA Cross | `MACross` | Two moving averages for crossover signals |
129
+ | Moving Average Ribbon | `MARibbon` | Multiple MAs showing trend direction and momentum |
130
+
131
+ ### Oscillators
132
+
133
+ | Indicator | Export | Description |
134
+ |-----------|--------|-------------|
135
+ | Relative Strength Index | `RSI` | Momentum oscillator (0-100) measuring price changes |
136
+ | Stochastic | `Stochastic` | Compares closing price to price range |
137
+ | Stochastic RSI | `StochRSI` | Stochastic applied to RSI values |
138
+ | Commodity Channel Index | `CCI` | Measures variation from statistical mean |
139
+ | Williams %R | `WilliamsPercentRange` | Momentum showing overbought/oversold levels |
140
+ | Awesome Oscillator | `AwesomeOscillator` | Market momentum using SMA difference |
141
+ | Chande Momentum Oscillator | `ChandeMO` | Momentum on a scale of -100 to +100 |
142
+ | Detrended Price Oscillator | `DPO` | Removes trend to identify cycles |
143
+ | Relative Vigor Index | `RVI` | Measures conviction of price action |
144
+ | SMI Ergodic Indicator | `SMIErgodic` | TSI-based momentum with signal line |
145
+ | SMI Ergodic Oscillator | `SMIErgodicOscillator` | SMI minus signal as histogram |
146
+ | True Strength Index | `TSI` | Double-smoothed momentum oscillator |
147
+ | Woodies CCI | `WoodiesCCI` | CCI with turbo for faster signals |
148
+ | Bollinger Bands %B | `BBPercentB` | Price position relative to BB (0=lower, 1=upper) |
149
+ | Fisher Transform | `FisherTransform` | Gaussian distribution for clearer turning points |
150
+ | Ultimate Oscillator | `UltimateOscillator` | Multi-timeframe weighted momentum |
151
+
152
+ ### Momentum
153
+
154
+ | Indicator | Export | Description |
155
+ |-----------|--------|-------------|
156
+ | MACD | `MACD` | Relationship between two EMAs |
157
+ | Momentum | `Momentum` | Rate of change of price |
158
+ | Rate of Change | `ROC` | Percentage change over a period |
159
+ | Balance of Power | `BOP` | Strength of buyers vs sellers |
160
+ | Bull Bear Power | `BullBearPower` | Buying/selling pressure relative to EMA |
161
+ | Elder Force Index | `ElderForceIndex` | Combines price and volume |
162
+ | Price Oscillator (PPO) | `PriceOscillator` | MACD as percentage for comparison |
163
+ | Coppock Curve | `CoppockCurve` | Long-term momentum using ROC and WMA |
164
+ | TRIX | `TRIX` | Triple EMA rate of change, filters noise |
165
+
166
+ ### Trend
167
+
168
+ | Indicator | Export | Description |
169
+ |-----------|--------|-------------|
170
+ | Average Directional Index | `ADX` | Measures trend strength regardless of direction |
171
+ | Directional Movement Index | `DMI` | +DI, -DI, and ADX for trend direction/strength |
172
+ | Ichimoku Cloud | `IchimokuCloud` | Comprehensive trend system with support/resistance |
173
+ | Parabolic SAR | `ParabolicSAR` | Trend-following with entry/exit points |
174
+ | Supertrend | `Supertrend` | ATR-based dynamic support/resistance |
175
+ | Aroon | `Aroon` | Trend strength by time since high/low |
176
+ | BBTrend | `BBTrend` | Measures trend using Bollinger Bands |
177
+ | Choppiness Index | `Choppiness` | Market choppiness vs trending |
178
+ | Mass Index | `MassIndex` | Identifies reversals via high-low range |
179
+ | Vortex Indicator | `VortexIndicator` | Identifies trend start and direction |
180
+ | Williams Alligator | `WilliamsAlligator` | Three smoothed MAs for trend detection |
181
+ | Zig Zag | `ZigZag` | Connects pivot highs and lows |
182
+ | Trend Strength Index | `TrendStrengthIndex` | Trend strength based on directional movement |
183
+ | Chande Kroll Stop | `ChandeKrollStop` | ATR-based trailing stop system |
184
+
185
+ ### Volatility
186
+
187
+ | Indicator | Export | Description |
188
+ |-----------|--------|-------------|
189
+ | Average True Range | `ATR` | Average range between high and low |
190
+ | Average Day Range | `ADR` | Average daily price range |
191
+ | Standard Deviation | `StandardDeviation` | Measures price volatility |
192
+ | Historical Volatility | `HistoricalVolatility` | Annualized standard deviation of log returns |
193
+ | Bollinger BandWidth | `BBBandWidth` | Width of Bollinger Bands as percentage |
194
+
195
+ ### Channels & Bands
196
+
197
+ | Indicator | Export | Description |
198
+ |-----------|--------|-------------|
199
+ | Bollinger Bands | `BollingerBands` | Volatility bands using standard deviation |
200
+ | Keltner Channels | `KeltnerChannels` | Volatility envelope using EMA and ATR |
201
+ | Donchian Channels | `DonchianChannels` | Highest high and lowest low over period |
202
+ | Envelope | `Envelope` | Moving average with fixed percentage bands |
203
+ | Median | `Median` | Median price with ATR bands |
204
+
205
+ ### Volume
206
+
207
+ | Indicator | Export | Description |
208
+ |-----------|--------|-------------|
209
+ | On Balance Volume | `OBV` | Cumulative volume based on price direction |
210
+ | Money Flow Index | `MFI` | Volume-weighted RSI |
211
+ | Price Volume Trend | `PVT` | Cumulative volume weighted by price changes |
212
+ | Volume Oscillator | `VolumeOscillator` | Percentage difference between volume EMAs |
213
+ | Chaikin Money Flow | `ChaikinMF` | Buying/selling pressure using price and volume |
214
+ | Chaikin Oscillator | `ChaikinOscillator` | Momentum of Accumulation/Distribution line |
215
+ | Ease of Movement | `EaseOfMovement` | Price change relative to volume |
216
+ | Klinger Oscillator | `KlingerOscillator` | Volume-based long-term money flow |
217
+
218
+ ## Output Format
219
+
220
+ All indicators return an `IndicatorResult` object:
221
+
222
+ ```typescript
223
+ interface IndicatorResult {
224
+ metadata: {
225
+ title: string;
226
+ shortTitle: string;
227
+ overlay: boolean; // true = display on price chart, false = separate pane
228
+ };
229
+ plots: {
230
+ plot0: Array<{ time: number; value: number }>;
231
+ plot1?: Array<{ time: number; value: number }>;
232
+ // ... additional plots as needed
233
+ };
234
+ }
235
+ ```
236
+
237
+ ## Indicator Registry
238
+
239
+ For dynamic indicator selection (e.g., building a UI), use the `indicatorRegistry`:
240
+
241
+ ```typescript
242
+ import { indicatorRegistry } from 'lightweight-charts-indicators';
243
+
244
+ // List all indicators
245
+ indicatorRegistry.forEach(indicator => {
246
+ console.log(`${indicator.name} (${indicator.category})`);
247
+ });
248
+
249
+ // Get indicator by ID
250
+ const sma = indicatorRegistry.find(i => i.id === 'sma');
251
+ const result = sma?.calculate(bars, sma.defaultInputs);
252
+
253
+ // Filter by category
254
+ const oscillators = indicatorRegistry.filter(i => i.category === 'Oscillators');
255
+ ```
256
+
257
+ ## Building
258
+
259
+ ```bash
260
+ npm run build
261
+ ```
262
+
263
+ ## Testing
264
+
265
+ ```bash
266
+ npm test
267
+ ```
268
+
269
+ ## License
270
+
271
+ MIT
package/dist/adr.d.ts ADDED
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Average Day Range (ADR) Indicator
3
+ *
4
+ * Hand-optimized implementation using oakscriptjs.
5
+ * Calculates the average of the daily price range (high - low) over a specified period.
6
+ */
7
+ import { type IndicatorResult, type InputConfig, type PlotConfig, type Bar } from 'oakscriptjs';
8
+ /**
9
+ * ADR indicator input parameters
10
+ */
11
+ export interface ADRInputs {
12
+ /** Period length for averaging */
13
+ lengthInput: number;
14
+ }
15
+ /**
16
+ * Default input values
17
+ */
18
+ export declare const defaultInputs: ADRInputs;
19
+ /**
20
+ * Input configuration for UI
21
+ */
22
+ export declare const inputConfig: InputConfig[];
23
+ /**
24
+ * Plot configuration
25
+ */
26
+ export declare const plotConfig: PlotConfig[];
27
+ /**
28
+ * Indicator metadata
29
+ */
30
+ export declare const metadata: {
31
+ title: string;
32
+ shortTitle: string;
33
+ overlay: boolean;
34
+ };
35
+ /**
36
+ * Calculate ADR indicator
37
+ *
38
+ * @param bars - OHLCV bar data
39
+ * @param inputs - Indicator parameters (optional, uses defaults)
40
+ * @returns Indicator result with plot data
41
+ */
42
+ export declare function calculate(bars: Bar[], inputs?: Partial<ADRInputs>): IndicatorResult;
43
+ /**
44
+ * ADR indicator module
45
+ */
46
+ export declare const ADR: {
47
+ calculate: typeof calculate;
48
+ metadata: {
49
+ title: string;
50
+ shortTitle: string;
51
+ overlay: boolean;
52
+ };
53
+ defaultInputs: ADRInputs;
54
+ inputConfig: InputConfig[];
55
+ plotConfig: PlotConfig[];
56
+ };
57
+ //# sourceMappingURL=adr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adr.d.ts","sourceRoot":"","sources":["../src/adr.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAc,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,KAAK,GAAG,EAAE,MAAM,aAAa,CAAC;AAE5G;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,kCAAkC;IAClC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,SAE3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,WAAW,EAEpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,UAAU,EAElC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;CAIpB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,MAAM,GAAE,OAAO,CAAC,SAAS,CAAM,GAAG,eAAe,CA2BvF;AAED;;GAEG;AACH,eAAO,MAAM,GAAG;;;;;;;;;;CAMf,CAAC"}
package/dist/adx.d.ts ADDED
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Average Directional Index (ADX) Indicator
3
+ *
4
+ * Measures trend strength regardless of direction.
5
+ * Uses Series-based ta functions from oakscriptjs for consistency.
6
+ */
7
+ import { type IndicatorResult, type InputConfig, type PlotConfig, type Bar } from 'oakscriptjs';
8
+ export interface ADXInputs {
9
+ /** ADX smoothing period */
10
+ adxSmoothing: number;
11
+ /** DI period length */
12
+ diLength: number;
13
+ }
14
+ export declare const defaultInputs: ADXInputs;
15
+ export declare const inputConfig: InputConfig[];
16
+ export declare const plotConfig: PlotConfig[];
17
+ export declare const metadata: {
18
+ title: string;
19
+ shortTitle: string;
20
+ overlay: boolean;
21
+ };
22
+ export declare function calculate(bars: Bar[], inputs?: Partial<ADXInputs>): IndicatorResult;
23
+ export declare const ADX: {
24
+ calculate: typeof calculate;
25
+ metadata: {
26
+ title: string;
27
+ shortTitle: string;
28
+ overlay: boolean;
29
+ };
30
+ defaultInputs: ADXInputs;
31
+ inputConfig: InputConfig[];
32
+ plotConfig: PlotConfig[];
33
+ };
34
+ //# sourceMappingURL=adx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adx.d.ts","sourceRoot":"","sources":["../src/adx.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAc,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,KAAK,GAAG,EAAE,MAAM,aAAa,CAAC;AAE5G,MAAM,WAAW,SAAS;IACxB,2BAA2B;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,uBAAuB;IACvB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,aAAa,EAAE,SAG3B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,WAAW,EAGpC,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,UAAU,EAElC,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;CAIpB,CAAC;AAEF,wBAAgB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,MAAM,GAAE,OAAO,CAAC,SAAS,CAAM,GAAG,eAAe,CA8FvF;AAED,eAAO,MAAM,GAAG;;;;;;;;;;CAMf,CAAC"}
package/dist/alma.d.ts ADDED
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Arnaud Legoux Moving Average (ALMA) Indicator
3
+ *
4
+ * Hand-optimized implementation using oakscriptjs.
5
+ * Uses a Gaussian distribution to reduce lag while maintaining smoothness.
6
+ */
7
+ import { type IndicatorResult, type InputConfig, type PlotConfig, type Bar } from 'oakscriptjs';
8
+ /**
9
+ * ALMA indicator input parameters
10
+ */
11
+ export interface ALMAInputs {
12
+ /** Period length */
13
+ lengthInput: number;
14
+ /** Offset - controls tradeoff between smoothness (closer to 1) and responsiveness (closer to 0) */
15
+ offsetInput: number;
16
+ /** Sigma - standard deviation applied for sharpness */
17
+ sigmaInput: number;
18
+ }
19
+ /**
20
+ * Default input values
21
+ */
22
+ export declare const defaultInputs: ALMAInputs;
23
+ /**
24
+ * Input configuration for UI
25
+ */
26
+ export declare const inputConfig: InputConfig[];
27
+ /**
28
+ * Plot configuration
29
+ */
30
+ export declare const plotConfig: PlotConfig[];
31
+ /**
32
+ * Indicator metadata
33
+ */
34
+ export declare const metadata: {
35
+ title: string;
36
+ shortTitle: string;
37
+ overlay: boolean;
38
+ };
39
+ /**
40
+ * Calculate ALMA indicator
41
+ *
42
+ * @param bars - OHLCV bar data
43
+ * @param inputs - Indicator parameters (optional, uses defaults)
44
+ * @returns Indicator result with plot data
45
+ */
46
+ export declare function calculate(bars: Bar[], inputs?: Partial<ALMAInputs>): IndicatorResult;
47
+ /**
48
+ * ALMA indicator module
49
+ */
50
+ export declare const ALMA: {
51
+ calculate: typeof calculate;
52
+ metadata: {
53
+ title: string;
54
+ shortTitle: string;
55
+ overlay: boolean;
56
+ };
57
+ defaultInputs: ALMAInputs;
58
+ inputConfig: InputConfig[];
59
+ plotConfig: PlotConfig[];
60
+ };
61
+ //# sourceMappingURL=alma.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alma.d.ts","sourceRoot":"","sources":["../src/alma.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAc,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,KAAK,GAAG,EAAE,MAAM,aAAa,CAAC;AAE5G;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,oBAAoB;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,mGAAmG;IACnG,WAAW,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,UAI3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,WAAW,EAIpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,UAAU,EAElC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;CAIpB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,MAAM,GAAE,OAAO,CAAC,UAAU,CAAM,GAAG,eAAe,CAyBxF;AAED;;GAEG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;CAMhB,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Aroon Indicator
3
+ *
4
+ * Identifies trend strength and potential reversals by measuring
5
+ * how long since the highest high and lowest low within the period.
6
+ * Aroon Up = 100 * (length - bars since highest high) / length
7
+ * Aroon Down = 100 * (length - bars since lowest low) / length
8
+ */
9
+ import { type IndicatorResult, type InputConfig, type PlotConfig, type Bar } from 'oakscriptjs';
10
+ export interface AroonInputs {
11
+ /** Period length */
12
+ length: number;
13
+ }
14
+ export declare const defaultInputs: AroonInputs;
15
+ export declare const inputConfig: InputConfig[];
16
+ export declare const plotConfig: PlotConfig[];
17
+ export declare const metadata: {
18
+ title: string;
19
+ shortTitle: string;
20
+ overlay: boolean;
21
+ };
22
+ export declare function calculate(bars: Bar[], inputs?: Partial<AroonInputs>): IndicatorResult;
23
+ export declare const Aroon: {
24
+ calculate: typeof calculate;
25
+ metadata: {
26
+ title: string;
27
+ shortTitle: string;
28
+ overlay: boolean;
29
+ };
30
+ defaultInputs: AroonInputs;
31
+ inputConfig: InputConfig[];
32
+ plotConfig: PlotConfig[];
33
+ };
34
+ //# sourceMappingURL=aroon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aroon.d.ts","sourceRoot":"","sources":["../src/aroon.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,KAAK,GAAG,EAAE,MAAM,aAAa,CAAC;AAEhG,MAAM,WAAW,WAAW;IAC1B,oBAAoB;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,aAAa,EAAE,WAE3B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,WAAW,EAEpC,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,UAAU,EAGlC,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;CAIpB,CAAC;AAEF,wBAAgB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,MAAM,GAAE,OAAO,CAAC,WAAW,CAAM,GAAG,eAAe,CAsDzF;AAED,eAAO,MAAM,KAAK;;;;;;;;;;CAMjB,CAAC"}
package/dist/atr.d.ts ADDED
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Average True Range (ATR) Indicator
3
+ *
4
+ * Hand-optimized implementation using oakscriptjs.
5
+ * Measures market volatility by calculating the average range between high and low prices.
6
+ */
7
+ import { type IndicatorResult, type InputConfig, type PlotConfig, type Bar } from 'oakscriptjs';
8
+ /**
9
+ * ATR indicator input parameters
10
+ */
11
+ export interface ATRInputs {
12
+ /** Period length */
13
+ length: number;
14
+ /** Smoothing method */
15
+ smoothing: 'RMA' | 'SMA' | 'EMA' | 'WMA';
16
+ }
17
+ /**
18
+ * Default input values
19
+ */
20
+ export declare const defaultInputs: ATRInputs;
21
+ /**
22
+ * Input configuration for UI
23
+ */
24
+ export declare const inputConfig: InputConfig[];
25
+ /**
26
+ * Plot configuration
27
+ */
28
+ export declare const plotConfig: PlotConfig[];
29
+ /**
30
+ * Indicator metadata
31
+ */
32
+ export declare const metadata: {
33
+ title: string;
34
+ shortTitle: string;
35
+ overlay: boolean;
36
+ };
37
+ /**
38
+ * Calculate ATR indicator
39
+ *
40
+ * @param bars - OHLCV bar data
41
+ * @param inputs - Indicator parameters (optional, uses defaults)
42
+ * @returns Indicator result with plot data
43
+ */
44
+ export declare function calculate(bars: Bar[], inputs?: Partial<ATRInputs>): IndicatorResult;
45
+ /**
46
+ * ATR indicator module
47
+ */
48
+ export declare const ATR: {
49
+ calculate: typeof calculate;
50
+ metadata: {
51
+ title: string;
52
+ shortTitle: string;
53
+ overlay: boolean;
54
+ };
55
+ defaultInputs: ATRInputs;
56
+ inputConfig: InputConfig[];
57
+ plotConfig: PlotConfig[];
58
+ };
59
+ //# sourceMappingURL=atr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"atr.d.ts","sourceRoot":"","sources":["../src/atr.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAc,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,KAAK,GAAG,EAAE,MAAM,aAAa,CAAC;AAE5G;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,oBAAoB;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,uBAAuB;IACvB,SAAS,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;CAC1C;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,SAG3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,WAAW,EAGpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,UAAU,EAElC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;CAIpB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,MAAM,GAAE,OAAO,CAAC,SAAS,CAAM,GAAG,eAAe,CAwCvF;AAED;;GAEG;AACH,eAAO,MAAM,GAAG;;;;;;;;;;CAMf,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Awesome Oscillator (AO) Indicator
3
+ *
4
+ * Measures market momentum using the difference between
5
+ * 5-period and 34-period simple moving averages of the median price.
6
+ */
7
+ import { type IndicatorResult, type InputConfig, type PlotConfig, type Bar } from 'oakscriptjs';
8
+ export interface AwesomeOscillatorInputs {
9
+ /** Fast SMA period */
10
+ fastPeriod: number;
11
+ /** Slow SMA period */
12
+ slowPeriod: number;
13
+ }
14
+ export declare const defaultInputs: AwesomeOscillatorInputs;
15
+ export declare const inputConfig: InputConfig[];
16
+ export declare const plotConfig: PlotConfig[];
17
+ export declare const metadata: {
18
+ title: string;
19
+ shortTitle: string;
20
+ overlay: boolean;
21
+ };
22
+ export declare function calculate(bars: Bar[], inputs?: Partial<AwesomeOscillatorInputs>): IndicatorResult;
23
+ export declare const AwesomeOscillator: {
24
+ calculate: typeof calculate;
25
+ metadata: {
26
+ title: string;
27
+ shortTitle: string;
28
+ overlay: boolean;
29
+ };
30
+ defaultInputs: AwesomeOscillatorInputs;
31
+ inputConfig: InputConfig[];
32
+ plotConfig: PlotConfig[];
33
+ };
34
+ //# sourceMappingURL=awesome-oscillator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"awesome-oscillator.d.ts","sourceRoot":"","sources":["../src/awesome-oscillator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAc,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,KAAK,GAAG,EAAE,MAAM,aAAa,CAAC;AAE5G,MAAM,WAAW,uBAAuB;IACtC,sBAAsB;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,sBAAsB;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,aAAa,EAAE,uBAG3B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,WAAW,EAGpC,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,UAAU,EAElC,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;CAIpB,CAAC;AAEF,wBAAgB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,MAAM,GAAE,OAAO,CAAC,uBAAuB,CAAM,GAAG,eAAe,CA6BrG;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;CAM7B,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Bollinger BandWidth Indicator
3
+ *
4
+ * Measures the width of Bollinger Bands as a percentage of the basis.
5
+ * BBW = ((Upper - Lower) / Basis) * 100
6
+ * Useful for identifying squeezes (low values) and expansions (high values).
7
+ */
8
+ import { type IndicatorResult, type InputConfig, type PlotConfig, type Bar, type SourceType } from 'oakscriptjs';
9
+ export interface BBBandWidthInputs {
10
+ /** Period length */
11
+ length: number;
12
+ /** Price source */
13
+ src: SourceType;
14
+ /** Standard deviation multiplier */
15
+ mult: number;
16
+ /** Highest expansion lookback length */
17
+ expansionLength: number;
18
+ /** Lowest contraction lookback length */
19
+ contractionLength: number;
20
+ }
21
+ export declare const defaultInputs: BBBandWidthInputs;
22
+ export declare const inputConfig: InputConfig[];
23
+ export declare const plotConfig: PlotConfig[];
24
+ export declare const metadata: {
25
+ title: string;
26
+ shortTitle: string;
27
+ overlay: boolean;
28
+ };
29
+ export declare function calculate(bars: Bar[], inputs?: Partial<BBBandWidthInputs>): IndicatorResult;
30
+ export declare const BBBandWidth: {
31
+ calculate: typeof calculate;
32
+ metadata: {
33
+ title: string;
34
+ shortTitle: string;
35
+ overlay: boolean;
36
+ };
37
+ defaultInputs: BBBandWidthInputs;
38
+ inputConfig: InputConfig[];
39
+ plotConfig: PlotConfig[];
40
+ };
41
+ //# sourceMappingURL=bb-bandwidth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bb-bandwidth.d.ts","sourceRoot":"","sources":["../src/bb-bandwidth.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAuB,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,KAAK,GAAG,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAEtI,MAAM,WAAW,iBAAiB;IAChC,oBAAoB;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB;IACnB,GAAG,EAAE,UAAU,CAAC;IAChB,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,eAAe,EAAE,MAAM,CAAC;IACxB,yCAAyC;IACzC,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,eAAO,MAAM,aAAa,EAAE,iBAM3B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,WAAW,EAMpC,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,UAAU,EAIlC,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;CAIpB,CAAC;AAEF,wBAAgB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,MAAM,GAAE,OAAO,CAAC,iBAAiB,CAAM,GAAG,eAAe,CA+D/F;AAED,eAAO,MAAM,WAAW;;;;;;;;;;CAMvB,CAAC"}