How to turn a trading idea into exact strategy rules
- A trading idea is a sentence. A strategy is a set of rules so exact that two people (or a computer) following them would take the same trades.
- Every strategy needs the same parts: market and bar size, session hours, entry conditions, exits, size, and daily limits.
- The test for each rule: could you check it from the chart alone, with no judgment? If not, it isn't exact yet.
- TradeHarbor's Strategy lab builder has a block for each part, and its AI helper lists what your description left out.
"I buy breakouts of the opening range." Most traders could take that trade. Ask ten of them to write down exactly when they'd enter and you'll get ten different strategies. That gap, between the idea and the rule, is where most of the work of automation is. It's also where a lot of inconsistent manual trading comes from.
This guide takes that one idea and turns it into rules a computer could follow. The numbers are an example for learning, not a recommendation.
The parts every strategy needs
| Part | The question it answers |
|---|---|
| Market and bar size | What does it trade, and on what chart (1, 5 or 15-minute bars)? |
| Session | When may it open trades, and when must it be flat? |
| Entry | Exactly what must be true to go long? To go short? |
| Exits | Where's the stop? The target? Does the stop ever move? |
| Size | How many contracts, and what's the most it may hold? |
| Limits | How many trades a day? What happens after a loss? |
Worked example: the opening range breakout
Start with the sentence and ask questions until nothing is left to judgment.
Market and bar size
"Index futures" isn't enough. Pick one: the Micro E-mini Nasdaq-100 (MNQ), say, on 5-minute bars. Micro contracts are a tenth of the size of the full ones, which makes them the usual choice for testing ideas with real money later.
The opening range
"The first 15 minutes" means 9:30 to 9:45 New York time, the stock market's open. The opening range high is the highest price of those three 5-minute bars; the low is the lowest. Write it like that: three bars, their highest high and lowest low.
Entry
"Breaks out" is where most ideas are vague. Choose one:
- Price trades one tick above the range high (enters fast, but gets fooled by quick pokes above the high).
- A 5-minute bar closes above the range high (slower, but needs the move to hold for a whole bar).
Say we choose the close. The rule becomes: go long when a 5-minute bar closes above the opening range high; go short when one closes below the low. Then decide the edge cases. Only the first breakout of the day? Only between 9:45 and 11:00? If it breaks out long and stops out, may it go short later? Each answer is a rule.
Exits
"Stop below the range" could mean the range low, or the middle of the range, or a fixed distance. Pick one you can compute: the stop is at the opposite side of the opening range. The target might be a multiple of that risk: a target at 1.5 times the distance to the stop. And a rule for the end of the day: flat by 15:55, whatever happens.
Size and limits
One contract. At most one trade a day. If the range is unusually wide, the stop is far away and one contract risks a lot. Many traders add a rule like "skip the day if the range is wider than 40 points", or size down so the dollar risk stays the same. Either is fine, as long as it's written down.
The finished rules
MNQ, 5-minute bars. Opening range = highest high and lowest low of the 9:30, 9:35 and 9:40 bars. Between 9:45 and 11:00, go long when a bar closes above the range high, short when one closes below the range low; first signal only. Stop at the other side of the range, target 1.5 times the stop distance, flat by 15:55. One contract, one trade a day; skip days with a range wider than 40 points.
Two people following that paragraph would take the same trades. That's the test.
Questions people forget to answer
- What if the stop and target are both hit in the same bar? On bar data you can't tell which came first. Testers assume one; the cautious assumption is the stop.
- What price do you get? A signal on a bar's close can only be filled at the next price, usually the next bar's open, plus some slippage.
- What about fees? Every round trip costs commissions and exchange fees. Include them from the start.
- What days does it trade? Holidays, half days and big scheduled announcements behave differently. Decide whether to trade them.
- What if it's already in a trade at the close? The flat-by time handles it, if you set one.
Turning your rules into blocks in TradeHarbor
The Strategy lab's Build a strategy tab (open beta, free to use when signed in) has a block for each part above: market and session, long and short entry conditions (all of or any of), stop, up to three targets, breakeven, trailing stop, flat-by time, scaling in and trading days. Start by describing your idea to the strategy assistant (it asks about anything you left open), or from an example or a blank strategy.
If you describe the idea in words, the AI helper drafts the blocks from your description. It doesn't invent a strategy. It translates what you wrote, and it lists two things you should read carefully: what it couldn't express in blocks, and what it had to assume because your description didn't say. That second list is usually the list of questions in this guide you haven't answered yet.
The summary then shows your strategy in plain English and the Python code it becomes. Read the English version first: if it doesn't say what you meant, the code won't do what you meant either.
Next steps
Exact rules can be written as code and tested. Pine Script vs Python covers the code; how to backtest a trading strategy covers testing it without fooling yourself. The whole path is in how to automate a trading strategy.