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/FunctionDescriptionExample
data[i].closeClosing price of i-th candledata[i].close
Ind.sma(close, p)Simple Moving AverageInd.sma(close, 20)
Ind.rsi(close, p)Relative Strength IndexInd.rsi(close, 14)
log(msg)Print message to consolelog('Buy at ' + i)

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/FunctionDescriptionExample
data[i].closeClosing price of i-th candledata[i].close
Ind.sma(close, p)Simple Moving AverageInd.sma(close, 20)
Ind.rsi(close, p)Relative Strength IndexInd.rsi(close, 14)
log(msg)Print message to consolelog('Buy at ' + i)