Skip to content
Disclaimer: These examples are for educational and demonstration purposes only. They are not ready-to-use, profitable trading strategies

Volume Spike Scalper

Detects sudden volume spikes relative to average and follows the direction of the candle — quick entries and exits.

const lookback = 20;
const volMultiplier = 3; // enter if current volume > avgVolume * volMultiplier
const amountPercentage = "5%";
function setup() {
// no extra ind needed
}
async function update() {
// get average volatility/volume via helper - we have getVolatility but it's usually for price; for volume use simple average via candle.last
const lastCandles = candle.last(lookback);
// Wait until there is enough data
if (lastCandles.length !== lookback) return;
const avgVolume = lastCandles.reduce((s, prevCandle) => s + prevCandle.volume, 0) / lookback;
const currentVolume = candle.volume;
if (currentVolume > avgVolume * volMultiplier) {
// if momentum (price climb) + volume spike => buy else sell
if (candle.close > candle.prev().close) {
await order.buy(null, amountPercentage);
} else {
await order.sell(null, amountPercentage);
}
}
}