Skip to content

Commit 895e495

Browse files
authored
Merge pull request #33 from QuantForgeOrg/dev
[0.5.0] - 2025-12-04 - Extensive TA implementation & Transpiler enhancements
2 parents b905366 + 9b34eb6 commit 895e495

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+8114
-555
lines changed

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
# Change Log
22

3+
## [0.5.0] - 2025-12-04 - Extensive TA implementation & Transpiler enhancements
4+
5+
### Added
6+
7+
- Comprehensive implementation of `ta` namespace methods:
8+
- **Trend**: `supertrend`, `dmi`, `sar`, `falling`, `rising`, `cross`
9+
- **Volatility/Range**: `bb` (Bollinger Bands), `bbw`, `kc` (Keltner Channels), `kcw`, `range`, `tr` (True Range as method)
10+
- **Volume**: `accdist`, `cum`, `iii`, `nvi`, `pvi`, `pvt`, `wad`, `wvad`
11+
- **Oscillators**: `cci`, `cmo`, `cog`, `mfi`, `stoch`, `tsi`, `wpr`
12+
- **Statistical/Rank**: `correlation`, `barssince`, `valuewhen`, `percentrank`, `percentile_linear_interpolation`, `percentile_nearest_rank`, `mode`, `highestbars`, `lowestbars`
13+
- Core `bar_index` variable support
14+
15+
### Changed
16+
17+
- **Unified Namespace Architecture**: All namespace members (e.g., `ta.tr`, `ta.obv`) are now implemented as methods. The transpiler automatically handles the conversion from property access to method call (e.g., `ta.tr``ta.tr()`)
18+
- Updated `ta.tr` and `ta.obv` to align with the unified method pattern
19+
20+
### Fixed
21+
22+
- **`var` keyword semantics**: Implemented correct Pine Script behavior for `var` variables (initialize once, persist state across bars) via `$.initVar`
23+
- `math.sum` handling of `NaN` values
24+
- Transpiler handling of tertiary conditions involving Series access
25+
- `ta.supertrend` calculation logic
26+
327
## [0.4.0] - TBD - Request.security implementation and transpiler enhancements
428

529
### Added
@@ -10,6 +34,7 @@
1034
- Support for handling raw .pine.ts indicator code (without context function wrapper)
1135
- Ability to show original code lines in transpiled code as comments for debugging
1236
- Comprehensive unit tests for `request.security()` functionality
37+
- harmonization of Series logic accross the codebase
1338

1439
### Changed
1540

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ PineTS is used to generate plot data, and tradingview light weight chart is used
2828
## Key Features
2929

