Strategy Lab
Design and backtest your own trading strategies using JavaScript. Experiment with Fibonacci, mathematical formulas, and more.
Strategy Code Editor
JavaScript
Fibonacci Retracement
Buy at 38.2%~61.8% retracement from peak
Mean Reversion
Enter on N-std deviation moves from average
Channel Breakout
Buy on N-day high, sell on low breakout
Momentum Factor
Trade based on N-day return scores
Grid Trading
Place orders at fixed price intervals
Blank Template
Start from scratch
🤖 AI Strategy Generator
strategy.js
Backtest Config & Run
Console
Write your code and click 'Run Backtest'.
--
Strategy Return
--
Hold Return
--
Total Trades
--
Win Rate
Price & Trades
Strategy Coding Guide
Define a strategy(data, params) function. data is an OHLCV array. Return { buy: [indices], sell: [indices] }.
| Object/Function | Description | Example |
|---|---|---|
data[i].close | Closing price of i-th candle | data[i].close |
Ind.sma(close, p) | Simple Moving Average | Ind.sma(close, 20) |
Ind.rsi(close, p) | Relative Strength Index | Ind.rsi(close, 14) |
log(msg) | Print message to console | log('Buy at ' + i) |