Examples
Real command examples for sources, studies, and strategies.
Examples
This page focuses on the commands people will actually run first:
sourcestudyscript backtestscript runs listscript runs showstrategy runstrategy backtest
All examples below assume:
--provider mmt- millisecond timestamps at the CLI boundary
- current provider support limited to MMT
Sources
Orderbook snapshot
mlab source orderbook \
--provider mmt \
--exchange bybitf \
--symbol BTC/USDT \
--depth 100 \
--output terminalOrderbook stream
mlab source orderbook \
--provider mmt \
--exchange bybitf \
--symbol BTC/USDT \
--depth 100 \
--stream \
--min-size 0.1 \
--price-group 1 \
--interval-ms 1000 \
--buffer-size 20 \
--output terminalCandles range
mlab source candles \
--provider mmt \
--exchange binancef \
--symbol BTC/USDT \
--timeframe 60 \
--from 1779880000000 \
--to 1779883600000 \
--output jsonCandles stream
mlab source candles \
--provider mmt \
--exchange binancef \
--symbol BTC/USDT \
--timeframe 60 \
--stream \
--output jsonlVD range
mlab source vd \
--provider mmt \
--exchange bybitf \
--symbol BTC/USDT \
--timeframe 60 \
--from 1779620400000 \
--to 1779624000000 \
--bucket 1 \
--output jsonVD stream
mlab source vd \
--provider mmt \
--exchange bybitf \
--symbol BTC/USDT \
--timeframe 60 \
--bucket 1 \
--stream \
--output jsonlOI range
mlab source oi \
--provider mmt \
--exchange bybitf \
--symbol BTC/USDT \
--timeframe 60 \
--from 1779660000000 \
--to 1779705600000 \
--output jsonOI stream
mlab source oi \
--provider mmt \
--exchange bybitf \
--symbol BTC/USDT \
--timeframe 60 \
--stream \
--output jsonlVolumes range
mlab source volumes \
--provider mmt \
--exchange bybitf \
--symbol BTC/USDT \
--timeframe 60 \
--from 1779660000000 \
--to 1779705600000 \
--output jsonVolumes stream
mlab source volumes \
--provider mmt \
--exchange bybitf \
--symbol BTC/USDT \
--timeframe 60 \
--stream \
--output jsonlScripts
Backtest a strategy-like script
mlab script backtest ./scripts/sma-cross.js \
--provider mmt \
--exchange bybitf \
--symbol BTC/USDT \
--from 1704067200000 \
--to 1704667200000 \
--source candles:timeframe=60 \
--param candles:fast=20 \
--param candles:slow=50 \
--param candles:notional=1000 \
--leverage 5 \
--output jsonBacktest a VD script
mlab script backtest ./scripts/vd-summary.js \
--provider mmt \
--exchange hyperliquid \
--symbol HYPE/USDT \
--from 1780497965372 \
--to 1780618018000 \
--source vd:timeframe=3600 \
--source vd:bucket=1 \
--param vd:min_delta=500 \
--output jsonBacktest independent position exits
mlab script backtest ./scripts/dip-tp-positions.js \
--provider mmt \
--exchange hyperliquid \
--symbol HYPE/USDT \
--from 1780497965372 \
--to 1780618018000 \
--source candles:timeframe=3600 \
--param candles:drop_bps=20 \
--param candles:take_profit_bps=50 \
--param candles:notional=1000 \
--leverage 5 \
--output terminalThis script opens separate long positions on dips and closes only the position whose position_id hits its take-profit condition.
Run a live multi-source script
mlab script run ./scripts/all-sources-live.js \
--provider mmt \
--exchange hyperliquid \
--symbol HYPE/USDT \
--source candles:timeframe=60 \
--source orderbook:depth=100 \
--source vd:timeframe=60 \
--source vd:bucket=1 \
--output jsonlList script runtime reports
mlab script runs listView a script runtime report
mlab script runs show <run-id>Studies
Spread
mlab study spread \
--provider mmt \
--exchange bybitf \
--symbol BTC/USDT \
--depth 20 \
--output jsonDepth
mlab study depth \
--provider mmt \
--exchange bybitf \
--symbol BTC/USDT \
--levels 20 \
--output jsonImbalance
mlab study imbalance \
--provider mmt \
--exchange bybitf \
--symbol BTC/USDT \
--depth 50 \
--output jsonSlippage
mlab study slippage \
--provider mmt \
--exchange bybitf \
--symbol BTC/USDT \
--side buy \
--notional 100000 \
--depth 100 \
--output jsonVAMP
mlab study vamp \
--provider mmt \
--exchange bybitf \
--symbol BTC/USDT \
--depth 100 \
--dollar-depth 250000 \
--output jsonCVD
mlab study cvd \
--provider mmt \
--exchange bybitf \
--symbol BTC/USDT \
--timeframe 3600 \
--from 1779620400000 \
--to 1779624000000 \
--bucket 1 \
--output jsonStrategy Run
Live SMA crossover
mlab strategy run sma-crossover \
--provider mmt \
--exchange bybitf \
--symbol BTC/USDT \
--timeframe 60 \
--output terminalLive SMA crossover with warmup anchor
mlab strategy run sma-crossover \
--provider mmt \
--exchange bybitf \
--symbol BTC/USDT \
--timeframe 60 \
--from 1779887295785 \
--output jsonlStrategy Backtest
Historical SMA crossover
mlab strategy backtest sma-crossover \
--provider mmt \
--exchange bybitf \
--symbol BTC/USDT \
--timeframe 60 \
--from 1779660000000 \
--to 1779705600000 \
--fast 20 \
--slow 50 \
--confirm-bars 1 \
--output terminalHistorical SMA crossover JSON
mlab strategy backtest sma-crossover \
--provider mmt \
--exchange bybitf \
--symbol BTC/USDT \
--timeframe 60 \
--from 1779660000000 \
--to 1779705600000 \
--fast 20 \
--slow 50 \
--output json