How to write your first IF/THEN crypto trading rule
A trading rule in Rulemancer is a sentence you can read out loud. It starts with a condition, adds the action that should follow, and optionally caps how often or how far it can go. The builder writes that sentence for you as you click, which makes it easy to check before anything runs. This walkthrough builds one real rule from an empty bot.
Six blocks make the sentence
| Block | What it decides | Example |
|---|---|---|
| IF | The trigger | price drops 5% in 24 hours |
| AND / OR | Extra filters | RSI(14) below 30 |
| THEN | The order | buy $100 of BTC |
| REPEAT | How many times the rule may fire | at most 3 times |
| STOP | When the rule gives up | after 6 trades, or losses reach 8% |
Only IF and THEN are required. The rest exist because a rule that fires forever is a rule you cannot reason about.
A worked example on BTC
Start with a dip-buy idea. In the builder, pick spot, BTC/USDT, and a 4-hour timeframe. Choose price change as the first condition, set it to a 5% drop over 24 hours. Add a second condition with AND: RSI(14) below 30. The action is a buy of $100, fixed dollars rather than a percentage, so the size cannot drift if your balance grows.
The sentence reads: IF BTC drops 5% in 24 hours AND RSI(14) is below 30, THEN buy $100 of BTC. That is the whole entry. Everything else is protection.
Timeframe decides how often the rule can act
A 15-minute rule sees 96 candles a day and will find far more triggers than a daily rule — including many that are just noise. A 4-hour rule gets six chances a day, and a daily rule gets one. Pick the timeframe that matches how long you are willing to hold, not the one that produced the prettiest backtest. The engine evaluates a rule when the candle closes, so a 4-hour condition is checked four times a day, no more.
The risk blocks matter more than the entry
A dip-buy entry without an exit is a promise to hold forever. Set these before you run anything:
- Stop-loss in percent, below the entry. It should sit where the idea is wrong, not where the loss still feels small.
- Take-profit in percent, and remember that a 2:1 ratio with a 40% win rate is a different proposition from 1:1 at 60%.
- Trailing stop if you want to let a trend run after the first target.
- Max allocation and max open positions, so three simultaneous dips cannot become one oversized position.
- Cooldown, because a rule that re-buys every candle after a drop is not dip buying, it is averaging down without a plan.
- Max daily loss and max trades per day, the two limits that stop a bad day from becoming a bad month.
Add REPEAT at most 3 times and a STOP after 6 trades. Now the sentence has a beginning, an end and a budget.
Five builder errors that block a launch
- Contradictory filters. RSI below 30 AND price up 10% in the same window will almost never fire; the validator accepts it, the market does not.
- Entry and exit on different timeframes. A 15-minute stop under a 4-hour rule reacts to noise the rule never intended to see.
- Percentage sizing on a changing balance. Use a fixed dollar amount while you are learning; percentages compound mistakes as fast as gains.
- No cooldown. Consecutive candles that all satisfy the condition will each buy.
- Stop-loss tighter than the spread. On a quiet pair with wide spreads, a 0.2% stop is a fee generator.
From draft to paper
Run the rule through the backtest first with fees and slippage included, then launch it as a paper bot. Both steps are free. When the rule has survived a quiet week and a busy one, connect a trade-only key and confirm GO LIVE — a step the platform never takes for you.
Ready to try the example above? Create a free account and open the builder; live bot limits by plan are on the pricing page. Candle data and exchange endpoints come from the exchanges themselves — see the Binance Spot API docs for the raw kline format.
Frequently asked questions
Can a rule use more than two conditions?
Yes. AND and OR can be chained, and the sentence view shows the full logic in reading order so you can spot a filter that cancels another one out.
What does REPEAT change compared with STOP?
REPEAT limits how many buys the rule may place; STOP ends the bot entirely after a number of trades or a loss threshold. Use both if you want a rule with a fixed budget.
Do I need an API key to backtest?
No. Backtests and paper bots use public market data. A key is only needed when you connect an exchange for live trading.