Article Library
What's New
About Us
Site Map


Unlimited Systems

Auto-generate unique

trading strategies for



Position Sizing Tool

Position sizing software for

trading. Trade smarter.

Maximize results.



The Breakout Bulletin

The following article was originally published in the November 2002 issue of The Breakout Bulletin.

A Volatility Filter

Traders thrive on volatility. If the market doesn't move, we can't profit. It seems logical, then, that volatility could be used as a filter in a trading system. But how? If high volatility is good, should we wait for signs of high volatility before entering a trade, or should we take a counter-trend approach and wait for low volatility in expectation of higher volatility to follow?


Consider the chart below, which consists of daily bars of the E-mini S&P 500. Below the price series I've plotted the true range. This is NOT the average true range but simply the true range of the daily bar. To me, the striking aspect of this plot is the cyclicality of the true range. It displays a surprising amount of regularity, with peaks following troughs every day or two. This tells me that if we want higher volatility, we need only wait for a low volatility day. The following day, or perhaps the one after that, will very likely have higher volatility, as defined by the true range.


Figure 1. Daily bars of the E-mini S&P 500 with the true range plotted below.


One application where we might want to use volatility is with a breakout-type system. If we want to enter the market on a breakout, we may benefit from restricting our entries to days that have higher volatility (e.g., higher true range). To see if this is true, I created the following simple system, shown below in EasyLanguage:


Input: StopPts  (30);  { Size of money management stop, points }

Var:   TR       (0);   { True Range }


 TR = TrueRange;


 Condition1 = TR < TR[1] and TR < TR[2];
 {Condition1 = true; }
 Condition2 = C > C[14] and C < C[2];
 {Condition2 = C < C[2];}
 Condition3 = C < C[14] and C > C[2];
 {Condition3 = C > C[2];}


 If Condition1 and Condition2 then
    Buy next bar at Highest(H, 2) stop;


 If Condition1 and Condition3 then
    Sell short next bar at Lowest(L, 2) stop;


 If MarketPosition = 1 and C > EntryPrice and BarsSinceEntry >= 1 then
    Sell this bar at close;


 If MarketPosition = -1 and C < EntryPrice and BarsSinceEntry >= 1 then
    Buy to cover this bar at close;


 If MarketPosition = 1 then
    Sell next bar at EntryPrice - StopPts stop;
 If MarketPosition = -1 then
    Buy to Cover next bar at EntryPrice + StopPts stop;


This system buys at the highest high of the last two bars and sells at the lowest low of the last two bars following two setup conditions. The first condition is our volatility filter. In order to determine that we're at a low point in the true range cycle, we require that the true range is less than it was on the previous bar and less than it was two bars ago. The two-bar-ago condition roughly matches the cycle length of true range, as seen from the plot in Fig. 1.


The second condition is a simple price pattern. The system wants to buy dips in an uptrend and sell rallies in a down trend, so for an up trend, we require the close to be greater than it was 14 bars ago. The dip is defined by C < C[2]; i.e., the close is less than it was two bars ago. We use the reverse logic for a short trade setup. If these two conditions are met, the system tries to enter on the next bar using the highest high/lowest low. The system exits at the first profitable close after at least one day and uses a fixed money management stop defined by the input StopPts.


Now for the results. Using TradeStation 6, I tested the system over the last 750 days on the continuous contract E-mini S&P (symbol @ES in TS 6) with $75 per contract deducted for trading costs. The lookback length (maximum number of bars the strategy references) was set to 15, and the input StopPts was set to 30.


Using the volatility filter, as in the code above, the results were as follows:


   Net Profit:      $10,863

   Percent Winners:    71% (21 trades total)

   Ave Trade:      $517

   Max Drawdown:  -$3,013

   Profit Factor:       3.82


If we remove the volatility filter by commenting out Condition1 and setting Condition1 = true, we get the following results:


   Net Profit:      $13,713

   Percent Winners:    69% (48 trades total)

   Ave Trade:      $286

   Max Drawdown:  -$6,100

   Profit Factor:       2.11


