Unlocking the mystery of building trading strategies

Traders generally fall into one of two broad categories: Discretionary and systematic. While both groups develop and follow their own trading strategies, the systematic trader typically automates an objective set of trading rules that define exact conditions under which trades will be entered, managed and exited. This also allows him to backtest, optimize and forward-test a strategy before putting it to work in a live market. Through each step of the process, the trader can review a strategy performance report, a compilation of metrics that are based on statistical aspects of the system’s performance. The automation aspect also is a plus for traders looking for more consistent results.

While discretionary traders often use a combination of knowledge and intuition to find trading opportunities, systematic traders develop strategies based on quantifiable specifications. Here, with a focus on systematic trading, we will outline in detail the process of creating a trading strategy that can be measured, tested, optimized and auto-traded.

Indicator vs. strategy

Before we begin, note the distinction between technical indicators and strategies. A technical indicator is a mathematical calculation used to evaluate past and current price and volume activity. Whether available in the public domain (for example moving averages) or developed to perform a specific function, indicators help traders identify market conditions and make predictions about future price movements. However, indicators alone do not generate buy and sell signals.

In contrast, a strategy is a set of objective, absolute rules that defines how and when a trader will pounce. A strategy is composed of three basic parts:

Entry conditions that tell us how to enter a trade. Typically, entry conditions are based on a combination of trade filters, which identify the setup conditions, and trade triggers, the actual condition that prompts a trader to act. Both trade filters and triggers often are based on technical indicators.

Exit conditions that tell us how to get out of a trade. Trade management rules include exits such as profit targets, stop losses and trailing stops, and can be based on dollar values, time, number of price bars, etc.

Position sizing that tells us how much to trade. Position sizing can be based on a fixed number of shares/contracts, a fixed dollar amount or a percentage of capital. 

While an indicator is used to evaluate market conditions, a strategy is the playbook that determines how the indicator will be interpreted and applied. 

Birth of a strategy

The exact process of develolping a trading stategy differs based on the logic and complexity of the system; however, a general approach to converting an indicator into a strategy is to:

Define a basic trading strategy (this is based on observation)

Add filters to improve performance

Add rules for exits and position sizing

Optimize the variables, using both observation and strategy performance reports to measure results

Backtest using in- and out-of-sample historical data, and forward-performance test using live data to determine correlation (if the results are not correlated, it needs more work)

Trade the strategy, starting small and increasing position sizing only after the system has provided consistent results

A trading strategy starts with observation. A trader might observe, for example, a particular pattern in the market that seems to lead to potential trading opportunities. In “Creating custom indicators” (May 2013), we noticed that trading opportunities such as price and volume diverge and converge on the daily chart of the S&P 500 exchange-traded fund. In the article, this trading idea was converted into a technical indicator — the Volumizer — to evaluate the relationship between price and volume. The Volumizer plots the 40-day average price and 40-day relative average volume, allowing us to visualize differences between price and volume. The volume-price crossovers appear:

  • Blue when average price crosses above the relative average volume
  • Red when average price crosses below the relative average volume

We will use the Volumizer indicator and convert it into a strategy. This strategy is included for illustrative purposes only. Readers should perform their own testing and evaluation prior to using this or any other trading strategy.

To evaluate the idea, we first convert the Volumizer into a basic stop-and-reverse strategy that is:

  • Long when average price crosses above the relative average volume
  • Short when average price crosses below the relative average volume

Rather than using the daily SPY chart on which our first observations were made, a 60-minute chart is used to provide better volume resolution and improve testing accuracy. “Stop and reverse” (below) shows the stop-and-reverse strategy applied to a 60-minute chart of the SPDR S&P 500 ETF (SPY). Each time average price and relative average volume cross over, the trade changes direction. While we catch some nice moves and find that our idea has potential, there are areas where the strategy does not fit the market, evidenced by the cluster of trades that took place in late April. 

A performance report over a five-year time period shows that the basic stop-and-reverse strategy has a total net profit of $38,293, a profit factor of 1.49 and a maximum drawdown (trade close to trade close) of $15,893. These are, of course, not the only important metrics provided by the performance report; however, for simplicity’s sake, these are the metrics we will note when comparing the different versions of the example strategy.

Strategy enhancement

Once a basic strategy is in place, we can observe historical data to find areas where the strategy did not fit the market. Trade filters based on a variety of factors, such as the time of day, location of price or the value of an indicator, identify the setup conditions that precede a trade entry and can be added to improve the strategy’s performance.

It is important to note that our goal is not to eliminate all losing trades from the initial test. Adding too many filters will limit the statistical degrees of freedom, creating a statistically improbable trading setup that rarely (if ever) would trigger a trade. Instead, we want to add carefully selected filters that will enhance the overall effectiveness of the strategy.

In our Volumizer example, the raw strategy is long when average price crosses above the relative average volume, and short when average price crosses below the relative average volume. Because we observed a number of choppy trades, we add a filter that limits trades to when there is a more significant spread between price and volume. As a starting point, we choose to limit trades to instances when the spread is equal to or greater than one point.

