From Trading Idea to Testable Rules
A market observation becomes a strategy only when every important decision can be stated clearly enough to test, reproduce, and challenge.
Most trading strategies begin as an observation.
A trader notices that markets sometimes continue moving after breaking above a recent high. Another sees that sharp declines are often followed by partial recoveries. Someone else observes that a market behaves differently when volatility is rising.
These observations may be useful.
But they are not yet strategies.
Consider the statement:
Markets often continue rising after a strong breakout.
This is a trading idea. It suggests that momentum may persist.
It does not tell us:
What counts as a breakout
What counts as strong
When the position should be opened
Which markets should be traded
How much should be risked
When the position should be closed
What costs should be included
How the idea should be evaluated
Until these choices are made explicitly, the idea cannot be tested consistently.
The purpose of strategy design is to transform a broad market observation into a complete set of rules.
Observation → hypothesis → rules → test → interpretation
This article explains that process.
Begin with the market behaviour
A strategy should start with an idea about market behaviour, not with a collection of indicators.
The starting point might be:
Trends tend to persist
Extreme short-term moves tend to reverse
Quiet markets are often followed by large moves
Strong markets tend to remain stronger than weak markets
Prices react differently during certain sessions
Volatility tends to cluster
Markets behave differently above and below long-term trend levels
The idea does not have to be original.
Many successful trading strategies are based on behaviours that have been studied for decades. What matters is whether the idea can be expressed clearly and tested honestly.
A useful market idea should answer:
What behaviour am I trying to capture?
For example:
I want to test whether a market that closes above its recent trading range is more likely to continue upward than immediately reverse.
This is much more useful than:
I want to build a profitable breakout strategy.
The first statement describes a behaviour. The second describes a desired result.
Research should begin with the behaviour.
Turn the observation into a hypothesis
A hypothesis is a specific claim that can be tested.
Suppose the observation is:
Markets sometimes trend after reaching a new high.
A possible hypothesis is:
When a liquid market closes above the highest close of the previous 20 bars, its return over the following 10 bars is positive more often than normal.
This hypothesis identifies:
The event: a close above the previous 20-bar high
The market type: liquid instruments
The observation period: the following 10 bars
The expected result: stronger-than-normal positive returns
The hypothesis may turn out to be false.
That is acceptable.
The goal of research is not to protect the original idea. It is to determine whether the evidence supports it.
Separate the hypothesis from the strategy
A hypothesis asks whether a market behaviour exists.
A strategy defines how that behaviour might be traded.
These are related, but they are not identical.
For example, the hypothesis might be:
Returns following a 20-bar breakout are positively biased.
The strategy might then say:
Enter long after a 20-bar breakout, use an ATR-based stop, and exit after a 10-bar low.
The stop and exit do not test whether breakout momentum exists. They determine how the potential behaviour is converted into a trade.
This distinction matters because a poor strategy design can hide a valid market effect.
A breakout may have positive average forward returns, but a very tight stop could cause many trades to exit before the move develops. The researcher might incorrectly conclude that breakouts do not work.
The reverse can also happen. A complicated exit may create an attractive historical result even when the original market hypothesis is weak.
Test the behaviour first. Then design the trading rules.
Define the market universe
A strategy cannot be tested without deciding what it trades.
“Stocks,” “crypto,” and “futures” are too broad.
A market universe should specify the instruments that qualify.
Examples include:
Current members of a major equity index
The 100 most liquid US stocks
Major currency pairs
A fixed list of liquid futures contracts
Bitcoin and Ethereum
One specific index future
All instruments meeting a minimum volume requirement
The universe matters because results can be distorted by market selection.
Suppose a trader tests a trend-following idea only on gold after noticing that gold had a strong historical trend. The result may reflect favourable instrument selection rather than a generally useful strategy.
A stronger test might include:
Equity indices
Bonds
Metals
Energy
Agricultural commodities
Currencies
A strategy does not have to work equally well on every market. But testing across several instruments helps reveal whether the idea is broad or dependent on one unusually favourable history.
Define the timeframe
Every rule depends on a timeframe.
A 20-bar breakout means something different on:
A one-minute chart
A 15-minute chart
A four-hour chart
A daily chart
A weekly chart
The timeframe affects:
Trade frequency
Transaction costs
Signal noise
Holding period
Execution difficulty
Required market data
Exposure to overnight gaps
The research plan should state the timeframe before testing begins.
For example:
Use daily bars and calculate all signals after the daily close.
That rule removes an important ambiguity.
It also avoids mixing bar-close information with intrabar execution assumptions.
Define the setup
A setup describes the market condition that must exist before an entry can occur.
Suppose the original idea concerns breakouts.
Possible setup rules include:
Price is above its 200-day moving average
Volatility is above its 50-day median
The market has not triggered another breakout in the previous 10 bars
Average volume is above a minimum threshold
The current contract is not close to expiration
The instrument has sufficient liquidity
A setup should have a reason.
Adding conditions only because they improve the historical result is dangerous. Each filter reduces the number of trades and creates another opportunity for overfitting.
A useful question is:
Why should this condition improve the logic of the strategy?
For example:
Require price to be above its 200-day moving average because long breakouts may be more reliable during established upward regimes.
This is a testable explanation.
By contrast:
Use a 173-day moving average because it produced the highest return.
That is probably data mining unless there is an independent reason for the choice.
Define the entry event
The entry rule must identify the exact event that creates a trade.
A vague rule might say:
Buy when price breaks resistance.
A testable version might say:
Enter long when the current daily close is greater than the highest daily close of the previous 20 completed bars.
This still leaves an execution question.
Should the strategy enter:
At the current close
At the next bar’s open
With a stop order above the breakout level
With a limit order after a pullback
Each choice creates a different strategy.
A conservative bar-close version might be:
Calculate the signal after the daily bar closes and enter at the next bar’s open.
That avoids assuming that the strategy knew the final closing price before the bar had finished.
Use completed bars correctly
Suppose the rule is:
Enter when the closing price exceeds the previous 20-bar high.
The current bar should normally not be included in the previous 20-bar calculation.
Otherwise, the current close is being compared with a range that already contains the current close.
The intended logic is usually:
Compare the current close with the highest close of the 20 bars completed before the current bar.
This small distinction can change the signals.
Precise indexing matters in both research and code.
Define long and short rules separately
A short strategy is not always the exact reverse of a long strategy.
Markets often rise and fall differently.
Equity indices, for example, may:
Rise gradually
Fall sharply
Have a long-term upward bias
Experience larger volatility during declines
A rule that works for long positions may not work equally well when reversed.
Instead of assuming symmetry, define and test both sides separately.
For example:
Long rule
Enter long after a close above the previous 20-bar high while price is above the 200-day moving average.
Short rule
Enter short after a close below the previous 20-bar low while price is below the 200-day moving average.
These rules look symmetrical, but their results should still be evaluated independently.
Define position sizing
The entry rule decides when to trade.
Position sizing decides how much the trade matters.
Common sizing methods include:
Fixed quantity
Trade one contract or 100 shares.
This is simple but does not account for changes in price or volatility.
Fixed capital
Allocate $10,000 to each trade.
This keeps the investment amount stable but not necessarily the risk.
Percentage of equity
Allocate 10% of current account equity to each position.
This adjusts as the account grows or declines.
Fixed risk
Risk 1% of account equity based on the distance to the initial stop.
This attempts to equalize the planned loss across trades.
Volatility-adjusted sizing
Reduce position size when volatility is high and increase it when volatility is low.
This can help normalize exposure across instruments.
Position sizing should be selected before examining the final performance chart.
Otherwise, leverage can be adjusted until an average strategy appears impressive.
Define the initial risk
A strategy should state what invalidates the trade or limits the loss.
Possible initial risk rules include:
A fixed percentage stop
A fixed price-distance stop
An ATR-based stop
A recent swing low or high
A time-based exit
No stop, but a portfolio-level risk limit
An ATR-based rule might be:
Place the initial stop two times the 14-bar ATR below the entry price.
This still requires further details:
Is ATR measured on the signal bar or entry bar?
Is the stop fixed after entry?
Is it recalculated on every bar?
What happens when the market gaps beyond the stop?
Is the exit assumed at the stop price or next available price?
Rules that appear simple often contain hidden assumptions.
Define the exit rule
The exit should be specified as carefully as the entry.
Possible exit rules include:
Exit below a recent low
Exit after a moving-average crossover
Exit after a fixed number of bars
Exit at a profit target
Exit with a trailing stop
Exit when an opposite signal occurs
Exit when the original setup is no longer valid
For example:
Exit long when the daily close falls below the lowest close of the previous 10 completed bars. Execute at the next bar’s open.
This is testable.
A rule such as “exit when momentum weakens” is not testable until momentum and weakening are both defined.
Distinguish signal price from execution price
A signal may be generated at one price and executed at another.
Suppose a breakout is confirmed at the daily close.
The signal price is the closing price.
But if the strategy waits until the bar is complete, the earliest simple execution assumption may be the next bar’s open.
That difference can matter when the market gaps.
A backtest that enters at the same close used to generate the signal may be using information that was not available early enough to trade at that price.
Every strategy should distinguish:
When the information becomes available
When the decision is made
When the order is submitted
Which price is assumed for execution
Define commissions and slippage before testing
Transaction costs should be included from the beginning.
Suppose a strategy makes a small average profit per trade. It may appear successful before costs and fail after realistic costs are added.
A simple cost model might state:
Include a commission of $2 per order and slippage of one minimum price increment on entry and exit.
For stocks, the assumptions might include:
Per-share commission
Minimum commission
Bid-ask spread
Percentage slippage
For futures:
Broker commission
Exchange and clearing fees
Tick size
Contract multiplier
Rollover treatment
For crypto:
Maker or taker fees
Spread
Funding costs
Exchange-specific execution differences
The exact model will never be perfect. But zero-cost assumptions are rarely realistic.
Define how overlapping signals are handled
Suppose a long position is already open and another long signal appears.
What should the strategy do?
Possible rules include:
Ignore the new signal
Add another position
Reset the stop
Recalculate position size
Replace the existing entry price
Allow a maximum number of additions
This is the issue of pyramiding.
A strategy should also explain what happens when an opposite signal appears:
Close the existing position only
Close and reverse immediately
Wait until the next bar
Ignore the opposite signal until the current trade exits
Leaving these choices undefined can produce inconsistent results.
Define the testing period
The selected historical period can strongly influence performance.
A strategy tested only during a strong bull market may look more reliable than it really is.
The test should ideally include different environments:
Bull markets
Bear markets
Sideways markets
High-volatility periods
Low-volatility periods
Crisis periods
Calm periods
Rising-rate and falling-rate environments
The objective is not to find a period in which the strategy performs best.
It is to understand when the strategy performs well and when it struggles.
Choose evaluation metrics before viewing the result
The criteria used to judge the strategy should be selected in advance.
Otherwise, the researcher may focus on whichever statistic looks most favourable.
Useful metrics include:
Total return
Annualized return
Maximum drawdown
Number of trades
Win rate
Average trade
Average win
Average loss
Payoff ratio
Profit factor
Sharpe ratio
Exposure
Time in market
Longest drawdown duration
Performance after costs
The importance of each metric depends on the strategy.
A high-frequency strategy requires careful attention to costs. A trend-following strategy may have a low win rate but a high payoff ratio. A long-term strategy may have few trades and therefore limited statistical evidence.
Example: turning an idea into rules
Consider the following initial idea:
Strong markets tend to continue rising.
This is not testable.
We can gradually convert it into a research plan.
Step 1: Define strong
A market is strong when it closes above the highest close of the previous 20 completed bars.
Step 2: Define the regime
Only consider long signals when price is above its 200-day simple moving average.
Step 3: Define the market
Test the strategy on liquid equity-index, bond, currency, metal, and energy futures.
Step 4: Define the timeframe
Use daily bars.
Step 5: Define the signal timing
Calculate the signal after the daily bar closes.
Step 6: Define execution
Enter at the next bar’s open.
Step 7: Define the initial stop
Set the initial stop two times the 14-day ATR below the entry price.
Step 8: Define position size
Size the position so that the distance from the entry to the initial stop represents 1% of current account equity.
Step 9: Define the exit
Exit when the daily close falls below the lowest close of the previous 10 completed bars. Execute at the next bar’s open.
Step 10: Define additional entries
Allow only one open position per market. Ignore new long signals while the position remains open.
Step 11: Define costs
Include estimated commissions and one tick of slippage on every entry and exit.
Step 12: Define evaluation criteria
Evaluate net return, maximum drawdown, number of trades, win rate, payoff ratio, profit factor, Sharpe ratio, and performance across different markets and periods.
The original statement has now become a strategy that can be implemented.
Write the complete rule set
The strategy can be summarized as follows.
Market universe
A diversified list of liquid futures markets.
Timeframe
Daily bars.
Direction
Long only.
Trend filter
The closing price must be above the 200-day simple moving average.
Entry signal
The current closing price must be above the highest closing price of the previous 20 completed bars.
Execution
Enter at the next bar’s open.
Position size
Risk 1% of current account equity based on the distance to the initial stop.
Initial stop
Two times the 14-day ATR below the entry price.
Exit signal
The current closing price falls below the lowest closing price of the previous 10 completed bars.
Exit execution
Exit at the next bar’s open, unless the protective stop is triggered earlier.
Pyramiding
Not allowed.
Costs
Include commissions and estimated slippage.
Maximum positions
Apply a portfolio-level limit to prevent excessive total exposure.
This does not mean the strategy is profitable.
It means the strategy is defined.
That is the necessary first step.
Avoid changing too many things at once
Once the first test is complete, the temptation is to modify everything:
Change the breakout from 20 bars to 50
Add an RSI filter
Replace the exit
Change the stop
Add a volume rule
Test another timeframe
Increase leverage
If several components change at once, it becomes difficult to understand why the result changed.
A better process is to alter one assumption at a time.
For example:
Test the 20-bar breakout without a trend filter.
Add the 200-day trend filter.
Compare several nearby breakout periods.
Compare fixed sizing with volatility-adjusted sizing.
Test alternative exits.
Increase cost assumptions.
Test additional markets.
This approach reveals which components contribute meaningful value.
Test ranges, not perfect parameters
Suppose the strategy performs best with a 37-bar breakout.
That does not necessarily mean 37 bars has special significance.
The stronger question is:
Does the idea work reasonably well across a range of similar values?
For example:
20 bars
30 bars
40 bars
50 bars
60 bars
A stable strategy may produce acceptable results across a broad region.
An overfit strategy may perform extremely well at 37 bars and poorly at 36 or 38.
Prefer stable regions to isolated peaks.
Keep an untouched test period
One of the biggest research mistakes is using all available data to design the strategy.
If every rule and parameter was chosen after examining the entire history, the final backtest is not an independent test.
A basic solution is to divide the data.
In-sample period
Use this period to develop the rules.
Out-of-sample period
Keep this period untouched until the strategy design is reasonably complete.
The out-of-sample result provides a more honest test of whether the logic survives on data that did not directly influence the design.
It is still not a guarantee of future performance.
But it is more informative than repeatedly optimizing on the same history.
Record each research decision
A simple research log can prevent accidental hindsight.
For every test, record:
The hypothesis
The rule being changed
The reason for the change
The markets tested
The date range
The cost assumptions
The result
The conclusion
The next test
For example:
Hypothesis: Long breakouts may perform better when the long-term trend is positive.
Change: Add a 200-day moving-average filter.
Reason: Avoid long entries during established downward regimes.
Result: Drawdown decreased, but trade count and total return also fell.
Conclusion: The filter may improve risk-adjusted performance but reduces opportunity.
This is more useful than saving only the best equity curve.
Common mistakes when defining rules
1. Using subjective language
Examples:
Strong trend
Important support
Large candle
Weak momentum
Good volume
Clear breakout
These descriptions need numerical definitions.
For example:
Define a large candle as a true range greater than 1.5 times the 20-bar median true range.
The definition may later be changed, but it is now testable.
2. Selecting rules after viewing the chart
It is easy to look at historical charts and create rules that fit visible turning points.
This is hindsight.
A testable process defines the rules first and applies them to all qualifying data, including unattractive examples.
3. Ignoring failed signals
A trader may remember the breakout that began a major trend and overlook the many breakouts that quickly reversed.
The backtest must include every signal that met the rule.
4. Using future information
Examples include:
Entering at a close that was not known until the bar ended
Using the completed day’s high before the day was finished
Referencing future bars
Using revised data that was unavailable historically
Selecting stocks based on their current index membership
These errors can create results that could not have been achieved in real time.
5. Adding filters until the backtest looks good
Every additional condition can improve historical fit.
It can also make the strategy less likely to work on new data.
A filter should solve a clearly identified problem, not merely raise net profit.
6. Testing only one market
A strategy may appear successful because the selected market happened to suit it.
Testing several markets helps distinguish a general behaviour from a favourable example.
7. Ignoring execution
A signal is not a fill.
Strategies using limit orders, stop orders, intrabar conditions, or illiquid instruments require careful execution assumptions.
8. Optimizing position size instead of the idea
Increasing leverage can improve return statistics while hiding weak underlying performance.
Evaluate the unleveraged logic first.
A reusable strategy specification
Before coding a strategy, complete the following template.
Trading idea
What market behaviour might create an opportunity?
Hypothesis
What specific claim will be tested?
Market universe
Which instruments qualify?
Timeframe
Which bar interval will be used?
Session
Which trading hours and timezone apply?
Direction
Long, short, or both?
Setup
What conditions must exist before entry?
Entry signal
What exact event triggers the trade?
Signal timing
When does the required information become available?
Execution
Which order type and assumed fill price are used?
Position size
How is trade quantity calculated?
Initial risk
Where is the initial stop or invalidation point?
Exit
What exact event closes the trade?
Additional entries
Is pyramiding allowed?
Opposite signals
Does the strategy close, reverse, or ignore them?
Costs
Which commissions, spread, slippage, and financing costs are included?
Portfolio constraints
What limits total exposure?
Test period
Which dates are included?
Out-of-sample period
Which data remains untouched during development?
Evaluation
Which metrics will determine whether the idea deserves further research?
When every field has an answer, the strategy is ready to be coded.
The core principle
A trading idea becomes useful when it can fail clearly.
That may sound strange, but it is essential.
A statement such as:
Buy when the market looks strong.
can always be reinterpreted after the result is known.
A rule such as:
Enter long at the next bar’s open after a daily close above the previous 20-bar high.
can be tested and rejected.
That is a strength.
Clear rules allow the market to provide evidence.
The objective is not to make every idea survive. It is to eliminate ambiguity and discover which ideas deserve further investigation.
A strategy should be precise enough to code, simple enough to explain, and explicit enough to prove wrong.
That is how a trading idea becomes a testable system.
Next in Strategy
Expectancy: The Number That Matters More Than Win Rate
The next article will explain how win rate, average gain, and average loss combine to determine whether a strategy has a positive long-term expectation.
Subscribe to AlgoSolo for systematic trading strategy, realistic backtesting, and practical Pine Script v6 tutorials.
Educational content only. Nothing in this publication is investment advice or a recommendation to trade any financial instrument.
