Skip to content

Commit b57d38b

Browse files
committed
Update readme, documentation and changelog
1 parent 5a2ab31 commit b57d38b

File tree

5 files changed

+32
-6
lines changed

5 files changed

+32
-6
lines changed

CHANGELOG.md

Lines changed: 24 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

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ All functions listed below are verified to exist in Pine Script v5.
108108

109109
| Function | Status | Description |
110110
| ---------------- | ------ | ------------------------ |
111-
| `ta.valuewhen()` | | Value When Condition Met |
111+
| `ta.valuewhen()` | | Value When Condition Met |
112112
| `ta.barssince()` || Bars Since Condition |
113113
| `ta.cum()` || Cumulative Sum |
114114

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pinets",
3-
"version": "0.4.0",
3+
"version": "0.5.0",
44
"description": "",
55
"main": "dist/pinets.dev.es.js",
66
"types": "dist/types/index.d.ts",

src/namespaces/ta/methods/valuewhen.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export function valuewhen(context: any) {
1818
};
1919
}
2020
const state = context.taState[stateKey];
21-
21+
2222
const cond = Series.from(condition).get(0);
2323
const val = Series.from(source).get(0);
2424
const occurrence = Series.from(_occurrence).get(0);
@@ -32,18 +32,17 @@ export function valuewhen(context: any) {
3232
}
3333

3434
const index = state.values.length - 1 - occurrence;
35-
35+
3636
if (index < 0) {
3737
return NaN;
3838
}
3939

4040
const result = state.values[index];
41-
41+
4242
// Check if result is a number to apply precision, else return as is (e.g. boolean/color)
4343
if (typeof result === 'number') {
4444
return context.precision(result);
4545
}
4646
return result;
4747
};
4848
}
49-

0 commit comments

Comments
 (0)