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.
npm install pinets
Run Pine Script Anywhere
Execute TradingView indicators in Node.js, browsers, and any JavaScript runtime
Quick Start •
Features •
Live Demos •
Usage •
API Coverage •
Docs
javascript
import { PineTS, Provider } from 'pinets';
const pineTS = new PineTS(Provider.Binance, 'BTCUSDT', '1h', 100);
// Run native Pine Script directly
const { plots } = await pineTS.run(
);
`
> What is Pine Script?
> Pine Script is a domain-specific programming language created by TradingView for writing custom technical analysis indicators and strategies.
> _Disclaimer : PineTS is an independent project and is not affiliated with, endorsed by, or associated with TradingView or Pine Script™. All trademarks and registered trademarks mentioned belong to their respective owners._
---
Why PineTS?
| Challenge | PineTS Solution |
| ------------------------------------------- | ---------------------------------------------------- |
| Pine Script only runs on TradingView | Run indicators on your own infrastructure |
| Can't integrate indicators with custom apps | Full JavaScript/TypeScript integration |
| Limited to TradingView's data sources | Use any data source (Binance, custom APIs, CSV) |
| No programmatic access to indicator values | Get raw values for backtesting, alerts, ML pipelines |
| Can't run indicators server-side | Works in Node.js, Deno, Bun, browsers |
---
Quick Start
$3
`bash
npm install pinets
`
$3
`javascript
import { PineTS, Provider } from 'pinets';
// Initialize with Binance data
const pineTS = new PineTS(Provider.Binance, 'BTCUSDT', '1h', 100);
// Calculate a simple moving average
const { plots } = await pineTS.run(
);
console.log('SMA values:', plots['SMA 20'].data);
`
That's it! You're running Pine Script in JavaScript.
---
Features
$3
- Native Pine Script v5/v6 : Run original TradingView code directly _(experimental)_
- 60+ Technical Indicators : SMA, EMA, RSI, MACD, Bollinger Bands, and more
- Time-Series Processing : Full Pine Script semantics with lookback support
- Real-time Streaming : Live data processing with event-based updates
- Multi-Timeframe Analysis : request.security() for MTF indicators
- High Precision : Matches TradingView's calculation precision
$3
Native Pine Script
PineTS Syntax (JavaScript)
`pinescript
//@version=5
indicator("RSI Strategy")
rsi = ta.rsi(close, 14)
sma = ta.sma(rsi, 10)
plot(rsi, "RSI")
plot(sma, "Signal")
`
`javascript
//@PineTS
indicator('RSI Strategy');
const rsi = ta.rsi(close, 14);
const sma = ta.sma(rsi, 10);
plot(rsi, 'RSI');
plot(sma, 'Signal');
`
---
Live Demos
See PineTS in action with these browser-based examples:
- Williams Vix Fix : Volatility-based indicator
- Squeeze Momentum : Momentum oscillator
- Playground : Test your own Pine Script code
_Demos are Built with PineTS + QFChart_
---
Usage
$3
`javascript
import { PineTS, Provider } from 'pinets';
const pineTS = new PineTS(Provider.Binance, 'BTCUSDT', 'D', 200);
const { plots } = await pineTS.run(
);
// Access the calculated values
console.log('MACD Line:', plots['MACD'].data);
console.log('Signal Line:', plots['Signal'].data);
`
$3
`javascript
import { PineTS, Provider } from 'pinets';
const pineTS = new PineTS(Provider.Binance, 'ETHUSDT', '4h', 100);
const { plots } = await pineTS.run(($) => {
const { close, high, low } = $.data;
const { ta, plot, plotchar } = $.pine;
// Calculate indicators
const ema9 = ta.ema(close, 9);
const ema21 = ta.ema(close, 21);
const atr = ta.atr(14);
// Detect crossovers
const bullish = ta.crossover(ema9, ema21);
const bearish = ta.crossunder(ema9, ema21);
// Plot results
plot(ema9, 'Fast EMA');
plot(ema21, 'Slow EMA');
plotchar(bullish, 'Buy Signal');
plotchar(bearish, 'Sell Signal');
return { ema9, ema21, atr, bullish, bearish };
});
`
$3
`javascript
import { PineTS, Provider } from 'pinets';
const pineTS = new PineTS(Provider.Binance, 'BTCUSDT', '1m');
const stream = pineTS.stream(
,
{ live: true, interval: 1000 }
);
stream.on('data', (ctx) => {
const rsi = ctx.plots['RSI'].data.slice(-1)[0].value;
console.log(RSI: ${rsi.toFixed(2)});
if (rsi < 30) console.log('Oversold!');
if (rsi > 70) console.log('Overbought!');
});
stream.on('error', (err) => console.error('Stream error:', err));
`
$3
`javascript
import { PineTS } from 'pinets';
// Your own OHLCV data
const candles = [
{ open: 100, high: 105, low: 99, close: 103, volume: 1000, openTime: 1704067200000 },
{ open: 103, high: 108, low: 102, close: 107, volume: 1200, openTime: 1704153600000 },
// ... more candles
];
const pineTS = new PineTS(candles);
const { plots } = await pineTS.run(
);
`
---
API Coverage
PineTS aims for complete Pine Script API compatibility. Current status:
$3






$3




$3




$3









$3



> Click any badge to see detailed function-level coverage
---
Documentation
- Full Documentation — Complete guides and API reference
- Initialization Guide — Setup options and configuration
- Architecture Overview — How PineTS works internally
- API Coverage Details — Function-by-function compatibility
---
Use Cases
Algorithmic Trading
- Build custom trading bots using Pine Script strategies
- Integrate indicators with your execution systems
Backtesting
- Test Pine Script strategies against historical data
- Export indicator values for analysis in Python/R
Alert Systems
- Create custom alert pipelines based on indicator signals
- Monitor multiple assets with server-side indicator calculations
Research & Analysis
- Process large datasets with Pine Script indicators
- Feed indicator outputs into machine learning models
Custom Dashboards
- Embed live indicators in web applications
- Build real-time monitoring dashboards
---
Roadmap
| Status | Feature |
| ------ | ----------------------------------------- |
| ✅ | Native Pine Script v5/v6 support |
| ✅ | 60+ technical analysis functions |
| ✅ | Arrays, matrices, and maps |
| ✅ | Real-time streaming |
| ✅ | Multi-timeframe with request.security()` |
Built with passion by QuantForge