Professional Documents
Culture Documents
In this issue:
You’ll be surprised by how quickly you can get up to speed and begin writing your own indicators and trading
strategies in EasyLanguage, and how this will open up a whole new world of market analysis.
IN THIS ISSUE
STAFF
PUBLISHER 2+1 Moving Average Strategy. . . . . . . . . . . . . . . . . . . . 2
Michael Burke
The 2+1 Moving Average strategy uses crossovers of the two faster averages to
VP, Client Training and Education
trade only in the direction of the trend as defined by the slow average, as well
EDITOR
as offering some suggestions on testing a strategy in its simplest state, making
Stanley Dash, CMT
VP, Applied Technical Analysis adjustments for trade size and then comparing the results.
DOWNLOAD FILES
TradeStation Labs
8050 SW 10th Street, Suite 2000 EDITOR’S MESSAGE
Plantation, FL 33324
TSLabs@TradeStation.com Welcome to the September 2015 issue of TradeStation Labs’ Strategy Concepts
Club.
All support, education and training services and materials on the
TradeStation website are for informational purposes and to help cus- All of us here at TradeStation want to congratulate our colleague Frederic
tomers learn more about how to use the power of TradeStation soft-
Palmliden, Sr. Quantitative Analyst, on completing the requirements for the
ware and services. No type of trading or investment advice is being
made, given or in any manner provided by any TradeStation affiliate. Chartered Financial Analyst (CFA) designation. Fred adds this to the Chartered
This material may also discuss in detail how TradeStation is Market Technician (CMT) designation. It’s quite an achievement!
designed to help you develop, test and implement trading strate-
gies. However, TradeStation does not provide or suggest trading
In this month’s issue, Fred revisits use of the VIX to generate signals in stock
strategies. We offer you unique tools to help you design your own index futures and ETFs. He has created a unique volatility oscillator from the VIX
strategies and look at how they could have performed in the past.
with bands that represent, well, the volatility of the volatility. The Adaptive VIX
While we believe this is very valuable information, we caution
you that simulated past performance of a trading strategy is Bands strategy generates swing-trading signals that are meant to capitalize on
no guarantee of its future performance or success. We also do extreme readings in this oscillator as defined by the adaptive bands.
not recommend or solicit the purchase or sale of any particular
securities or derivative products. Any symbols referenced are used My article is an application of three simple moving averages in a manner
only for the purposes of the demonstration, as an example—not a
recommendation.
that differs from a traditional three-line moving-average strategy. The 2+1 Moving
Average strategy uses crossovers of the two faster averages to trade only in
Finally, this material may discuss automated electronic order place-
ment and execution. Please note that even though TradeStation the direction of the trend as defined by the slow average. The article also offers
has been designed to automate your trading strategies and deliver some suggestions on testing a strategy in its simplest state, making adjustments
timely order placement, routing and execution, these things, as well
as access to the system itself, may at times be delayed or even fail
for trade size and then comparing the results.
due to market volatility, quote delays, system and software errors,
Internet traffic, outages and other factors.
As summer winds down here in the Northern Hemisphere, we’re working
on a variety of new strategies for autumn, including candlestick and other bar
TradeStation Group, Inc. Affiliates: All proprietary technology in
TradeStation is owned by TradeStation Technologies, Inc. Equities, patterns, and a trend-following strategy for use on intraday data.
equities options, and commodity futures products and services are
offered by TradeStation Securities, Inc. (Member NYSE, FINRA, NFA Read on and, as always, thanks for being a subscriber!
and SIPC). TradeStation Securities, Inc.’s SIPC coverage is available
only for equities and equities options accounts. Forex products and
services are offered by TradeStation Forex, a division of IBFX, Inc.
(Member NFA). Stanley Dash, CMT.
Copyright © 2001-2015 TradeStation Group, Inc.
BACKGROUND
The moving average needs little introduction. It may be the Features
most widely used, discussed and, sometimes, belittled indi- u Strategy Style: Trend-following
cator. Moving average strategy signals are usually based on u Markets: Equities, futures, forex
prices crossing a moving average, or two or more moving
u Trading Horizon: Position trading
averages of different lengths crossing each other, or various
combinations of relative position ad infinitum.
Studies/Files Included
The TSL:2+1 Moving Average strategy uses three u Strategy
moving averages in a manner that differs from the
TradeStation-supplied MovAvg3Line Cross LE and SE
u Workspace
strategy components. Whereas the supplied strategies
generate signals based on the relative positions of price and DOWNLOAD FILES
three moving averages, the 2+1 Moving Average strategy
uses crossovers of the two faster averages to trade only in
the direction of the trend. The trend is defined by the rela-
fast average, the fast average is above the
tive position of price and the slow average.
medium average and the medium average is
Given that this article uses daily bars of an ETF and a above the slow average. Customarily, these
test period exceeding 10 years, it is also an opportunity to are entry-only signals in and of themselves
consider using some of TradeStation’s features to shed light and are often tested as part of a “reversing”
on characteristics such as trade size that lie outside the core or “always in” strategy. The 2+1 Moving
signals. Average strategy differs in both the entry
Readers interested in additional moving average rules and the inclusion of exit rules.
strategies may want to review the Moving Average Channel The 2+1 Moving Average strategy uses
strategy, published in Issue 1, January 2015, and the Moving the slow average for the trade setup: when
Average Machine, published in Issue 3, March 2015. prices are above the slow average, entry
(long in this case) is prompted by the fast
average crossing over the medium average.
STRATEGY ELEMENTS As shown in figure 2, price and the averages
A traditional 3-line moving average strategy, including need not be aligned as in a traditional 3-line
the TradeStation-supplied MovAvg3Line Cross LE and moving average strategy described above.
SE, generates a long entry when a bar closes above the The crossover of the two faster averages
may occur at levels below the slow average even when the Figure 2: Fast average crosses over medium average while both those
averages are below the slow average. Yet price is above the slow
bar closes above the slow average. While the setup remains average and so long entry is taken.
bullish (prices above the slow average), a cross of the fast
average below the medium average is a signal to exit longs.
Setup, entry and exit for short trades are the reverse.
A few notes on terminology are in order. The words
“setup” and “entry” were used in the paragraphs above.
Strategy traders often use the word setup to refer to the
background conditions that identify market direction
and the possibility of an imminent signal. In this strategy,
the setup requirement is that price be above (below) the
slow average. The entry occurs on the crossover of the two
shorter averages.
Although this is primarily a matter of semantics, the
setup might also be construed as a filter. Many readers
are by now familiar with the idea of a filter: a trading rule
intended to reduce the number of unprofitable trades. The
2+1 Moving Average strategy could be viewed as a two-line
moving average strategy with trades filtered based on the
relationship of price to the third average.
TSL:2+1 Moving Average strategy has only four inputs,
used for setting the price value and the lengths of the
STRATEGY RULES
averages. The entry and exit rules outlined above are summarized
in this section. There are no protective or trailing stops
integrated into the strategy. TradeStation-supplied strategy
Input Default Description components such as Stop Loss and Dollar Trailing may be
Price value used in calculation of moving
added to a chart with this strategy.
Price Close averages and in comparison with slow
average for identification of trend Long Entries
u If price is above the slow average and the fast average
FastLength 10 Length (bars) of fast average
crosses over the medium average, then buy the open of
MedLength 50 Length (bars) of medium average the next bar. That is, long signals generated by the fast
SlowLength 200 Length (bars) of slow average average crossing over the medium average are taken
only when the prices are above the slow average.
STRATEGY CONCEPTS CLUB | 3
Short Entries Ratio Avg. Win:Avg. Loss
u If price is below the slow average and the fast average u These values are the same as the Profit Factor due to the
crosses under the medium average, then sell short the Percent Profitable of exactly 50%.
open of the next bar. That is, short signals generated by
the fast average crossing under the medium average are Avg Bars in Winning Trades and Avg Bars in Losing
taken only when the prices are below the slow average. Trades
u Holding periods for winning trades are more than double
Exits
those of losing trades. This is positive confirmation of the
u E xit long positions when the fast average crosses under trend-following nature of the strategy and reassurance that
the medium average. This could be a complete reversal psychological capital may be preserved.
of position if price is below the slow average.
Max. Shares/Contracts Held
u E
xit short positions when the fast average crosses over
u This field is highlighted here as it will be compared to the
the medium average. This could be a complete reversal
same field in the next test.
of position if price is above the slow average.
Percent of Time in the Market (not shown)
STRATEGY PERFORMANCE u At 64.16%, this is a reasonable metric for a trend-following
REPORT HIGHLIGHTS strategy.
The input values for the lengths of the moving averages were These results offer a profile of the strategy and its
left at the default values of 10, 50 and 200. The Price input was trend-following characteristics: number of trades, win rate,
left at the default value of Close. iShs Russell 2000 ETF (IWM) holding periods, time in market, etc. However, would a trader
was used in the following examples. have applied this strategy with a fixed 100-share position, or
BACK-TESTING SETTINGS is it more realistic to assume that a trader would have used a
fixed commitment of capital? During the test period, IWM
Trade Size 100 shares
ranged between 34.26 and 129.10, a very big range in which to
Commissions $.01 per share be trading a fixed number of shares.
History 11 years ending 6/30/2015 The next set of results was generated with the same
Bar Interval Daily trading rules but with the trade size based on constant capital
Max Bars Back 200
Figure 3: Strategy Performance Report – Performance Summary Tab
It may seem odd to use 11 years of history
instead of a round number. To accommodate
the slow average, the maximum number of
bars study will reference (MaxBarsBack) is set
to 200. That means that the earliest point at
which a signal could be taken is almost the end
of the first year of the 11 years, resulting in a
trade history approximating 10 years. In these
tests, the first entry was taken on 5/27/2005.
The first set of results presented below is
intended to provide feedback as to the basic
characteristics of the strategy and the quality of
the signals. As noted above, each trade is 100
shares regardless of the price of IWM.
Profit Factor
u Th
ese are encouraging values notwith-
standing the tilt to the short side.
Total Number of Trades and Percent
Profitable
u Although 32 trades is a limited sample, a
win rate of 50% is a promising metric for a
trend-following strategy. All performance results are hypothetical. Past performance, actual or hypothetical, is not necessarily indicative of future results.
Symbol IWM
$20,000, rounded to nearest 20 shares, minimum
Trade Size position 50 shares
Commissions $.01 per share
History 11 years ending 6/30/2015
Bar Interval Daily
All performance results are hypothetical. Past performance, actual or hypothetical, is not necessarily
Max Bars Back 200 indicative of future results.
All performance results are hypothetical. Past performance, actual or hypothetical, is not necessarily indicative of future results.
Built by traders for traders, the TradingApp® Store gives TradeStation clients
access to more ideas, strategies and custom trading solutions than ever before.
TradeStation Labs is an active contributor to the TradingApp Store, with dozens
of custom products available for download.
uS
elect and download any product instantly
Products from TradeStation Labs in the TradingApp Store download directly to your TradeStation desktop platform
in seconds – offering full compatibility and seamless integration.
u I n-house support
TradeStation Labs is a team of technical analysts who work side by side with the platform developers, bridging
the possibilities of what can be done with TradeStation and what you need to realize those possibilities. All
TradeStation Labs’ products are geared to helping you make the most of your TradeStation experience.
LEARN MORE
BACKGROUND
The Adaptive VIX Bands strategy builds on the Features
ideas in the Normalized VIX strategy published u Strategy Style: Volatility based
in the August 2015 issue of Strategy Concepts u Markets: Stock-index futures and ETFs
Club. This strategy also utilizes the VIX index u T rading Horizon: Swing trading
as a gauge of stock market volatility, but with
different characteristics. Instead of comparing the
normalized volatility to firm levels and holding Studies/Files Included
positions for only one trading session, this strategy u Strategy
compares the current volatility reading to adaptive u Indicator
bands and holds positions for a much longer u Workspace
period on average. The main benefit of adaptive
bands is the continuous flexibility to acclimate to DOWNLOAD FILES
the current environment. The custom bands will
widen when the volatility of the volatility increases
and narrow when it decreases. A contrarian
perspective is still employed, with long positions STRATEGY ELEMENTS
taken with relatively high volatility readings, The TSL:Adaptive VIX Bands strategy
while short positions are taken with relatively low requires a secondary data series (i.e., VIX
volatility readings. data) to function properly. The necessary
The custom strategy is outlined and analyzed VIX data can be inserted in a TradeStation
in detail below and provides another perspective chart using the symbol $VIX.X. The data
on applying the VIX index in strategy trading. series is purposely hidden in the screenshots
A custom indicator with vibrant graphics is also throughout this article to emphasize the
included in order to help visualize trading signals. strategy signals and improve their visibility.
The strategy’s core element is the adaptive bands that hug The TSL:Adaptive VIX Bands indicator is provided to
the modified VIX data. Since the VIX data follows more of a help visualize the trade signals. The indicator is used with
log-normal distribution as opposed to a normal distribution, inputs set as listed below.
the VIX data is first modified in this application using the nat-
Input Default Description
ural logarithm of the data. The arithmetic mean of the natural
log values (i.e., geometric mean at a log scale) is then sub- GSD_Num 2 Number of geometric standard deviations
to use for the Adaptive VIX Bands.
tracted from it to generate the current volatility reading used
in this strategy. The adaptive bands use a rolling approach: the Sample size length for the geometric
Sample_Size 20 mean and the standard deviation
top band is constructed using a specified positive multiple of calculation.
the rolling geometric standard deviation, while the lower band
uses the same deviation but on the negative side. Color used when the Adaptive VIX Bands
Wide_Band_Color Cyan are the widest in a rolling look-back
The current volatility reading (i.e., the natural logarithm period of 100 bars.
of the VIX minus the arithmetic mean of the natural loga- Color used when the Adaptive VIX Bands
rithm values of the VIX data) can then be compared to the Narrow_Band_Color Darkblue are the narrowest in a rolling look-back
adaptive bands. By default, the bands encompass about 95% period of 100 bars.
of the volatility readings on a rolling basis. This is to say that if Color used for the current volatility
the current reading is beyond one of the two bands, it is con- Base_Vol_Color White reading when the Adaptive VIX Bands are
sidered a significant reading and a strategy signal is generated. narrow.
If the current volatility reading crosses over the top band, a
Plot Description
long entry is taken on the following bar, while a short entry is
taken if the current volatility reading crosses below the lower Adaptive VIX Plots the current volatility reading.
band. This again is in accord with typical contrarian interpre- High AV Band Plots the rolling high adaptive VIX band.
tation of the VIX. Low AV Band Plots the rolling low adaptive VIX band.
To help visualize the current volatility reading contex- Input Default Description
tually, gradient colors are used both for the bands and for GSD_Num 2 Number of geometric standard deviations to
the volatility reading itself. The typical colors will fluctuate use for the Adaptive VIX Bands.
between the extreme colors specified as indicator inputs. The Sample size length for the geometric mean
colors used for the current volatility reading are reversed from Sample_Size 20 and the geometric standard deviation
calculation.
the colors used by the bands in order to see the plot more
easily. The wide band color is an exception, as it is replaced by Trail_Stop_Length 2 Look-back period for the lowest low and the
a base color. Otherwise, the volatility reading would be hard to highest high.
see when it is halfway between narrow and wide. Min_Long_Hold 5 Minimum holding period, in bars, for long
trades.
Positions are held for a minimum number of bars, which
Minimum holding period, in bars, for short
is specified as a strategy input. Then, long trades are closed Min_Short_Hold 5
trades.
when the low is less than the lowest low in a specified look-
back period. In a similar fashion, short trades are closed when The default input values were found, in part, by strategy
the high is greater than the highest high in a specified look- optimization and sensitivity analysis. (See the sensitivity anal-
back period. There is therefore open exposure (with long and ysis comments in the Strategy Performance Report Highlights
short trades) at least up to the specified minimum holding section.) Applying the strategy to other securities would likely
period. require adjustments to the input values.
Figure 2 illustrates an example of a long entry. In this case,
the current volatility reading crossed the top band and a long STRATEGY RULES
signal was generated at the open of the next bar. The position The TSL:Normalized VIX strategy was applied to the E-mini
is then closed after 12 bars when the low broke the lowest low S&P 500 Continuous Contract (@ES=107XN) using daily
for the last two bars with a minimum holding period of five bars. However, the strategy could be modified to be used on
bars. Again, notice that the VIX data series is hidden in order other securities (e.g., SPY) and bar intervals using the same
to highlight only the trades. basic principles. The detailed strategy rules are listed below.
STRATEGY PERFORMANCE
REPORT HIGHLIGHTS
The strategy was tested on the ES using
the custom continuous futures contract (@
ES=107XN), which is the closest replication
to the CME roll. The custom continuous
contract utilizes no back adjustment and All performance results are hypothetical. Past performance, actual or hypothetical, is not necessarily indicative of future results.
All performance results are hypothetical. Past performance, actual or hypothetical, is not necessarily indicative of future results.