The rules: long only, one position
Use a fast simple moving average (SMA) and a slower SMA of completed closing prices. Enter only when the fast average moves from at or below the slow average to above it. Exit when it moves from at or above to below. Do not add another entry while already long.
For a tiny teaching example, use lengths 2 and 3. These deliberately short lengths make the calculation easy to inspect; they are not suggested trading parameters. Start flat and wait until both the current and previous averages exist.
Reproduce the signal by hand
Use the fictional closing-price sequence 10, 9, 8, 9, 10, 9, 8. For each bar, average the last two closes for the fast SMA and the last three for the slow SMA.
At bar 3, fast = 8.5 and slow = 9. At bar 4, fast = 8.5 and slow ≈ 8.667. At bar 5, fast = 9.5 and slow = 9: the fast average crosses above the slow average, producing an entry signal.
At bar 6, fast = 9.5 and slow ≈ 9.333, so there is no downward crossover yet. At bar 7, fast = 8.5 and slow = 9, producing an exit signal.
This dataset demonstrates signal timing only. It contains no opening prices, fill model, costs, or position sizing, so it cannot establish trade returns. A signal at a candle close is not evidence of an executable fill at that same price.
Turn the example into a historical test
Connect your AI assistant using the MCP setup guide. Ask it to search available BTC/USDT symbols and confirm the exchange and market type. Select an available historical period, a timeframe, initial capital, position sizing, commission, and slippage before the run.
A useful request is: “Create a long-only SMA crossover example with fast length 2 and slow length 3, no pyramiding, and an exit on the downward cross. Show and validate the SeekAlgo script. Explain the engine’s signal and fill timing. Ask me for missing run settings before backtesting.”
Inspect the generated script and trade list. Save the code version, exact symbol, input values, data interval, and returned settings alongside the results. Identical rules on a different exchange or date range are a different experiment.
Look for failure cases
Moving averages lag price. In sideways markets, repeated crosses can cause frequent losing trades and accumulate costs. A long-only strategy also remains exposed to declines while waiting for an exit; this teaching rule has no independent stop-loss.
Compare the strategy with a benchmark on the same period. Evaluate an untouched period and nearby parameter choices without selecting only the best result. Longer moving averages change the behavior and require additional warm-up data.
No historical performance is claimed on this page. The next step is a verified run under recorded assumptions, followed by paper observation if eligible. Paper bots simulate trades and do not place real orders.
Product references
Try this workflow with SeekAlgo
Build and validate a strategy in the workspace, then inspect the backtest. Historical and paper results are simulations, not a promise of future performance.
Explore the workspace →