Link to the source code
Pine Script execution and backtesting system using @backtest-kit/pinets and real market data via CCXT.
Demonstrates Pine Script integration capabilities for:
request.security calls.pine indicator files directly from Node.jsdemo/pinets/
├── math/
│ └── test_request_security.pine # Example Pine Script indicator
├── src/
│ └── index.mjs # Main runner configuration
├── dump/ # Cached candle data (auto-generated)
├── package.json # Dependencies and scripts
└── README.md # This file
# Navigate to project directory
cd demo/pinets
# Install dependencies
npm install
# Run the Pine Script
npm start
The runner is pre-configured in src/index.mjs:
const SIGNAL_SCHEMA = {
position: "Position",
close: "Close",
btcClose: "BTC Close",
};
Maps Pine Script plot names to markdown column headers.
Run the indicator and print markdown output:
npm start
Output:
| Time | Position | Close | BTC Close |
|------|----------|-------|-----------|
| ... | 0 | ... | ... |
Edit src/index.mjs:
const plots = await run(
File.fromPath("test_request_security.pine", "./math"),
{
symbol: "BTCUSDT", // Change symbol
timeframe: "1h", // Change timeframe
limit: 100, // Change candle count
},
"ccxt-exchange",
new Date("2025-10-01T00:00:00.000Z"),
);
Create a new .pine file in ./math/ and reference it in src/index.mjs:
const plots = await run(
File.fromPath("my_indicator.pine", "./math"),
{ symbol: "SOLUSDT", timeframe: "5m", limit: 200 },
"ccxt-exchange",
new Date("2025-10-01T00:00:00.000Z"),
);
addExchangeSchema registers a named exchange that fetches OHLCV candles via CCXT:
addExchangeSchema({
exchangeName: "ccxt-exchange",
getCandles: async (symbol, interval, since, limit) => { ... },
});
run() loads the .pine file, feeds it candles from the registered exchange, and resolves all request.security calls using the same exchange.
toMarkdown() converts the returned plot arrays into a markdown table, keyed by SIGNAL_SCHEMA.
MIT © tripolskypetr