We’re excited to announce PineTS v0.8.0, featuring runtime input overrides, live data streaming, expanded plot functions, and full support for user-defined types. This release represents a major step forward in making PineTS production-ready for real-world trading applications.
What’s New from v0.7.5 to v0.8.0
Runtime Indicator Inputs
The headline feature of v0.8.0 is the new Indicator class, which allows you to override input parameters at runtime without modifying your Pine Script source code.
import { PineTS, Provider, Indicator } from 'pinets';
const pineTS = new PineTS(Provider.Binance, 'BTCUSDT', '1h', 100);
const code = `
//@version=6
indicator("Dynamic RSI")
len = input.int(14, "Length")
src = input.source(close, "Source")
plot(ta.rsi(src, len))
`;
// Override default input values at runtime
const indicator = new Indicator(code, {
"Length": 50,
"Source": "high"
});
const { result } = await pineTS.run(indicator);
This feature enables powerful use cases:
- Strategy Optimization: Test multiple parameter combinations without code changes
- User-Configurable Dashboards: Let users adjust indicator settings through your UI
- A/B Testing: Run the same indicator with different parameters simultaneously
- Multi-Asset Scanning: Apply consistent logic across symbols with custom parameters
The enhanced input.* namespace methods automatically resolve values from runtime inputs via context.inputs, falling back to default values when not provided.
Live Data Streaming
The PineTS.stream() method provides an event-driven interface for handling live market data and real-time indicator updates.
const pineTS = new PineTS(Provider.Binance, 'BTCUSDT', '1m', 100);
const stream = pineTS.stream(
`
//@version=6
indicator("Live Momentum")
rsi = ta.rsi(close, 14)
ema = ta.ema(close, 20)
bullish = ta.crossover(close, ema) and rsi < 50
plotshape(bullish, "Buy", shape.triangleup, location.belowbar, color.green)
`,
{
pageSize: 50,
live: true,
interval: 2000, // Poll every 2 seconds
}
);
stream.on('data', (ctx) => {
const { rsi, ema, bullish } = ctx.result;
if (bullish[bullish.length - 1]) {
console.log('Buy signal detected at', new Date());
// Execute your trading logic here
}
});
stream.on('error', (err) => console.error('Stream error:', err));
// Graceful shutdown
process.on('SIGINT', () => stream.stop());
The streaming interface handles pagination, state management, and WebSocket reconnections automatically, making it ideal for building real-time trading bots and monitoring dashboards.
Enhanced Plot Functions
PineTS now supports the complete suite of Pine Script visualization functions, enabling visual parity with TradingView when paired with a charting library like QFChart.
Candlestick Rendering
//@version=6
indicator("Heikin Ashi", overlay=true)
haClose = (open + high + low + close) / 4
haOpen = float(na)
haOpen := na(haOpen[1]) ? (open + close) / 2 : (haOpen[1] + haClose[1]) / 2
haHigh = math.max(high, math.max(haOpen, haClose))
haLow = math.min(low, math.min(haOpen, haClose))
plotcandle(haOpen, haHigh, haLow, haClose, "HA", color.blue)
Traditional Bar Charts
//@version=6
indicator("OHLC Bars", overlay=true)
plotbar(open, high, low, close, "Bars", color.gray)
Background Colors
//@version=6
indicator("Trend Background")
ema20 = ta.ema(close, 20)
bullish = close > ema20
bgcolor(bullish ? color.new(color.green, 90) : color.new(color.red, 90))
Dynamic Candle Colors
//@version=6
indicator("Volume Highlight", overlay=true)
avgVol = ta.sma(volume, 20)
highVol = volume > avgVol * 1.5
barcolor(highVol ? color.yellow : na)
These additions complete the visual rendering capabilities, allowing you to build custom charting interfaces that match TradingView’s appearance and behavior.
User-Defined Types Support
Full support for Pine Script v5/v6 User-Defined Types (UDTs) enables better code organization and data encapsulation.
//@version=6
indicator("Order Book Tracker")
type OrderLevel
float price
float quantity
int timestamp
type OrderBook
OrderLevel[] bids
OrderLevel[] asks
updateBook(OrderBook book, float newPrice, float newQty) =>
level = OrderLevel.new(newPrice, newQty, time)
array.push(book.bids, level)
book
var book = OrderBook.new(array.new<OrderLevel>(), array.new<OrderLevel>())
book := updateBook(book, close, volume)
UDTs now correctly transpile to Type({...}) syntax (fixed in v0.8.0), ensuring full compatibility with PineTS’s series system and state management.
Installation & Upgrade
Install or upgrade to the latest version:
npm install pinets@latest
Documentation
Complete documentation is available at quantforgeorg.github.io/PineTS, including:
Bug Fixes
This release includes several important fixes:
- v0.8.0: Fixed UDT transpilation to use
Type({...})syntax instead of JavaScript classes for proper runtime compatibility - v0.7.9: Resolved cache collision issues in user-defined functions containing
ta.*calls through improved context stack management - v0.7.7: Corrected live data processing to properly handle current vs committed candles in
ta.*functions
What’s Next
The next release will focus on implementing the remaining visualization functions: chart.*, label.*, line.*, box.*, table.*, linefill.*, and polyline.*. These additions will complete PineTS’s drawing and annotation capabilities, bringing full visual parity with TradingView’s charting features.
Get Involved
PineTS is open-source (AGPL-3.0) and community-driven. We welcome contributions, bug reports, and feature requests.
PineTS is an independent open-source project and is not affiliated with, endorsed by, or associated with TradingView or Pine Script™. All trademarks belong to their respective owners.

Leave a Reply