Ema Crossover
Simple, reliable trend follower — buys when the fast EMA crosses above the slow EMA and sells when it crosses below. Great as a first bot to try your platform.
What it demonstrates: ind.add usage, cross detection, order placement with percent amounts.
When to use: Ideal for trending markets.
const amountPercent = '5%';
function setup() { ind.add({ name: "ema", alias: "ema_fast", inputs: ["close"], options: { period: 9 }, display: false }); ind.add({ name: "ema", alias: "ema_slow", inputs: ["close"], options: { period: 21 }, display: false });}
async function update() { if (ta.crossup('ema_fast', 'ema_slow')) { await order.buy(null, amountPercent); } else if (ta.crossdown('ema_fast', 'ema_slow')) { await order.sell(null, amountPercent); }}