3030
- **Pine Script Compatibility**: Supports Pine Script v5+ syntax and functionality
31+
- **High Precision**: Aims for the same precision as Pine Script (up to the 8th digit)
3132
- **Time-Series Processing**: Handles historical data and series operations
3233
- **Technical Analysis Functions**: Comprehensive set of TA indicators and calculations
3334
- **Mathematical Operations**: Advanced mathematical functions and precision handling
@@ -156,6 +157,8 @@ const { result } = await pineTS.run((context) => {
156157

157158
## Project Goals
158159

160+
PineTS aims for **full coverage** of Pine Script functions and capabilities. The ultimate goal is to enable running **original Pine Script code directly** without manual conversion to PineTS syntax.
161+
159162
- Runtime Transpiler
160163
- Core Pine Script functions and variables
161164
- Series and scope management

docs/api-coverage/ta.md

Lines changed: 43 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ All functions listed below are verified to exist in Pine Script v5.
1919
| `ta.rma()` || Rolling/Running Moving Average |
2020
| `ta.vwma()` || Volume Weighted Moving Average |
2121
| `ta.alma()` || Arnaud Legoux Moving Average |
22-
| `ta.linreg()` | ✔️ | Linear Regression |
22+
| `ta.linreg()` | | Linear Regression |
2323
| `ta.swma()` || Symmetrically Weighted Moving Average |
2424
| `ta.vwap` || Volume Weighted Average Price (variable) |
2525

@@ -32,13 +32,13 @@ All functions listed below are verified to exist in Pine Script v5.
3232
| `ta.mom()` || Momentum |
3333
| `ta.roc()` || Rate of Change |
3434
| `ta.macd()` || Moving Average Convergence Divergence |
35-
| `ta.stoch()` | | Stochastic Oscillator |
36-
| `ta.cci()` | | Commodity Channel Index |
37-
| `ta.mfi()` | | Money Flow Index |
38-
| `ta.cmo()` | | Chande Momentum Oscillator |
39-
| `ta.cog()` | | Center of Gravity |
40-
| `ta.tsi()` | | True Strength Index |
41-
| `ta.wpr()` | | Williams %R |
35+
| `ta.stoch()` | | Stochastic Oscillator |
36+
| `ta.cci()` | | Commodity Channel Index |
37+
| `ta.mfi()` | | Money Flow Index |
38+
| `ta.cmo()` | | Chande Momentum Oscillator |
39+
| `ta.cog()` | | Center of Gravity |
40+
| `ta.tsi()` | | True Strength Index |
41+
| `ta.wpr()` | | Williams %R |
4242

4343
### Volatility & Range
4444

@@ -48,39 +48,39 @@ All functions listed below are verified to exist in Pine Script v5.
4848
| `ta.stdev()` || Standard Deviation |
4949
| `ta.variance()` || Variance |
5050
| `ta.dev()` || Mean Absolute Deviation |
51-
| `ta.tr` | ✔️ | True Range (variable) |
52-
| `ta.tr()` | ✔️ | True Range (function) |
53-
| `ta.bb()` | | Bollinger Bands |
54-
| `ta.bbw()` | | Bollinger Bands Width |
55-
| `ta.kc()` | | Keltner Channels |
56-
| `ta.kcw()` | | Keltner Channels Width |
57-
| `ta.range()` | | Range |
51+
| `ta.tr` | | True Range (variable) |
52+
| `ta.tr()` | | True Range (function) |
53+
| `ta.bb()` | | Bollinger Bands |
54+
| `ta.bbw()` | | Bollinger Bands Width |
55+
| `ta.kc()` | | Keltner Channels |
56+
| `ta.kcw()` | | Keltner Channels Width |
57+
| `ta.range()` | | Range |
5858

5959
### Trend Analysis
6060

6161
| Function | Status | Description |
6262
| ----------------- | ------ | ---------------------------------- |
63-
| `ta.crossover()` | ✔️ | Crossover Detection |
64-
| `ta.crossunder()` | ✔️ | Crossunder Detection |
65-
| `ta.cross()` | | Cross Detection (either direction) |
66-
| `ta.rising()` | | Rising Trend Detection |
67-
| `ta.falling()` | | Falling Trend Detection |
68-
| `ta.dmi()` | | Directional Movement Index |
69-
| `ta.supertrend()` | ✔️ | SuperTrend Indicator |
70-
| `ta.sar()` | | Parabolic SAR |
63+
| `ta.crossover()` | | Crossover Detection |
64+
| `ta.crossunder()` | | Crossunder Detection |
65+
| `ta.cross()` | | Cross Detection (either direction) |
66+
| `ta.rising()` | | Rising Trend Detection |
67+
| `ta.falling()` | | Falling Trend Detection |
68+
| `ta.dmi()` | | Directional Movement Index |
69+
| `ta.supertrend()` | | SuperTrend Indicator |
70+
| `ta.sar()` | | Parabolic SAR |
7171

7272
### Volume Indicators
7373

7474
| Function | Status | Description |
7575
| ------------ | ------ | ------------------------------------------------------ |
76-
| `ta.obv` | | On-Balance Volume (variable) |
77-
| `ta.pvt` | | Price-Volume Trend (variable) |
78-
| `ta.wad` | | Williams Accumulation/Distribution (variable) |
79-
| `ta.wvad` | | Williams Variable Accumulation/Distribution (variable) |
80-
| `ta.accdist` | | Accumulation/Distribution (variable) |
81-
| `ta.nvi` | | Negative Volume Index (variable) |
82-
| `ta.pvi` | | Positive Volume Index (variable) |
83-
| `ta.iii` | | Intraday Intensity Index (variable) |
76+
| `ta.obv` | | On-Balance Volume (variable) |
77+
| `ta.pvt` | | Price-Volume Trend (variable) |
78+
| `ta.wad` | | Williams Accumulation/Distribution (variable) |
79+
| `ta.wvad` | | Williams Variable Accumulation/Distribution (variable) |
80+
| `ta.accdist` | | Accumulation/Distribution (variable) |
81+
| `ta.nvi` | | Negative Volume Index (variable) |
82+
| `ta.pvi` | | Positive Volume Index (variable) |
83+
| `ta.iii` | | Intraday Intensity Index (variable) |
8484

8585
### Statistical Functions
8686

@@ -89,37 +89,25 @@ All functions listed below are verified to exist in Pine Script v5.
8989
| `ta.highest()` || Highest Value |
9090
| `ta.lowest()` || Lowest Value |
9191
| `ta.median()` || Median Value |
92-
| `ta.mode()` || Mode Value |
93-
| `ta.highestbars()` || Bars Since Highest |
94-
| `ta.lowestbars()` || Bars Since Lowest |
95-
| `ta.percentrank()` || Percentile Rank |
96-
| `ta.percentile_linear_interpolation()` || Percentile (Linear) |
97-
| `ta.percentile_nearest_rank()` || Percentile (Nearest Rank) |
98-
| `ta.correlation()` || Correlation Coefficient |
99-
| `ta.covariance()` || Covariance |
92+
| `ta.mode()` || Mode Value |
93+
| `ta.highestbars()` || Bars Since Highest |
94+
| `ta.lowestbars()` || Bars Since Lowest |
95+
| `ta.percentrank()` || Percentile Rank |
96+
| `ta.percentile_linear_interpolation()` || Percentile (Linear) |
97+
| `ta.percentile_nearest_rank()` || Percentile (Nearest Rank) |
98+
| `ta.correlation()` || Correlation Coefficient |
10099

101100
### Support & Resistance
102101

103102
| Function | Status | Description |
104103
| ---------------- | ------ | -------------------- |
105-
| `ta.pivothigh()` | ✔️ | Pivot High Detection |
106-
| `ta.pivotlow()` | ✔️ | Pivot Low Detection |
104+
| `ta.pivothigh()` | | Pivot High Detection |
105+
| `ta.pivotlow()` | | Pivot Low Detection |
107106

108107
### Utility Functions
109108

110109
| Function | Status | Description |
111110
| ---------------- | ------ | ------------------------ |
112-
| `ta.valuewhen()` || Value When Condition Met |
113-
| `ta.barssince()` || Bars Since Condition |
114-
| `ta.cum()` || Cumulative Sum |
115-
116-
### Legend
117-
118-
- ✅ Fully implemented and tested
119-
- ✔️ Implemented (may need more testing)
120-
- ⬜ Not yet implemented
121-
122-
### Notes
123-
124-
- Some indicators exist as both variables and functions (e.g., `ta.vwap`, `ta.tr`)
125-
- `ta.adx()` is **not** a standalone function in Pine Script v5 (it's part of `ta.dmi()`)
111+
| `ta.valuewhen()` || Value When Condition Met |
112+
| `ta.barssince()` || Bars Since Condition |
113+
| `ta.cum()` || Cumulative Sum |

0 commit comments

Comments
 (0)