pinets 0.9.23 → 0.9.24

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.
@@ -29,6 +29,10 @@ import { tan } from './methods/tan';
29
29
  import { todegrees } from './methods/todegrees';
30
30
  import { toradians } from './methods/toradians';
31
31
  import { __eq } from './methods/__eq';
32
+ import { __ge } from './methods/__ge';
33
+ import { __gt } from './methods/__gt';
34
+ import { __le } from './methods/__le';
35
+ import { __lt } from './methods/__lt';
32
36
  import { __neq } from './methods/__neq';
33
37
  declare const methods: {
34
38
  abs: typeof abs;
@@ -62,6 +66,10 @@ declare const methods: {
62
66
  todegrees: typeof todegrees;
63
67
  toradians: typeof toradians;
64
68
  __eq: typeof __eq;
69
+ __ge: typeof __ge;
70
+ __gt: typeof __gt;
71
+ __le: typeof __le;
72
+ __lt: typeof __lt;
65
73
  __neq: typeof __neq;
66
74
  };
67
75
  export declare class PineMath {
@@ -98,6 +106,10 @@ export declare class PineMath {
98
106
  todegrees: ReturnType<typeof methods.todegrees>;
99
107
  toradians: ReturnType<typeof methods.toradians>;
100
108
  __eq: ReturnType<typeof methods.__eq>;
109
+ __ge: ReturnType<typeof methods.__ge>;
110
+ __gt: ReturnType<typeof methods.__gt>;
111
+ __le: ReturnType<typeof methods.__le>;
112
+ __lt: ReturnType<typeof methods.__lt>;
101
113
  __neq: ReturnType<typeof methods.__neq>;
102
114
  constructor(context: any);
103
115
  }
@@ -1 +1 @@
1
- export declare function __eq(context: any): (a: any, b: any) => boolean;
1
+ export declare function __eq(context: any): (a: any, b: any) => number | boolean;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Pine Script na-aware "greater than or equal" (`>=`).
3
+ *
4
+ * - If either operand is `na`, the result is `na` (matching TradingView).
5
+ * - Values equal within an absolute 1e-10 tolerance are treated as equal, so
6
+ * `>=` is true — matching TradingView's relational tolerance.
7
+ */
8
+ export declare function __ge(context: any): (a: any, b: any) => number | boolean;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Pine Script na-aware "greater than" (`>`).
3
+ *
4
+ * - If either operand is `na`, the result is `na` (matching TradingView).
5
+ * - Values equal within an absolute 1e-10 tolerance are treated as equal, so
6
+ * `>` is false — matching TradingView's relational tolerance.
7
+ */
8
+ export declare function __gt(context: any): (a: any, b: any) => number | boolean;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Pine Script na-aware "less than or equal" (`<=`).
3
+ *
4
+ * - If either operand is `na`, the result is `na` (matching TradingView).
5
+ * - Values equal within an absolute 1e-10 tolerance are treated as equal, so
6
+ * `<=` is true — matching TradingView's relational tolerance.
7
+ */
8
+ export declare function __le(context: any): (a: any, b: any) => number | boolean;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Pine Script na-aware "less than" (`<`).
3
+ *
4
+ * - If either operand is `na`, the result is `na` (matching TradingView:
5
+ * `na(na < 1)` is `true`). na is falsy, so branch/ternary outcomes are
6
+ * unchanged.
7
+ * - Values equal within an absolute 1e-10 tolerance are treated as equal, so
8
+ * `<` is false — matching TradingView's relational tolerance.
9
+ */
10
+ export declare function __lt(context: any): (a: any, b: any) => number | boolean;
@@ -1,13 +1,16 @@
1
1
  /**
2
2
  * Pine Script na-aware inequality comparison.
3
3
  *
4
- * In Pine Script, any comparison involving `na` returns `false`:
5
- * na != na false
6
- * 1 != na → false
7
- * na != 1 false
4
+ * In Pine Script, any comparison involving `na` evaluates to `na` (NOT a
5
+ * usable boolean) — verified against TradingView (`na(na != na)` is `true`):
6
+ * na != na → na
7
+ * 1 != na na
8
+ * na != 1 → na
8
9
  *
9
- * This cannot be implemented as `!__eq(a, b)` because __eq(na, na) returns
10
- * false, and !false = true — which is wrong. Both == and != must independently
11
- * return false when either operand is na.
10
+ * This cannot be implemented as `!__eq(a, b)`: `__eq(na, na)` is `na` and
11
+ * `!na` would be `true` — wrong. Both `==` and `!=` must independently
12
+ * propagate `na` when either operand is na. `na` is falsy, so branch/ternary
13
+ * outcomes are unchanged; the difference is only observable via `na()`/`nz()`
14
+ * or arithmetic on the result.
12
15
  */
13
- export declare function __neq(context: any): (a: any, b: any) => boolean;
16
+ export declare function __neq(context: any): (a: any, b: any) => number | boolean;
@@ -20,6 +20,7 @@ export declare const ASTFactory: {
20
20
  createSetCall(target: any, value: any): any;
21
21
  createMathEqCall(left: any, right: any): any;
22
22
  createMathNeqCall(left: any, right: any): any;
23
+ createMathCompareCall(method: string, left: any, right: any): any;
23
24
  createWrapperFunction(body: any): any;
24
25
  createVariableDeclaration(name: string, init: any): any;
25
26
  createAwaitExpression(argument: any): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinets",
3
- "version": "0.9.23",
3
+ "version": "0.9.24",
4
4
  "description": "Run Pine Script anywhere. PineTS is an open-source transpiler and runtime that brings Pine Script logic to Node.js and the browser with 1:1 syntax compatibility. Reliably write, port, and run indicators or strategies on your own infrastructure.",
5
5
  "keywords": [
6
6
  "Pine Script",