API reference
Every public method, type, hook and helper of the SDK — signatures, examples, pitfalls. Browse the API.
Every NexPips bot is a single TypeScript module that calls defineStrategy(...) with a setup
that returns hooks. The runtime — identical in backtest and live — feeds new bars to your
onBar, async fills to your onOrderFilled, and closed positions to your onPositionClosed.
import { defineStrategy } from '@nexpips/sdk-trading';
export default defineStrategy({ symbol: 'EURUSD', timeframe: 'H1', risk: { maxRiskPercentPerTrade: 1, maxOpenPositions: 1, maxDailyLossPercent: 5 }, setup: () => ({ onBar(ctx) { if (!ctx.position.isFlat) return; ctx.order.marketBuy({ riskPercent: 1, stopLoss: { type: 'pips', value: 20 }, takeProfit: { type: 'rr', value: 2 }, }); }, }),});API reference
Every public method, type, hook and helper of the SDK — signatures, examples, pitfalls. Browse the API.
Cookbook
Ready-to-paste snippets for common patterns — entries, exits, position sizing. Browse the cookbook.
Indicators
The 7 built-in indicators (SMA, EMA, RSI, MACD, ATR,
BollingerBands, DonchianChannel) and how to build your own.
Browse the indicators.