Conditional XMA Strategy
Conditional XMA Strategy
UPCOMING EVENTS
LiveOnTheWeb
Spotlight On
https://www.tradestation.com
/support/webinars/bettertradi
ng.aspx
Getting Started
https://www.tradestation.com
/support/webinars/gettingstar
ted.aspx
On-Demand Catalog
https://www.tradestation.com
/support/webinars/archived_s
eminars.aspx
Long Entries:
Buy state after the 3-day exponential moving average (XMA) crosses above the slow Xtreme XMA.
A buy signal is taken only if no other signal is generated within a waiting period of 10 trading days.
Long Exits:
A partial long exit is taken when the 3-day XMA crosses under the fast Xtreme XMA.
Short Entries:
Sell short state after the 3-day XMA crosses under the slow Xtreme XMA.
A short signal is taken only if no other signal is generated within a waiting period of 10 trading days.
Short Exits:
A partial short exit is taken after the 3-day XMA crosses above the fast Xtreme XMA.
Strategy Inputs
Name: Value: Description:
RegFastXMA 3 Interval for the regular XMA
FastXMA 9 Interval for the fast Xtreme XMA
SlowXMA 200 Interval for the slow Xtreme XMA
Price Close Analysis techniques are based on close of security
RSILength 21 Interval for the RSI
Oversold 30 Oversold level for the RSI
OverBought 70 Overbought level for the RSI
XCounter 5 Period (in trading days) that the Xtreme XMA
switches from the slow to the fast interval
WaitPeriod 10 Waiting period for additional signals in trading days
ShareNum 100 Share amount traded
Strategy Variables
Name: Type: Description:
Xtreme Numeric An XMA that changes length from slow to fast
MyRSI Numeric A regular RSI indicator
MyCounter Numeric Counter for fast Xtreme XMA
RegXMA Numeric A regular XMA
LongState Boolean Switch used after a bullish 2-XMA cross
ShortState Boolean Switch used after a bearish 2-XMA cross
2|Page
TakeSignal Boolean Switch used to generate a buy or sell short order
MyWaitPeriod Numeric Counter to identify whipsaws
Buy and sell short signal states (LongState and ShortState variables) are generated when a regular
exponential moving average (RegXMA variable) using a very fast interval of 3 (RegFastXMA input) crosses
over or under the slow Xtreme exponential moving average (Xtreme variable). A waiting period is allowed
using a counter (MyWaitPeriod variable) with a specified interval (WaitPeriod input) in order to check for
whipsaws.
If no additional signal is provided after the waiting period, the original signal is actually taken by using a
switch (TakeSignal variable). If another signal is generated, then the waiting period begins again. In other
words, only signals followed by a quiet period of 10 trading days are taken. The Xtreme moving average
switches from using a slow interval (SlowXMA input) to a fast interval (FastXMA input) when the RSI (MyRSI
variable) crosses over or under the overbought (OverBought input) and oversold (OverSold input) levels.
The interval for the RSI indicator is also specified in the inputs (RSILength input). At that point, when the RSI
is overbought, or oversold, another counter (MyCounter variable) using another specified time (XCounter
input) starts and the fast length for the Xtreme moving average is used. Once the counter is down to zero, the
strategy reverts back to the slower length for the Xtreme moving average. All analysis techniques are based
on the close (Price input) and the trade size is 100 (ShareNum input).
Two separate indicators are used in order to illustrate the strategy’s behavior. The first indicator is the built-
in relative strength index (RSI) with a length of 21. The second indicator is the Xtreme moving average,
which mirrors the behavior of the Xtreme moving average from the discussed strategy. The different input
names and values are set to correspond to the strategy’s inputs, except for the WaitPeriod and ShareNum
inputs, which are not needed for the indicator.
Performance Summary
The strategy’s results applied to the SPY are shown on the next few pages. Sections of particular interest
from the TradeStation Performance Report have been selected.
Reminders:
The equity curve shows an overall picture of the strategy’s performance for the period tested. A smooth and
linear curve is sought. The graph also provides a good visual for drawdowns over the period tested.
The TradeStation Performance Summary provides valuable figures for the strategy. A strategy trader usually
pays particular attention to the risk-adjusted figures, including the K-Ratio and the RINA index.
The Average Profit by Month graph also provides clues as to the system’s consistency. Ideally, gains are
spread out equally throughout the year.
The Weekly Equity Curve Underwater provides drawdown figures in percentage terms. Consistent and small
drawdowns are ideal.
Important Notice: As a reminder, the strategy discussed in this paper is not meant as a canned trade-ready
strategy. Instead, it is meant for educational and demonstration purposes only. Moreover, past results are
no guarantee of future performance.
3|Page
Figure 2: Daily Equity Curve Performance Graph
4|Page
Figure 4: Average Profit by Month
5|Page
Strategy Strengths
What most stands out from this strategy is that for a trending system, much whipsaw is avoided,
partial profit is taken early, and the drawdowns are relatively small.
Also, changing the input values up and down does not alter the strategy’s overall behavior, meaning
that the rules appear sound and the inputs are not peak values.
Lastly, for a system that is almost always in the market, a RINA score of 38.12 is nice to see.
Strategy Weaknesses
While much whipsaw is reduced or eliminated, it is not completely avoided. About half of all trades
are losing trades.
While partial profit is captured early, improvements appear needed to hold on to even more open
profits.
Lastly, the interval between equity peaks was high at times for the tested period.
Conclusion
The strategy’s basic rules appear to be promising, but additional rules and conditions would be needed to
convert it to an actual tradable strategy. For example, additional refinements could be performed to scale out
of positions. Also, allowing the strategy to be flat at times might be an interesting concept to explore in this
case.
When working with the strategy in its current form, simple changes to the inputs can produce noticeable
improvements. For example, decreasing the number of trades by adjusting the inputs to make the signals
more restrictive improves the overall performance. Experiment by changing the RSI length from 21 to 28,
and by changing the XCounter and WaitPeriod to 4 and 18 respectively. These particular inputs, found
through sensitivity testing analysis, smooth the equity curve considerably.
One question you may have is which rule has the biggest impact on performance. The new inputs above
show that for this particular strategy, the money management technique has a minimum positive impact on
the overall performance since only one partial sell is taken during the backtest period with those new inputs.
As a reminder, money management in strategy trading has everything to do with scaling in and out of
positions. Therefore, the rule that creates the most value for this particular strategy appears to be the one
that delays the Buy/Sell signals. Please keep in mind that all observations are based only on the S&P Spider
(SPY) in this case.
Overall, the strategy does meet the objectives that it aimed for, namely reducing whipsaws and holding on to
open profits more than a conventional trend-following strategy. The following equity curves highlight the
improvements that the Conditional XMA strategy provides in relation to a strategy based on a regular 2-MA
cross system. Notice that the drawdowns are smaller (less whipsaws) and the performance is much more
linear.
As with the other TradeStation Labs reports, we hope the content of this report generates new ideas for you
to consider and build on. I encourage you to use the ideas presented in this report to potentially take your
6|Page
trading to the next level. If you have questions, comments, or would like to share what you were able to do
based on what was presented in this report, please feel free to email me. Good luck with your trades!
In order to open the sample workspaces provided, you may first need to import the custom EasyLanguage file with the
extension .eld. Copy the attached .eld file and workspaces to your computer. Then import the indicators or strategies
by double-clicking on the EasyLanguage .eld file. This will automatically start the TradeStation import wizard. Click
‘Next’ until the Analysis Techniques and/or strategies have been imported. The indicators are now available in and you
can now open the provided workspaces. Other supportive documents or files may also be attached to this email.
All support, education and training services and materials on the TradeStation Securities website are for informational
purposes and to help customers learn more about how to use the power of TradeStation software and services. No type of
trading or investment advice or strategy is being made, given or in any manner provided by TradeStation Securities or its
affiliates.
Member NYSE, FINRA, NFA and SIPC. A subsidiary of TradeStation Group, Inc. (Nasdaq Symbol: TRAD)
Important Information | Notice to Online Traders | TradeStation Securities Account Agreement for Securities Accounts | TradeStation
Securities Account Agreement for Futures Accounts | TradeStation Technologies Subscription Agreement | Day-Trading Risk Disclosure |
Extended Hours Trading Risk Disclosure | Margin Disclosure Statement | Risk Disclosure Statement For Security Futures Contracts |
Characteristics and Risks of Standardized Options | Description and Certain Risks of Forex Trading | Risk Disclosure Statement for Futures
and Futures Options | Exercise and Assignment Policy for Futures Options | New York Board of Trade Electronic Order Routing Systems
Disclosure Statement | Trading and Order Routing Disclosure Statement for Futures Trades | Special Statement for Uncovered Options
Writers | Anti-Money Laundering Requirements | Business Continuity Plan Disclosure | Truth-in-Lending Disclosure Statement | Web Site
User Agreement, Disclaimers and Certain Legal Notices | Privacy Policy
7|Page