Build unlimited custom algorithmic trading strategies with our powerful SDK. From simple scripts to complex HFT algorithms—full code control with institutional infrastructure.
Professional tools and infrastructure for algorithm developers.
Write custom strategies in JavaScript/TypeScript with complete access to our trading API.
Access live market data, order books, and historical data from 15+ exchanges.
Use our powerful SDK with pre-built functions for indicators, orders, and risk management.
Build HFT strategies with ultra-low latency execution and tick-by-tick data.
Leverage position limits, stop-loss, and circuit breakers to protect your capital.
Trade crypto, forex, stocks, and futures from a single strategy.
Write strategies in JavaScript/TypeScript with our intuitive SDK.
// ============================================
// RSI + MACD MOMENTUM STRATEGY
// ============================================
// Buys on oversold RSI with bullish MACD,
// sells on overbought conditions
// ============================================
// Parameters
const RSI_OVERSOLD = td.config.getNumber('RSI_OVERSOLD', 30);
const RSI_OVERBOUGHT = td.config.getNumber('RSI_OVERBOUGHT', 70);
const STOP_LOSS_PCT = td.config.getNumber('STOP_LOSS_PCT', 2);
const TAKE_PROFIT_PCT = td.config.getNumber('TAKE_PROFIT_PCT', 5);
const POSITION_SIZE = td.config.getNumber('POSITION_SIZE', 100);
// Get indicators
const rsi = td.indicators.rsi;
const macd = td.indicators.macd;
const price = td.market.price;
// Previous MACD for crossover detection
const prevMacd = td.state.get('prevMacd', macd.macd);
const prevSignal = td.state.get('prevSignal', macd.signal);
// ============================================
// ENTRY LOGIC
// ============================================
if (!td.position.hasPosition) {
// Check for oversold RSI
const isOversold = rsi < RSI_OVERSOLD;
// Check for bullish MACD crossover
const bullishCrossover = macd.macd > macd.signal
&& prevMacd <= prevSignal;
// Check histogram is positive
const positiveHistogram = macd.histogram > 0;
if (isOversold && bullishCrossover && positiveHistogram) {
const stopLoss = td.utils.round(
price * (1 - STOP_LOSS_PCT / 100), 2
);
const takeProfit = td.utils.round(
price * (1 + TAKE_PROFIT_PCT / 100), 2
);
td.trade.buy({
amountPercent: POSITION_SIZE,
stopLoss: stopLoss,
takeProfit: takeProfit,
reason: `RSI: ${rsi.toFixed(2)}, MACD crossover`
});
td.utils.log('BUY SIGNAL', {
rsi: rsi.toFixed(2),
macd: macd.macd.toFixed(4),
signal: macd.signal.toFixed(4),
price: price
});
}
}
// ============================================
// EXIT LOGIC
// ============================================
if (td.position.hasPosition && rsi > RSI_OVERBOUGHT) {
td.trade.close(`RSI overbought at ${rsi.toFixed(2)}`);
td.utils.log('SELL SIGNAL', {
rsi: rsi.toFixed(2),
pnl: td.position.pnl,
pnlPercent: td.position.pnlPercent.toFixed(2)
});
}
// Save state for next spin
td.state.set('prevMacd', macd.macd);
td.state.set('prevSignal', macd.signal);Pre-built functions and utilities to speed up development.
Access 100+ built-in indicators including RSI, MACD, Bollinger Bands, and more.
Simple API for market, limit, stop, and advanced order types.
Real-time and historical candles, ticks, order book, and trades.
Persistent state storage for your strategy data and parameters.
From code to production in four steps.
Use our SDK to code your strategy logic with access to market data, indicators, and order functions.
Run backtests on historical data and use our debugger to refine your strategy.
Deploy to paper trading to validate in real-time without risking capital.
Launch your strategy on live exchanges with full monitoring and analytics.
From simple strategies to advanced ML-powered algorithms.
Build proprietary technical indicators that aren't available in standard platforms.
Integrate ML models and AI algorithms for predictive trading strategies.
Implement multi-condition strategies that standard bots can't handle.
Start building custom trading algorithms with our powerful SDK and infrastructure.
Free Tier Available • Full SDK Access • Deploy Unlimited Strategies