One mechanical rule,
checked once a day.
Adelmo trades perpetual futures on OKX with a single rule. Ten seconds after the daily candle closes, it computes one direction per pair. If that direction flipped, it acts. Nothing else moves the book — no discretion, no forecasts, no intraday noise.
The rule
Two exponential averages of the same series, and the line where they would cross. Everything the bot does follows from which side of that line price sits on.
ohlc4 = (open + high + low + close) / 4
AP = EMA(ohlc4, 2)
fast = EMA(AP, 12) K1 = 2/13
slow = EMA(AP, 26) K2 = 2/27
slow·(1−K2) − fast·(1−K1)
X = ───────────────────────────
K1 − K2
direction = AP > X ? long : short- 16:00UTC, every day
Ten seconds after OKX closes its 1D candles, one direction is computed per monitored pair and written to a snapshot.
- ↺Compare to yesterday
If today’s direction differs from the previous candle’s, that pair has flipped. No flip, no action — most days nothing happens.
- →Act on the flip
Any armed trigger on that pair closes a position now fighting the trend, and opens one in the new direction, sized by a fixed USD notional.
Why this rule
Two properties fall out of the algebra rather than being tuned in. Both are asserted by a test in the repository.
A day earlier than the EMAs
Rearranging the two EMA updates for the point where they meet gives exactly the X formula. So X is the value AP would need next bar to make fast and slow equal — comparing AP against it fires when the crossover is about to happen, instead of confirming it a day late.
The line runs away from price
Once a trend is established the gap between the averages drives X far from the market, so ordinary noise cannot reach it. A flip only becomes possible when the averages genuinely converge.
Losing most of the time is the design
A low win rate is not a defect here. Flipping out of a position that turned caps each loser quickly, while a position that keeps running is never closed for being profitable. Returns come from the size of the few that work, not the count.
Markets that go sideways
The same hysteresis that ignores noise inside a trend cannot help when the averages sit converged. Price oscillates across the line, the direction flips repeatedly, and each flip pays fees to end up flat. That is the standing cost of the payoff shape above — not a bug to be tuned away.
What it will not do
The constraints matter more than the entries. These are enforced in code, not by convention.
Fire twice on one candle
A trigger records the candle it acted on, so a manual re-run or a worker restart cannot double-trade.
Trade the moment you save
Arming a trigger seeds it with the current candle, so it can only ever act on a future flip — never on the one already formed.
Trust its own database
Live OKX positions are the source of truth for exposure. The database records what happened; it never decides what is open.
Exceed the exposure cap
Combined notional is checked against a percentage of equity before any open. Closes are never blocked — reducing risk is always allowed.
Guess
No AI signals, no news feed, no sentiment. The direction is arithmetic on closed candles and nothing else.
Trade intraday
One decision per pair per day. Between closes the engine only keeps market data warm and reconciles fills.