A crypto trading algorithm is a set of rules that decides when to buy, when to sell, how much to risk, and how to manage the position, executed by code rather than by you. Done right, it removes emotion, runs 24/7, and scales with capital. Done wrong, it loses money faster than discretionary trading because it loses money while you sleep. The honest framing in 2026: 80-90% of retail-built algos lose money in live conditions. The build path below is the one our desk uses to give a strategy a fighting chance.
What does a trading algorithm actually do?
Five jobs, in order:
- Ingest data: price, volume, order book, sometimes funding rates and on-chain metrics.
- Decide: based on rules, output a long, short, or flat signal.
- Size: convert the signal into a position size based on risk parameters.
- Execute: send the order to the broker or exchange.
- Manage: track stops, targets, trailing logic, and time exits.
If any of these five is missing or sloppy, the algo is not done. Most retail algos focus on step 2 and ignore steps 3-5. That is why they die in production.
Step 1: start with an idea you can write in one sentence
Good idea: “Buy BTC when the 20-period EMA on the 1-hour crosses above the 50-period EMA, exit on the opposite cross, risk 1% per trade.”
Bad idea: “Use machine learning to predict BTC.” That is not a strategy, it is a wish.
The strongest retail algos are simple. Trend-following on the 1H or 4H. Mean reversion on oversold conditions at higher-timeframe support. Funding-rate cash-and-carry. Each one fits in a sentence.
Step 2: backtest, but distrust the result
Backtest on at least 3 years of data, ideally including 2022 (deep bear), 2023 (slow recovery), and 2024-2025 (post-ETF regime). The number you care about is not the equity curve. It is:
- Sharpe ratio: target above 1.0 net of fees and slippage. Below 0.5 is noise.
- Max drawdown: target under 25%. Above 40% means the strategy will not survive psychologically.
- Number of trades: under 30 is statistically meaningless. Over 200 is robust.
- Profit factor: gross win / gross loss. Above 1.3 is workable.
Three traps to know about:
- Lookahead bias: using data the algo would not have had at the time of decision.
- Overfitting: tuning parameters until the curve looks beautiful on the in-sample but breaks out of sample.
- Survivorship bias: testing only on coins that still exist. Many alts in the 2017-2018 sample died.
Step 3: include realistic costs
A backtest with 0% slippage and 0% commission is fiction. Realistic retail crypto CFD costs:
- Spread: 1-3 basis points on BTC, 5-15 bp on alts.
- Slippage: 1-3 bp on retail size in normal conditions, much wider on news.
- Funding rate (if perp): variable, model from historical data.
If your algo’s edge is 5 bp per trade and your costs are 5 bp, your edge is zero. Many retail algos die here.
Step 4: paper trade for at least 30 calendar days
Paper trading exposes the gap between backtest and live. Latency, missed fills, broker downtime, your own ability to leave the algo alone. Run it on at least 30 days of forward data. If paper performance roughly matches backtest, proceed. If not, debug before you risk capital.
Step 5: live deploy with size you can lose without crying
- Start with 25% of intended size for the first 50 live trades.
- Track every trade against the backtest. Live should not deviate by more than 1 standard deviation per 20 trades.
- Hard stop on monthly drawdown above 15% of the deployed allocation. Stop, debug, redeploy.
- Re-evaluate the strategy every 90 days. Markets change. Edge decays.
What languages and platforms do retail algos use?
- MQL5: native to MT5, executes directly through the broker. Easiest path for CFD-based strategies.
- Python: backtest in pandas, vectorbt, or backtrader; deploy via broker API or MT5 bridge.
- Pine Script: TradingView. Fast for prototyping, weaker for live execution.
The right tool is the one you can write, debug, and read your own code in six months later.
Building algorithms at Volity
Volity provides MT4 and MT5 with full Expert Advisor support, custom indicators, and the multi-threaded MT5 strategy tester for backtesting on 20+ cryptocurrencies. Retail crypto leverage is capped at 1:2 under ESMA. Negative balance protection applies on retail accounts. Execution is by UBK Markets Ltd (CySEC 186/12).
About Volity
Volity is your all-in-one hub for money movement, market access, and financial clarity. Trading is executed by UBK Markets Ltd, a Cyprus Investment Firm authorised by CySEC under licence 186/12.
Risk disclosure
CFDs are complex instruments and come with a high risk of losing money rapidly due to leverage. Between 70% and 80% of retail investor accounts lose money when trading CFDs.





