Crude oil bots that trade while I sleep.
A hand-drawn idea on a TradingView chart became a fleet of Python bots trading CL futures on prop-firm accounts, 24 hours a day, five days a week. Here is how they're built and how every rule earned its place.
One process per account. One rulebook.
Each account runs its own self-restarting Linux service. Live trading, backtests and reports call the same rule functions, so a backtest can't quietly disagree with the bots.
Read the market
Pull 1-minute bars and build 5 to 60-minute candles. Only completed candles are ever used.
Check the rules
Every skipped setup is logged as a near miss with the one filter that blocked it.
Guard rails
Daily loss stop, trade caps, and a hedge guard: no account long while another is short.
Place & protect
Stop entry with brackets, re-pinned to exact prices after the fill. Unprotected for 60 s? Closed.
Manage
Break-even at 2R, add-on at +1R, loss cap auto-close, flat before the prop firm's daily close.
Report
Telegram for wins, losses and safety events; a daily report and an hourly ledger.
Two ways to read the chart.
Each strategy, step by step. Steps describe a short; a long is the exact mirror.
H1 Swing Engulf
The hourly chart picks the turn; the 30 or 15-minute chart keeps the stop small, so a 3R target is realistic.
- Hourly swing. Bearish: a red H1 candle closes right after a green one, and its own high is at or above the highs of the two hours before it. Bullish: a green H1 candle closes right after a red one, and its own low is at or below the lows of the two hours before it.
- Engulf inside that hour. On M30, else M15, a red body fully covers the previous green body of at least 5 ticks.
- Quality check. The engulf candle has at least 0.6× normal volume and a range of at least 0.9 ATR.
- Entry. One tick past the engulf candle, stop at its other end, capped at 130 ticks.
- Target. 3R.
- Late fallback. If price has already passed the entry, use the H1 engulf instead. If that has passed too, skip.
- At +1R. Add to the position, except on Express accounts.
- At +2R. The stop moves to the entry.
- Loss cap. An open loss of $900 closes everything.
- End of day. One losing trade ends the day, with 5 trades at most. Flat by 04:10 MYT.
VWAP Break
A 5-minute moving-average breakout near VWAP, plus a 10-minute chart that trades only when the bot is flat.
- Touch. Candle 1 touches the EMA 20 or SMA 50.
- Clear and break. Candle 2's whole range clears that line and breaks candle 1, while staying inside candle 1 on the stop side.
- Trend check. If candle 1 touched both lines, trade only with the trend.
- Size check. The setup must be under 40 ticks. Setups of 41 to 49 ticks are also allowed.
- Near VWAP. Candle 2 closes within 0.5 ATR, or 0.7 ATR when the stop is 30 ticks or more.
- Fallbacks. If VWAP fails, take a 1R scalp with a stop under 18 ticks, or a 1R trend trade at least 70 ticks from VWAP with a stop under 40 ticks.
- Entry. One tick past candle 2, stop at candle 1's far end.
- Target. 2R, or 2.5R when volatility expands.
- Cancel. The order goes if candle 3 touches the line, price hits the target first, or 12 candles pass.
- In the trade. Add to the position when price is 32 ticks from the target.
- End of day. Stop after a $432 loss. Flat by 04:10 MYT.
Four years, not four weeks.
Strategy 1 looked brilliant on the three months it was tuned on. Re-run on Jan 2023 to Oct 2026, it lost in three of four years: textbook overfitting. That result is why most bots now run Strategy 2.
| Year | Strategy 1 · VWAP | Strategy 2 · Swing |
|---|---|---|
| 2023 · never used to pick settings | −$17,861 | +$13,289 |
| 2024 | −$45,471 | +$31,987 |
| 2025 | −$37,454 | +$8,937 |
| 2026 · to 22 Oct | +$37,436 | +$52,214 |
| Total | −$63,350 | +$106,427 |
What made the cut
Stop for the day after a loss. A 10-minute chart when flat. Candle 2 stays inside candle 1. Cancel if candle 3 returns to the line.
What didn't
44 moving-average pairs, swing-structure filters, 4 to 15-minute charts alone, prior-day sweeps, tail candles, other targets, ES and NQ.
How a rule gets in
Backtest on the shared engine → check each year and the prop-firm pass rate → code with tests → a deploy that rolls back on any failure.
Built like production, because it is.
See every account live: balances, open P&L and today's trades →
Want the whole story?
I'm happy to walk through the code, the research and the mistakes.