Although the net profit is higher, it takes twice as many trades and produces twice the drawdown. The profit factor -- a measure of robustness -- is much lower without the volatility filter. The volatility filter screens out half the trades but less than a quarter of the profits, indicating that it works as intended.


To confirm these results, I also tested the volatility filter with the simpler price pattern shown by the commented-out Condition2 and Condition3 variables above. These simpler conditions are C < C[2] for a long entry and C > C[2] for a short entry. Without the volatility filter, the results are marginal at best:


   Net Profit:      $3,525

   Percent Winners:    64% (120 trades total)

   Ave Trade:      $29

   Max Drawdown:  -$12,025

   Profit Factor:       1.07


When the volatility filter (Condition1) is added back in, the results are considerably better:


   Net Profit:      $7,750

   Percent Winners:    67% (55 trades total)

   Ave Trade:      $141

   Max Drawdown:  -$5,213

   Profit Factor:       1.37

While I wouldn't recommend trading this simple system as written, I think it demonstrates that a simple volatility filter based on the true range can improve the performance of a breakout system.

TradeStation Tips

I've run across a few tips for TradeStation that I've found useful. I know that many of you are savvy TradeStation users who probably know these already, but for those who don't, I hope you find them helpful. Thanks to those of you who clued me in to these.


Tip #1. This one relates to the "bouncing tick" problem I discussed last month. The problem -- in a nutshell -- is that when you have an exit stop order that applies to the day of entry and you're using daily bars, the intraday price movement might stop you out whereas TradeStation might not recognize that the stop got hit. This happens because TradeStation doesn't know how the market moved during the day when all it has is the open-high-low-close of the daily bar, so it needs to make certain assumptions. Sometimes it gets it right, sometimes not. While this is only an issue on the day of entry, it can affect the stated performance of a system.


One clever way to get around this problem is to use intraday data where the bar length is set to the number of minutes in the day's session. For the E-mini S&P and E-mini Nasdaq, for example, the number of minutes is 1410. For the day session only, the number of minutes is 405. So, if you use an intraday bar of 1410 minutes for the E-mini S&P, for example, you will see daily bars on the screen even though each bar is constructed from intraday data. This avoids the bouncing tick problem because TradeStation has a feature under Format Strategy called Backtesting Resolution. If you check the Backtesting Resolution box and set the resolution to a small number of minutes, such as 5 or 1, then TradeStation will properly account for the effects of intraday price movement on the plotted bars. The strategy will be run on intraday data even though the results will be shown for daily bars.


Tip #2. One of the drawbacks of TradeStation 6 is that you have no control over the data. We get whatever data TradeStation gives us and hope it's good. While you can't import data from another source into TradeStation (as far as I know), you can export the data that TradeStation 6 provides. To save TS 6 data to a text file, go to a chart window, and select Data Window from the View menu. This brings up a window that shows the prices for each bar on the chart. Right-click in the middle of the window and make sure that Show All Data is selected. You can then save the data to a text file by clicking on the disk icon on the data window's menu bar or by right-clicking and selecting Save....


Tip #3. This is also a TradeStation 6 tip. Most TS 6 users probably figure out this one on their own before long, but until you do, it can cause confusion. The data provided by TradeStation for TS 6 are not always stable. By that, I mean sometimes there are changes to the data that are posted throughout the day and evening. For example, if the exchange changes the settlement price an hour after the close, TradeStation will re-post the new price. Errors sometimes occur as well, and TradeStation re-posts the corrected prices. The only way to ensure that you're seeing the most up-to-date price data is to reload the data. Go to the View menu and select Refresh then Reload. I recommend doing this before running any system in order to make sure that the resulting trading orders are based on the most recent price data.

That's all for now. Good luck with your trading.


Mike Bryant

Breakout Futures