The strategy performance report, however, shows no noticeable improvement after the addition of the filter, so we will have to determine the spread value that will produce the best results. This is accomplished through optimization. Most of today’s trading platforms support optimization studies, which involve entering a range for a specified input and allowing the computer to work through all possible combinations to find the value that would have performed the best during the specified testing period.

Optimizing values

We perform an optimization study to determine the optimal value for the spread filter. Using our trading platform, we test spread values between 0 and 4 in increments of 0.1. The study concludes that the optimal value for the spread filter is 0.3 points, as shown in the strategy optimization report. 

With the optimized spread value in place, we chart the strategy and review the strategy performance report. The chart, which appears in “Filtered performance” (below), provides visual confirmation that the filter is effective in eliminating some of the choppy trades. The strategy performance report indicates an overall improvement through the addition of the optimized spread filter: The strategy has a total net profit of $52,384, a profit factor of 1.93 and a maximum drawdown of $9,894. 

Additional filters can be added into a strategy to further refine trade entries, and optimizations can be performed for each variable, or across multiple variables in a multivariable optimization. A multivariable optimization finds the best combination of values for two or more variables. It should be noted that it is possible to over optimize any strategy to achieve incredible results on historical data. This is a form of curve-fitting, and although it can create a strategy that looks great on paper, it almost always leads to an unrealistic system that performs poorly in real life. 

Trade management

Most traders would agree that a system’s exit rules are equally as important as its entry conditions. It is possible to test a variety of exits to see which type of exit will yield the best results. Exits include those based on price, such as profit targets, stop losses and trailing stops; and those based on other factors, including time-based exits (such as end-of-day) or the passage of a specific number of price bars.

Our example strategy uses a stop-and-reverse methodology; essentially, it is the trigger of a new trade that generates an exit signal for the previous trade. In an attempt to improve the performance of the strategy, we test a variety of exit conditions.

The addition of a profit target seems to show promise, and we perform an optimization study to determine the best value. Instead of being a stop-and-reverse strategy, the system now exits at either a profit target (optimized at 12.3% of the trade entry price) or with an opposing signal, whichever comes first. “Banking profits” (below) shows this version of the strategy, with both the optimized trade filter and an optimized profit target in place. 

The addition of a profit target makes a modest improvement to many of the metrics in the strategy performance report. With the trade filter and a profit target, the strategy has a total net profit of $55,562 and a profit factor of 1.99; the maximum drawdown remains unchanged at $9,894. It is important to remember that these are not the only important metrics found within a performance report, and attention should be paid to the overall report when analyzing and comparing results.

Stop losses protect traders from large losses by signaling an exit if a trade moves in the wrong direction by a specified amount. Stop losses can be incorporated into any strategy, and again, traders can try different types of stops (such as one based on percentage of the trade or a fixed dollar amount), and optimized to find the value that yields the best results.

Optimizing and backtesting on historical data, as we have done here, provide valuable information. However, these steps are only part of the evaluation process, and the results can be misleading. While outside the scope of this article, out-of-sample testing and forward performance testing can offer a more realistic assessment of the system. Good correlation between backtesting, out-of-sample and forward performance testing results is vital in determining the viability of a trading system.

Position sizing

Position sizing refers to the number of shares, lots or contracts that will be placed with each trade. Two methods are commonly used by traders: Constant position sizing and fixed percentage position sizing. Constant position sizing uses the same amount of shares or contracts for every trade, while fixed percentage position sizing varies the position size as the value of the account changes. Position sizing is a critical consideration; it is a vital element in any trading strategy. 

Preservation of capital is essential to long-term success in trading: You cannot continue trading if you’ve blown through your trading account. As such, it is important to start with small position sizing. Positions should be increased only after the strategy has provided consistent results during live trading for a meaningful period of time (at least several months).

Responsible risk management involves responsible position sizing, thoroughly and accurately testing a strategy before risking real money and limiting the amount of money that is risked on any one trade. 

As you develop trading strategies, it is important to remember that any strategy can be turned into the holy grail on paper through poor testing practices and over-optimization; equally important to remember is that these curve-fit strategies likely will fail in a live market. Creativity and solid observation are more effective than blindly optimizing to achieve the best numbers.

An important advantage in having a trading strategy is that it can be automated so a computer monitors the markets for trading opportunities and executes the trades. Many traders find strategy automation beneficial to their trading because it keeps emotions in check, preserves discipline, improves order entry speed and accuracy and allows traders to achieve greater consistency. 

Note: Click here for the system code for the Volumizer sample system referenced in this article.

Jean Folger is the co-founder of, and system researcher with, PowerZone Trading, LLC. Jean can be reached at www.powerzonetrading.com.

About the Author

Jean Folger is the co-founder of and system researcher with PowerZone Trading, LLC.