The easiest way to create a new Backtest Kit trading bot project. Scaffolds a multi-timeframe crypto trading strategy with Pine Script indicators via PineTS runtime, 4H trend filter + 15m signal generator, partial profit taking, breakeven trailing stops, and risk validation.

π Backtest Kit Docs | π GitHub
@backtest-kit/pinets@backtest-kit/uinpx -y @backtest-kit/sidekick my-trading-bot
cd my-trading-bot
npm start
That's it! You now have a working trading bot with:
my-trading-bot/
βββ src/
β βββ index.mjs # Entry point β loads config, logic, bootstrap
β βββ main/bootstrap.mjs # Mode dispatcher (backtest / paper / live)
β βββ config/
β β βββ setup.mjs # Logger, storage, notifications, UI server
β β βββ validate.mjs # Schema validation for all enums
β β βββ params.mjs # Environment variables (Ollama API key)
β β βββ ccxt.mjs # Binance exchange singleton via CCXT
β βββ logic/
β β βββ strategy/main.strategy.mjs # Main strategy β multi-TF signal logic
β β βββ exchange/binance.exchange.mjs # Exchange schema β candles, order book, formatting
β β βββ frame/*.frame.mjs # Backtest time frames (Feb 2024, OctβDec 2025)
β β βββ risk/sl_distance.risk.mjs # Stop-loss distance validation (β₯0.2%)
β β βββ risk/tp_distance.risk.mjs # Take-profit distance validation (β₯0.2%)
β β βββ action/
β β βββ backtest_partial_profit_taking.action.mjs
β β βββ backtest_lower_stop_on_breakeven.action.mjs
β β βββ backtest_position_monitor.action.mjs
β βββ classes/
β β βββ BacktestPartialProfitTakingAction.mjs # Scale out at 3 TP levels
β β βββ BacktestLowerStopOnBreakevenAction.mjs # Trailing stop on breakeven
β β βββ BacktestPositionMonitorAction.mjs # Position event logger
β βββ math/
β β βββ timeframe_4h.math.mjs # 4H trend data β RSI, MACD, ADX, DI+/DI-
β β βββ timeframe_15m.math.mjs # 15m signal data β EMA, ATR, volume, momentum
β βββ enum/ # String constants for type-safe schema refs
β βββ utils/getArgs.mjs # CLI argument parser with defaults
βββ config/source/
β βββ timeframe_4h.pine # Pine Script v5 β Daily Trend Filter (RSI/MACD/ADX)
β βββ timeframe_15m.pine # Pine Script v5 β Signal Strategy (EMA/ATR/Volume)
βββ scripts/
β βββ run_timeframe_15m.mjs # Standalone 15m Pine Script runner
β βββ run_timeframe_4h.mjs # Standalone 4H Pine Script runner
β βββ cache/
β βββ cache_candles.mjs # Pre-download OHLCV candles (1m/15m/4h)
β βββ validate_candles.mjs # Verify cached candle data integrity
β βββ cache_model.mjs # Pull Ollama LLM model with progress bar
βββ docker/ollama/
β βββ docker-compose.yaml # Ollama GPU container setup
β βββ watch.sh # nvidia-smi monitor
βββ CLAUDE.md # AI strategy development guide
βββ .env # Environment variables
βββ package.json # Dependencies
timeframe_4h.pine)Determines the market regime using three indicators:
| Regime | Condition |
|---|---|
| AllowLong | ADX > 25, MACD histogram > 0, DI+ > DI-, RSI > 50 |
| AllowShort | ADX > 25, MACD histogram < 0, DI- > DI+, RSI < 50 |
| AllowBoth | Strong trend but no clear bull/bear regime |
| NoTrades | ADX β€ 25 (weak trend) |
timeframe_15m.pine)Generates entry signals with EMA crossover confirmed by volume and momentum:
| Frame | Period | Market Note |
|---|---|---|
February2024 |
Feb 1β29, 2024 | Bull run |
October2025 |
Oct 1β31, 2025 | Sharp drop Oct 9β11 |
November2025 |
Nov 1β30, 2025 | Sideways with downtrend |
December2025 |
Dec 1β31, 2025 | Sideways, no clear direction |
# Create project with custom name
npx -y @backtest-kit/sidekick my-bot
# Create in current directory (must be empty)
npx -y @backtest-kit/sidekick .
| Package | Purpose |
|---|---|
| backtest-kit | Core backtesting/trading framework |
| @backtest-kit/pinets | Pine Script v5 runtime for Node.js |
| @backtest-kit/ui | Interactive charting dashboard |
| @backtest-kit/ollama | LLM inference integration |
| ccxt | Binance exchange connectivity |
| functools-kit | singleshot, randomString utilities |
| pinolog | File-based structured logging |
| openai | OpenAI API client |
| ollama | Ollama local LLM client |
Found a bug or want to add a feature? Open an issue or submit a PR!
MIT Β© tripolskypetr