Strategy specification guide

Trading setups: make the idea precise enough to test

A trading setup is a specified set of conditions that makes a candidate eligible for a trading decision. It does not establish a high probability of profit. A usable strategy also needs entry and fill assumptions, cancellation rules, position sizing, exits and portfolio constraints.

Build a testable set of conditions

The minimum specification

Two people should be able to read the same historical observations and identify the same candidates without seeing future bars. Labels such as strong trend, clean rejection and institutional buying do not meet that requirement on their own.

FieldDecision to write downWhy it changes the result
InputsSymbol universe, feed, interval, session and adjustment policyDifferent bars or survivorship choices produce different candidates
EligibilityExact price, indicator or calendar conditionsA pattern name can hide many incompatible definitions
Trigger and timingCompleted-bar condition or intrabar event; when an order is submittedA signal price is not necessarily an available execution price
CancellationExpiry, invalidation, data failure and existing-position rulesUnfilled candidates otherwise disappear from the record
Position and exitsQuantity, stop, target, time exit, costs and exposure limitsThe same entry can produce different return distributions

An invented breakout specification

This example defines mechanics rather than recommending a trade. Use standard daily bars from a named feed. For each completed bar, set the reference level to the highest high of the preceding 20 completed bars, excluding the current bar. A candidate occurs when the current close is strictly above that level and no position is open.

  • At that close, record the prior 20-bar level, the signal bar low and the signal timestamp. Missing history means no candidate.
  • Model an entry at the next session open. This price is not known when the signal is created; the example only enters if that open is above the frozen signal low.
  • Use that low as the stop reference. Set an illustrative target at twice the distance from the actual entry fill to the reference; exit at the close of the tenth holding session if neither price exit has occurred.
  • For a reproducible research comparison, use a fixed small quantity subject to available cash. Any risk-based size model must state how it handles an unknown next-open fill.
  • Declare how to treat a bar that reaches both exit levels. OHLC alone may not determine their order. Use verified finer data or a predefined conservative assumption and label it.

Pattern names do not identify a cause

Breakout, pullback, range re-entry and divergence describe different observable arrangements. They do not by themselves show why a participant traded or whether the pattern has positive expectancy.

Pattern familyA detail that must be specifiedAn unsupported leap to avoid
Breakout and retestHow the level is built and how long a retest remains eligibleEvery broken resistance level becomes effective support
Moving-average pullbackTouch, close below, recovery crossing, and average settingsTouching a moving average proves buying pressure
Failed breakoutThreshold beyond the range and deadline for return insideA chart proves someone deliberately trapped retail traders
DivergenceWhich pivots are matched and when they are confirmedA mismatch guarantees momentum exhaustion or reversal

A positive backtest average needs more than a trade count

Suppose 100 invented trades contain 40 wins averaging 2R and 60 losses averaging 1R. Gross expectancy is (40 × 2 − 60 × 1) / 100 = 0.20R per trade. If each trade costs 0.25R, net expectancy is −0.05R. The target ratio alone would have missed the negative result.

  • Use realized average wins and losses, including partial exits and gaps, rather than substituting the planned target and stop. Define R consistently.
  • No universal 50- or 100-trade threshold proves reliability. Dependence between trades, regime concentration and the number of tried variants all affect uncertainty.
  • Report the evaluation dates, candidate count, fills, costs, drawdown and exposure. Include skipped candidates and the reasons.
  • Choose parameters on development data, then evaluate on untouched observations. Selecting the best historical variant and increasing its size can amplify selection error.

What to record after execution

Save the setup version, observations at decision time, submitted order, actual fill and exit. Separate rule violations from trades that followed the rule and lost. A stop boundary is a chosen exit instruction, not a mathematical proof that a market thesis has become false.

  • Compare planned and actual price risk. A stop trigger does not guarantee the execution price; a stop-limit can remain unfilled.
  • For a bar-close TradingView model, verify calculation and fill settings explicitly. Enabling historical-tick recalculation changes the model; barstate.isconfirmed alone does not enforce historical close-only execution in that mode.
  • Review generated strategy code and chart orders before using a performance report. Pineify can help express the rules but does not establish an edge.
Where Pineify fits

Visual Pine Script Editor

Express supported indicator conditions visually, then inspect the generated script and its behavior in TradingView.

Build a testable set of conditions

Frequently asked questions

Educational specification and invented payoff example. The illustrative breakout model has not been backtested here and has no demonstrated return advantage.

Sources and verification