100% found this document useful (1 vote)
721 views64 pages

2021 Oct

Uploaded by

Ahm Ferdous
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
721 views64 pages

2021 Oct

Uploaded by

Ahm Ferdous
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 64

THE TRADERS’ MAGAZINE SINCE 1982

www.traders.com OCTOBER 2021

WHEN BACKTESTS
MEET REALITY
Part 2: Evaluating live
strategy performance 8

CAPTURING
OPPORTUNITY
By fading the news 14

CYCLE/TREND
ANALYTICS
The MAD indicator 20

LINEAR REGRESSION
OF PRICE AND TIME
Part 2: The regression adaptive
moving average (RAMA) 24

INTERVIEW
David Lundgren 30

THE DIRECTIONAL
CROSS STRATEGY
A trend-following approach 40
OCTOBER 2021
Take Control of Your Trading with the
Professional Traders’ Starter Kit ™
Stocks & Commodities magazine

5
only

$
Digital Working
Edition Money

Article Code Digital


Optimized per month! * Archive
Trading Traders.com Advantage
The Foremost Collection For Traders 4. Traders.com Advantage, premium website content delivering
This massive collection packages the best tools for trading and real-world technical analysis to you! You’ll get five years of
investing in any market! charts, indicators, and “how-to” advice for specific markets,
1. Technical Analysis of Stocks & Commodities, the Traders’ currencies, stocks, and commodities; near-term opportunities;
Magazine™. The premier magazine for technical analysis. price movement; new techniques. Posted in real-time with an
You’ll get five years — 65 issues — including our annual archive of thousands of articles.
Bonus Issues with our Readers’ Choice Awards. 5. Working Money, the Investors’ Magazine online. You’ll get five
2. S&C Digital Edition. Recent complete issues available in their years of market observations; explanations of charts, markets,
entirety as PDFs for you to either download or read directly and market sectors; money management; and interviews with
in your browser. No more waiting for the mail to deliver your money people that will help you trade and invest wisely.
magazine! You will still receive the printed magazine unless 6. Article Code. Download or copy & paste code presented in
you opt for a digital-only subscription. past issues of Stocks & Commodities — no need to type
3. Complete Digital Archive. The complete archives as PDFs it out manually.
— more than 17,000 pages — from Technical Analysis of 7 . Optimized Trading. The optimized indicator values can be
Stocks & Commodities from 1982 through the present. used as starting points when trying to decide what values to
The articles can be read in your browser or download to input into your charting software. Search for a certain symbol
your computer (or any device with Internet or company or build your own portfolio.
access and the ability to read a PDF)!

ALSO RECEIVE A FREE✝ BOOK


WITH YOUR PTSK ORDER!
Charting The Stock Market: The Wyckoff
Method, edited by Jack K. Hutson, is yours
free✝ with your order for the Professional
Traders’ Starter Kit. www.Traders.com

Shipping and handling charges apply for foreign orders.
*Based on the 5-year subscription rate of $299.99. Shipping extra for foreign addresses.

Email: [email protected] • Phone: 206-938-0570 facebook.com/STOCKSandCOMMODITIES @STOCKSandCOMM


The Professional’s
Gateway to the
World’s Markets
Starting at $0 Commissions
on US listed stocks and ETFs1
with no added spreads, ticket charges, or account minimums

ibkr.com/progateway

Interactive Brokers Rated #1 ... Again


Best Online Broker 2021 by Barron’s*

Member - NYSE, FINRA, SIPC – *Interactive Brokers rated #1, Best Online Broker according to Barron’s Best Online Brokers Survey
of 2021: February 26, 2021. For more information see, ibkr.com/info - Barron’s is a registered trademark of Dow Jones & Co. Inc.
[1] IBKR Lite provides commission-free trades in US exchange-listed stocks and ETFs routed to select market makers. IBKR may
charge non-commission related fees. For more information, see ibkr.com/liteinfo 08-IB21-1485CH1476
CONTENTS OCTOBER 2021, VOLUME 39 NUMBER 11

6 Futures For You analysis strategies, particularly


by Carley Garner momentum and trend following.
The Traders’ MagazineTM Here’s how the futures market He was a managing director,
really works. portfolio manager, and director of
technical research at Wellington
EDITORIAL
[email protected] FEATURE ARTICLE Management. He has held similar
8 When Backtests Meet Reality positions at Fidelity Management
Editor in Chief Jack K. Hutson
Part 2 and Thomson Financial. He
Production Manager Karen E. Wasserman
by Johann Christian Lotter has launched several research
Art Director Christine Morrison
and investment firms, including
Last time in part 1, we looked
Graphic Designer Wayne Shaw
Lundgren Financial Services,
at some important facets and
Webmaster Han J. Kim
Breakaway Research, and hedge
components of backtesting a trading
Contributing Editors John Ehlers,
fund Lyceum Capital. He co-hosts
Anthony W. Warren, PhD. strategy before you take it live. Here
the monthly podcast “Fill the
Contributing Writers Thomas Bulkowski, Martin Pring, in part 2, we continue by presenting
Gap” for the CMT Association,
Barbara Star, Markos Katsanos, Leslie N. Masonson,
an objective method of evaluating
Karl Montevirgen which he launched at the start of
your strategy in live trading so you
2021. Stocks & Commodities
can determine when you may need
OFFICE OF THE PUBLISHER contributing writer Karl
to correct course.
Publisher Jack K. Hutson Montevirgen interviewed David
Industrial Engineer Jason K. Hutson Lundgren to ask him for some of
Project Engineer Sean M. Moore 13 Market Rap his insights as well as to explore
by Emilio Tomasini
some of the strong historical links
ADVERTISING SALES “Unserious” thoughts on serious between technical and fundamental
4757 California Ave. S.W.
Seattle, WA 98116-4499 topics in finance. analysis.
206 938-0570 Fax 206 938-1307
[email protected]
14 Capturing Opportunity By 37 Algo Q&A
National Sales Manager Edward W. Schramm
[email protected] Fading The News by Kevin J. Davey
by Perry J. Kaufman Got a question about system or algo
CIRCULATION Is there an opportunity to sell a trading?
Subscription & Order Service 1 800 832-4642 rally following a stock upgrade or
1 206 938-0570 Fax 1 206 938-1307
[email protected]
other bullish news on a company? 38 Swing Trading 50SMA Pivots
Here’s a test to find out. by Ken Calhoun
Subscription Manager Sean M. Moore
One of the more valuable strategies
20 Cycle/Trend Analytics And you can use as a technical trader
WEBSITE TIPS
http://www.traders.com
The MAD Indicator is to look for patterns that repeat
Staff members may be emailed using first initial
by John F. Ehlers consistently over time.
plus last name plus @traders.com Here, we introduce the moving
average difference (MAD) indicator 40 The Directional Cross Strategy
and explain the rationale behind its by Azeez Mustapha
Author­i­za­tion to pho­to­copy items for inter­nal or per­sonal
use, or the inter­nal or per­sonal use of spe­cific cli­ents, is grant- creation. You will find the indicator Here we introduce a simple chart-
ed by Tech­ni­cal Anal­y­sis, Inc. for users reg­is­tered with the is robust yet reflects simplicity. based strategy you can consider.
Cop­y­right Clear­ance Cen­ter (CCC) Transactional Reporting
Serv­ice, pro­vided that the base fee of $1.00 per copy, plus
50¢ per page is paid directly to CCC, 222 Rosewood Drive, 24 Linear Regression Of Price And 44 Can Crosses Help Our Trade?
Danvers, MA 01923. Online: http://www.copyright.com. For Time, Part 2: The Regression by Stella Osoba, CMT
those organ­iz­ a­tions that have been granted a photocopy
license by CCC, a sep­a­rate sys­tem of pay­ment has been Adaptive Moving Average (RAMA) The death cross and golden cross
arranged. The fee code for users of the Transactional by Mike B. Siroky, MD are technical patterns that are often
Reporting Serv­ice is: 0738-3355/2020 $1.00 + 0.50.
Sub­scrip­tions: USA: one year (13 issues) $89.99;
Here’s a novel approach to the used to signal stock selloffs or
Magazines shipped outside the US require additional problem of incorporating changing rallies.
postage as follows: Canada, US$15 per year; Europe, market volatility into a moving
US$25.50 per year; all other countries US$39 per year.
Sin­gle copies of most past issues from the cur­rent year are
average. 60 Trading Perspectives
avail­a­ble pre­paid at $8 per copy. Prior years are avail­a­ble by Rob Friesen
in book format (without ads) or digitally from www.traders. 28 Explore Your Options Some perspectives on the equities
com. USA funds only. Washington state res­i­dents add
sales tax for their locale. VISA, MasterCard, AmEx, and
by Jay Kaeppel world.
Discover accepted. Subscription orders: 1 800 832-4642 Got a question about options?
or 1 206 938-0570.
Technical Analysis of Stocks & Commodities™, DEPARTMENTS
The Traders’ Magazine™, is prepared from information INTERVIEW 43 Trade News & Products
believed to be reliable but not guaranteed by us with­out 30 A Conversation With 46 Traders’ Tips
further verification, and does not purport to be complete.
Opinions expressed are subject to revision without noti-
David Lundgren 57 Advertisers’ Index
fication. We are not offer­ing to buy or sell securities or by Karl Montevirgen 57 Editorial Resource Index
58 Futures Liquidity
commodities discussed. Technical Anal­ysis Inc., one or David Lundgren, CMT, CFA, is 59 Classified Advertising
more of its officers, and authors may have a position in
the securities discussed herein. a 30-year investment industry 59 Traders’ Resource
The names of products and services presented in this veteran with a focus on technical
magazine are used only in an editorial fashion, and to the
benefit of the trademark owner, with no intention of infringing This article is the basis for n Cover: Ken Smith
on trademark rights. TIPS Traders’ Tips this month.
n Cover concept: Christine Morrison
Copyright © 2021 Technical Analysis, Inc. All rights reserved. Information in this publication must not be stored or reproduced in any form without written permission from the publisher. Technical Analysis
of Stocks & Commodities™ (ISSN 0738-3355) is published monthly with a Bonus Issue in March for $89.99 per year by Technical Analysis, Inc., 4757 California Ave. S.W., Seattle, WA 98116-4499. Periodicals
postage paid at Seattle, WA and at additional mailing offices. Postmaster: Send address changes to Technical Analysis of Stocks & Commodities™ 4757 California Ave. S.W., Seattle, WA 98116-4499 U.S.A.
Printed in the U.S.A.

4 • October 2021 • Technical Analysis of Stocks & Commodities


Traders take many paths to reach their destination.
Can your platform get you there?

Search apps and services to personalize the


NinjaTrader platform to meet your requirements.
Indicators, automated strategies, free tools & more.

Explore now at ninjatraderecosystem.com

Futures, foreign currency and options trading contains substantial risk and is not for every investor. Only
risk capital should be used for trading and only those with sufficient risk capital should consider trading.
FUTURES FOR YOU
INSIDE THE FUTURES WORLD
Want to find out how the futures markets really work? Carley Garner is
the senior strategist for DeCarley Trading, a division of Zaner, where she
also works as a broker. She has written five books on futures and options
trading, with the latest being Trading Commodity Options...With Creativ-
ity (July 2020), as well as A Trader’s First Book On Commodities (third
edition, October 2017) and Higher Probability Commodity Trading (July
2016). Garner also authors widely distributed e-newsletters; for a free
subscription, visit www.DeCarleyTrading.com. To submit a question, email
her at [email protected] or via www.DeCarleyTrading.com.
Selected questions will appear in a future issue of S&C.
Carley Garner

IS IT VIABLE TO TRADE COVERED sense to sell an additional call option futures contract is always 1.0 and the
CALLS IN COMMODITIES? (PART 2) to create a trade with an even bigger delta of a particular option will always
Last month we covered (no pun in- risk buffer. be less than 1.0 (with the exception
tended) the topic of covered calls in I would generally advise against of extreme volatility events in which
commodities. To summarize, covered selling the second call option with the options can react wildly to changes
calls can be a great strategy for those same strike price because doing so is in circumstances). For instance, if an
looking to participate in the futures overkill and creates a neutral position option delta is .50, the options price
market but require some room for rather than a bullish position. In this will fluctuate half as much as the
error. However, without some modi- example, a trader could have opted to underlying futures contract; a ten-
fication from the stock version of the sell the September $27.00 call option point move in the futures contract
practice, trading covered calls in for about 65 cents. This version of should equate to a five-point move
futures can be extremely risky; this the trade offers a risk buffer of $1.65 in the option.
is because the underlying futures con- if the trade is held to expiration! If The delta of the position, known
tract is leveraged and unless enough you have done the math, you know at as the net delta, is the sum of all of
premium is collected for the short expiration the trader breaks even at the components of the trade. This
call option, the strategy provides a $24.35 but makes money anywhere net delta gives traders an idea of how
false sense of security to the trader. volatile their position is and how it
As every trader eventually learns, will react to changes in the underlying
As every trader
complacency and overconfidence futures contract. For instance, using
tend to lead to peril. eventually learns, the example above, a trader long a
Let’s revisit the example used in last complacency and silver futures contract which has a
month’s column: A trader purchased overconfidence tend delta of 1.0, a short an at-the-money
a September silver futures contract at to lead to peril. call option ($26.00 strike) with a
$26.00 and simultaneously sold a call delta of .50, and a short a $27.00 call
option with a strike price of $26.00 above (until reaching the risk zone of with a delta of .35, carries a net delta
for $1.00. This gives the trader a risk the additional short call, which I will of .15 (1 − .50 − .35). This means
buffer to be wrong by $1.00 at expira- outline shortly). Below $24.35, the for each penny silver moves up or
tion before the position is a loser. In trader faces theoretically unlimited down, the trader makes or loses .15
other words, if held to expiration 48 risk similar to that of being long a cents. In the case of silver, each cent
days later and the price of silver was at futures contract. is worth $50 to a trader, so this po-
$25.00, the trade would merely break When trading covered calls, any sition would make or lose $7.50 per
even before transaction costs, which other form of futures versus options penny change in the price of silver.
isn’t a bad deal for being wrong by a spread, or even option spreads, it is As you can imagine, this is far more
dollar. As great as this sounds, a lot imperative that traders pay attention comfortable for the risk-averse than
can happen in 48 days and anyone to their delta. As a reminder, the delta making or losing $50 per penny. The
who has traded silver knows it can is the rate of change of a strategy price of silver can move quickly, so
travel a dollar in a single trading relative to a one lot price change in don’t let the small point value fool
session, or less. Thus, it might make the underlying. Thus, the delta of a you into complacency.
6 • October 2021 • Technical Analysis of Stocks & Commodities
FUTURES
Thrive With AbleTrend
With a lower delta, bigger down- Buy on Blue and Sell on Red
side risk buffer, and higher overall
profit potential, the trader employing
the modified strategy of selling two
calls against a single long futures
contract is creating an environ- Blue Dot Signals Buy
ment in which emotional turmoil Guidance Trend Direction Confirms
is mitigated. Accordingly, I believe Signaled on 5/27, Up over 170%
such a strategy promotes better
decision-making. Further, selling
option premium against futures
positions creates a strategy that Support Dots Trail the Price Up
stands to benefit from time-value Confirming the Trend
erosion, enabling a trader to turn Keeps You in the Trade
a profit even if the futures market
trades sideways.
That said, there is a drawback to
the strategy. Because the trader is
selling twice as many options as he
is long futures, there is theoretically
unlimited risk on the upside. In other
words, the trader can be too right in Triple Confirmed Buy/Sell Signals
the direction of the market. In this
case, the additional risk at expiration
occurs if the price of silver is above
$28.65; at that level, the trader is Traders Rave Over AbleTrend
exposed to risk similar to being short
a futures contract from that price.
Accordingly, any trader wishing to
ABLETREND 7.0 COLLECTED BY
participate in this strategy should be SINCE 1994

well-funded and prepared to act if


the rally becomes too much too soon.
While it isn’t feasible to provide an
in-depth example within this column
of limited length, I do cover the topic
in (arguably painful) detail in my
latest book, Trading Commodity
Options With Creativity.

This net delta gives


traders an idea of how
volatile their position
TEST DRIVE THE LATEST SIGNALS
is and how it will
react to changes in
the underlying futures THESE RESULTS ARE BASED ON SIMULATED OR HYPOTHETICAL PERFORMANCE RESULTS THAT HAVE CERTAIN INHERENT LIMITATIONS. UNLIKE THE RESULTS

contract. SHOWN IN AN ACTUAL PERFORMANCE RECORD, THESE RESULTS DO NOT REPRESENT ACTUAL TRADING. ALSO, BECAUSE THESE TRADES HAVE NOT ACTUAL-
LY BEEN EXECUTED, THESE RESULTS MAY HAVE UNDER-OR OVER-COMPENSATED FOR THE IMPACT, IF ANY, OF CERTAIN MARKET FACTORS, SUCH AS LACK OF
LIQUIDITY. SIMULATED OR HYPOTHETICAL TRADING PROGRAMS IN GENERAL ARE ALSO SUBJECT TO THE FACT THAT THEY ARE DESIGNED WITH THE BENEFIT
OF HINDSIGHT. NO REPRESENTATION IS BEING MADE THAT ANY ACCOUNT WILL OR IS LIKELY TO ACHIEVE PROFITS OR LOSSES SIMILAR TO THESE BEING
SHOWN. THE TESTIMONIAL MAY NOT BE REPRESENTATIVE OF THE EXPERIENCE OF OTHER CLIENTS AND THE TESTIMONIAL IS NO GUARANTEE OF FUTURE
PERFORMANCE OR SUCCESS. TECHNICAL ANALYSIS OF STOCKS & COMMODITIES LOGO AND AWARD ARE TRADEMARKS OF TECHNICAL ANALYSIS, INC.

October 2021 • Technical Analysis of Stocks & Commodities • 7


SYSTEM DEVELOPMENT

Evaluating Live Strategy Performance

When Backtests Meet Reality Part 2

Being able to predict with some accuracy the live survived all reality checks and rendered the test
trading behavior of a trading strategy is important worthless. On the other hand, the $2,000 loss might
to your bottom line. Last time in part 1, we looked at be just a random fluctuation. You need to find the real
some important facets and components of backtesting reason the strategy is losing money, and you need to do
a trading strategy before you take it live. Here in part this rather quickly and with some degree of accuracy.
2, we continue by presenting an objective method of After all, before losing any more money, you want
evaluating your strategy in live trading so you can to determine whether to pull out and abandon the
determine when you may need to correct course. system, or whether to grit your teeth and wait out a

I
rough spot.
magine: You have developed a new trading There are several methods you could use to help
strategy. It passed all tests with flying colors, you determine what may be going wrong with your
including the “reality check” described in strategy. Here, I’ll examine some approaches you could
part 1 of this article. You did everything right and take, and I’ll propose what may be a good solution.
have all reason to assume that backtest results will
be reproduced in live trading. But after letting the The likeliness of loss
system run live for two months, you notice that it is When looking at a typical profit curve of a live trad-
down by $2,000. That’s real money, the equivalent ing system (Figure 1), we notice that it consists of
of a decent bicycle. two main components: an upward trend, and random
Most algorithmic traders are familiar with this wiggles that superimpose the trend. It can be described
scenario. That’s why many prefer to run a new with this formula:
strategy for some time in paper-trading mode. But
that is normally not a good idea, since you would
have to paper-trade for at least a year to get some
statistically meaningful result. And by losing a year’s R = Accumulated profit
return, paper-trading could be a lot more expensive = Performance factor
than risking real money. Paper accounts are useful —that is, the “alpha” of the strategy
for testing whether the script is bug-free,
but not good for determining what the live
performance will be.
Several reasons can cause a strategy to lose
money in live trading. Maybe the exploited
market inefficiency just disappeared. Markets
change from time to time, but it would be a
strange coincidence if that happened right at
the start of live trading of your strategy. A
FIGURE 1: EUR/CHF VOLATILITY STRATEGY, LIVE 12-MONTH PROFIT CURVE.
more likely possibility is a mistake during Although this is an obviously profitable system, it was frequently underwater in the first
KEN SMITH

development, resulting in backtest bias that six weeks, and had drawdown durations up to four months.

by Johann Christian Lotter


October 2021 • Technical Analysis of Stocks & Commodities • 9
t = Trading period in days
= Random fluctuations
—that is, the “noise”

We assume in the following that all profits and


losses are measured in volume-independent units,
for instance, pips. The term is equivalent to
a (hopefully) upward rising slope that generates
the profit. The factor, the steepness of the slope,
can result from a price curve anomaly, a market
inefficiency, or whatever it is that the system
exploits. If the live performance is similar to
the backtest performance, can be determined
from the backtest—it’s the end profit divided by
the backtest period. FIGURE 2: EQUITY CURVE. This graph shows a section of a randomized backtest equity
curve (blue) with a window drawn over it. D' is the loss within the window, as described
The term represents positive or negative in step 2 of the CBI algorithm given in this article. The cold blood index (CBI) can help
daily fluctuations by noise or randomness in the you to evaluate live trading performance of a trading strategy.
price curve. They generate the drawdowns. The
mean is zero. But since the signal-to-noise ratio
of price curves is normally small, the effect by fluctuations with the square root of the backtest period. Longer test
dominates in short periods: | | >> . This is the reason periods produce worse drawdowns and consequently, later
why trading strategies are almost always underwater for they produce pull-out signals. Also, the likeliness that a
some time after start. You can see this effect in the live bad drawdown happens early after the start of live trading
profit curve in Figure 1. is not considered. And finally, the inequation establishes
How can you find out as early as possible whether a loss a hard limit but no quantitative measure for comparing
results from normal fluctuations, from a biased backtest, or backtest and reality.
from a permanent market change? A simple and obvious
way is to compare the live drawdown with the maximum The cold blood index (CBI)
drawdown in the backtest. If it’s worse, then pull out. This Here’s an algorithm that overcomes all of the problems
is the case when the following expression becomes true: mentioned earlier. It uses not the maximum drawdown
but the whole backtest equity curve to calculate the prob-
ability of a drawdown of given depth and length. If the
probability is sufficiently high, the system is still within
bounds and you can continue trading it “in cold blood,”
G = Backtest profit so to speak. I therefore dubbed this probability the cold
y = Backtest period blood index (CBI).
D = Backtest max drawdown The CBI algorithm:

Suppose we started live trading eight weeks ago. 1. Determine the length l and depth D of the current
The system was losing from the first day and so far it drawdown, and the overall live trading period t.
has accumulated a 200-pip loss. The backtest ran over 2. Place a sample window of same size l at the start of
300 weeks and produced a 2,000-pip profit. The worst the backtest equity curve (Figure 2).
backtest drawdown was 400 pips. Thus, the left side of the 3. Determine the loss D' from start to end of the win-
inequation is −200, the right side is 2,000/300 × 8 − 400
= −346. Which means that all is fine and we can continue
trading. Or can we?
There are some serious problems with the approach of There are methods you can use to
trying to compare the live drawdown with the maximum help you determine what may be
drawdown in the backtest. First, the maximum backtest going wrong with your strategy.
drawdown is a unique event and thus more or less random.
Even worse, the maximum drawdown normally grows
10 • October 2021 • Technical Analysis of Stocks & Commodities
Reach your trading goals

Online Traders Summit


Held several times a quarter, the Online Traders summit is 8 hours of FREE
instruction from Trading Experts who can teach you how to REACH your trading
goals. As a bonus, most of the presenters offer exclusive freebees to all registrants.

Register for the next summit at MetaStock.com/traders-summit.


dow. Increase a counter N when D' is equal or worse
than D.
4. Move the window forward by one day. You want to determine whether
5. Repeat steps 3 and 4 until the window arrives at
the end of the profit curve. Count the steps with a
to pull out and abandon a
counter S. system or whether to grit your
6. Randomize the backtest profit curve by shuffling teeth and wait out a rough spot.
without replacement.
7. Repeat steps 2 through 6 multiple times.
8. Calculate the CBI from the resulting N and S as in N and S. But it affects the accuracy of the result; good
described below. values are between 10 and 100. Assume we got a CBI of
0.25 for our example with the 200-pip drawdown. One
We can now calculate the drawdown probability P(l, D) out of four trading sessions would then have started with
from N, S, and t. First, we convert the live trading duration t a similar or worse drawdown. Thus, the bad start might
to a count T = t − l + 1, which is the number of all samples have been just bad luck and we see we can continue
of length l in the live trading curve. We know that N of trading. But we should continue to observe the CBI. When
S backtest samples produced a drawdown D or worse. If it drops below 0.05, we should pull the strategy out of the
we picked T random samples out of S, the probability P' market. Traditionally, in statistics, a P-value of 0.05 or less
to get none of these N is a combinatorial equation: is assumed to be significant.
In our example, the drawdown happened directly at
the beginning of live trading. The window size l is then
identical to our trading time t, hence T = = 1. This simplifies
the CBI formula to:

P − Probability of drawdown D in a section of length l.


N − Number of all samples of length l with drawdown D
or worse in the backtest curves.
S − Total of all samples of length l in the backtest
curves.
T − Total of all samples of length l in the live trading
curve.
—the quotient of drawdown samples and all samples—
P is the CBI we’re looking for. The number of repeats in
step 7 does not directly enter the formula since it’s inherent Continued on page 18

CBI INDICATOR CODE IN C


double logsum(int n) double* Shuffled = (double*)malloc(TestTime*sizeof(double));
{ int i;
if(n <= 1) return 0.; for(i=0; i<Repeats-1; i++) {
else return log((double)n)+logsum(n-1); randomize(SHUFFLE,Shuffled,Data,TestTime);
} N += cbi_count(Shuffled,TestTime,DDDepth,DDLength);
}
int cbi_count(double* Data,int TestTime,double DDDepth,int free(Shuffled);
DDLength) if(LiveTime > DDLength)
{ return 1.-exp(logsum(S-N)+logsum(S-T)-logsum(S)-
int S = TestTime-DDLength+1; logsum(S-N-T));
int i, N=0; else
for(i=0; i<S; i++) return ((double)N)/S;
if(Data[i+DDLength-1]-Data[i] <= -DDDepth) N++; }
return N;
} // cbi test program
double cbi(double* Data,int TestTime,int LiveTime,double void main()
DDDepth,int DDLength,int Repeats) {
{ double Data[10] = { 1,2,3,4,3,2,1,2,3,4 };
int T = LiveTime-DDLength+1; printf("\nCBI: %.2f",cbi(Data,10,8,2,5,50));
int S = (TestTime-DDLength+1) * Repeats; }
int N = cbi_count(Data,TestTime,DDDepth,DDLength);

12 • October 2021 • Technical Analysis of Stocks & Commodities


MARKET RAP
THE WORLD OF RETAIL TRADING
Emilio Tomasini is an adjunct professor of corporate finance at the
University of Bologna in Italy and is a professional trader. He has au-
dited over 5,000 accounts of traders during 13 years of a real-money
trading competition, giving him unique insights into what helps a retail
trader to succeed. He has expertise in technical analysis and trading
Emilio Tomasini
system design. In this column, he shares his sometimes “unserious”
thoughts on serious topics in finance. In his writings, he hopes to help the retail trader better understand the leap
from unprofitable to profitable trader, firmly believing that the right answers can come only if the right questions
are asked. At his website at www.emiliotomasini.com, he offers some of his expertise in a free video course.

WHAT THEY SAY MATTERS shades of gray. These days, I would would go bust and take his customers
In the trading world, people will strongly advise you not to put too down with him. This would happen
sometimes use tricks to give the much weight into seeing and believ- periodically, maybe every two years
illusion of trading success. It’s why ing “real traders making real trades,” or so. But his business would soon
it’s often said in educational spaces because we can’t always believe our flourish again because he would
and in this magazine to be sure to eyes. feign trustworthiness with falsified
do your due diligence and avoid Here’s an example. For some years brokerage statements.
guru-seeking. I was an admirer of a trader who, Even a real-money trading compe-
I used to publish a financial news- like me, frequently traded large lots tition has its pitfalls. A competition
letter that gave trading recommen- of German bunds, DAX, and S&P must have certain controls and regula-
dations. I wanted to be completely futures in a discretionary way. And tions in place to prevent misconduct.
transparent about it, so we would he seemed to do this in a public A competitor should not be allowed
show our actual brokerage settlement way during live presentations. But it to open multiple accounts in which
reports for the same trades we were turned out to be only for show. During he takes opposite positions. If that
recommending to our readers. I was his presentations, trades were appar- is allowed to happen, one of these
proud to be “a real trader making real ently artificially inserted into a demo accounts would likely eventually be
trades.” But then a law passed in Italy platform by someone working behind closed for margin calls while the other
that prevented financial journalists the scenes, so that just the good trades account will show brilliant results.
from trading the same stocks they were shown and the bad trades were My outlook today is that in this
write about. So our newsletter could deleted. It was an act. field, it matters what someone says.
no longer approach it that way. Of As another example, I once ob- They must be willing to acknowledge
course, such laws have a purpose and served some unrealistic-looking what is and what is not possible. You
are intended to help curb the so-called trades being made between two ac- should never believe it if someone
“pump and dump” scheme that could counts on what were illiquid stocks. tells you that you can simply become
hurt investors. However, our efforts It turned out that the accounts were rich trading the markets without any
in our newsletter to provide trade actually owned by the same person, risk or pain. That is never true. Sure,
transparency tells you how much I so it was the same person simply perhaps once a decade or so, the
tried during my career to distinguish taking opposite sides of the trade. market gives some generous gifts.
myself by simply showing the trades So the profits being touted weren’t (Bitcoin is one example of late.) But
I was executing. It’s also the reason so “magic” after all. you must be lucky or clever enough
that I managed a real-money trading These days, it’s also very easy to to grasp those gifts, because when
championship over the course of a “Photoshop” documents, equity lines, the market gives gifts, it does not
decade. My feeling then was that and settlement reports, so we can’t last forever. You must be quick to
there are two classes of players in always believe our eyes. I once sub- reap the profits.
our industry: One that is willing to scribed to a recommendation service So take the gifts, and skip the grifts.
show their real records and one that and I traded options for some years A good idea, observation, or clever
is just talk. with great success. But as we know, trading technique can be thought up
However, my outlook has evolved. volatility will inevitably explode in by anyone, whether or not they have
The older I get, the more I feel like the market, and whenever that hap- guru status.
there is no black & white but rather pened, the person running this service
October 2021 • Technical Analysis of Stocks & Commodities • 13
A Market-Neutral Trading Strategy

Capturing Opportunity By
Fading The News
Is there an opportunity to sell a rally following a stock change their recommendations the day after an earnings
upgrade or other bullish news on a company? Here’s a announcement or after a new statement of “guidance”
test to find out. is released by a company. If the earnings were good,
the recommendation increases in bullishness, and if the
by Perry J. Kaufman earnings were poor, just the opposite. It does not seem
very insightful.

J
ust like most of you, I watch the financial
news and listen to their recommenda- After the fact
tions. Sometimes the stock price jumps What is important to keep in mind about upgrades and
after an upgrade or falls following a downgrades is that we see the recommendations after the
downgrade. My trading platform shows fact. When a major brokerage house tells you that they
daily upgrades and downgrades, plus have changed stock X from a hold to a buy, you can be
a score next to a news item indicating sure you are the last to know. They have already notified
whether the reaction should be bullish their clients. We would expect that.
or bearish. If clients have been notified of an upgrade, we should
CHART COLLAGE: CHRISTINE MORRISON

How accurate are those recommendations? I have see a bump up, some sort of rally. If the stock has low
DMITRY NIKOLAEV/SHUTTERSTOCK/

no idea. It would take a huge effort to track the results, volume, the bump should be bigger. Then there are
and I expect that analysts do not keep a record of their traders who get onboard the same advice by watching
accuracy. Once they give advice, they move on. Their the volume increase and the price rally. They may only
advice could change the next day. hold it for a few hours, but that can be enough.
In fact, I have noticed that analysts sometimes will
14 • October 2021 • Technical Analysis of Stocks & Commodities
TRADING STRATEGIES

Can we profit from this advice?


Having watched this happen for years, I was convinced
that the best opportunity is to sell a rally that follows an
upgrade or a similar bullish news item under the theory
that it’s all in the market. But that means tracking a lot
of stocks, which does not fit my schedule. This requires
a caveat: If the bump is caused by the Fed raising or
lowering rates, that is a structural change, not a tem-
porary event. We need to avoid moves that affect the
whole market.
Instead of analyzing the fundamentals of each market,
or manually tracking upgrades, I can scan any stock,
looking for a jump up. But I also mentioned that a move FIGURE 1: NET PROFITS OF STOCK (TSLA), INDEX (QQQ), AND TOTAL.
up will also happen if the whole market, say the S&P, This displays net profits for Tesla using a gap of 4%. While there were greater
gapped up. To isolate a jump unique to one stock, we profits buying TSLA when it was below the index (QQQ), results show that
it was more reliable to sell TSLA when the gap was a positive 4%.
need to have a jump that is not mirrored in the S&P or
Nasdaq, whichever group the stock belongs to.
All Trades Long Trades Short Trades
Now we have the basis for a strategy Total Net Profit $10,178 $7,397 $2,780
We can apply this idea to any stock that has good activ- Profit Factor 1.5 1.42 2.15
ity and some volatility. We are looking for a price jump Total Trades 118 103 15
of more than, say, 5% in the stock minus the index. We Percent Profitable 39.8% 37.9% 53.3%
can now write the rules: Max Drawdown ($3,626) ($3,324) ($1,007)
FIGURE 2: TRADE STATISTICS (TSLA). Shown are the trade results
• Find the correlation between the stock returns and using a ±4% entry trigger for Tesla (TSLA). While there are only 15 short
sales of TSLA, they are much more reliable and produce a larger profit
the returns of SPY and QQQ over the past 20 or per trade.
40 days.
• Choose the index market with the higher correla- using common sense.
tion.
• If the correlation is greater than 0.50 (modest but • For the correlation lookback, we use 40 trading
correlated), look for a difference of more than days.
5% in today’s stock price move compared to the • For the minimum correlation, we use 0.50.
selected index. • For the exit gap, we use one-half the entry gap.
• If the condition is satisfied and the stock is greater
than the index, then sell short the stock and buy In the following example, none of the previous three
the index, using equal-risk position sizing. parameters were tested. You may find much better, or
• If the stock is below the index, buy the stock and sell worse, results by testing them.
short the index, using equal-risk position sizing. The only parameter tested was the entry gap, because
• Save the difference between the stock return and stocks have their own volatility as well as a tracking pattern
index return (the “gap”) at the time of entry. with regard to the index. Analysts call this beta.
• Exit the trade when the current gap falls to one-half I tested three stocks, essentially at random, keeping
the entry gap. in mind that we needed some activity. They were Tesla
(TSLA), Pfizer (PFE), and Wells Fargo (WFC). Data
In the sidebar “Test Code For ‘Fade The News’ began in 2000.
Strategy,” I provide some EasyLanguage code that
implements these strategy rules so that you can also test Tesla
this idea for yourself. Everyone is interested in Tesla. Figure 1 shows the net
profits of the stock, the index (QQQ), and the total. In
Examples this case, we used a gap of ±4%. While there were greater
There are a number of variables in the rules, but we will profits buying TSLA when it was below QQQ, results
only test the entry gap. The other variables we will set show that it was more reliable to sell TSLA when the
October 2021 • Technical Analysis of Stocks & Commodities • 15
TEST CODE FOR “FADE THE NEWS” STRATEGY
[LegacyColorValue = true]; sell short size shares this bar on close;
end;
{ PJK Fade Upgrades end
Copyright 2021 P J Kaufman. All rights reserved. else if QQQcorr > SPYcorr and QQQcorr > mincorr then begin
Verify correlation with SPY or QQQ gap = stockret - QQQret;
Then check for rallies in the stock vs no rally in index if gap > minjump then begin
useSPY = false;
Data1 = stock useQQQ = true;
Data2 = SPY size = investment/close;
Data3 = QQQ } indexsize = investment/close of data3;
sell short size shares this bar on close;
// period = lookback correlation end;
// crossoption =0 using trendline, =1 use price crossing trendline end;
end;
input: lookbackper(40), mincorr(0.50), minjump(0.03), printdetail(false);
vars: equity(0), PL(0), size(0), indexsize(0), SPYcorr(0), QQQcorr(0), // new trade buy
useSPY(false), useQQQ(false), gap(0), exitgap(0), stockret(0), if marketposition = 0 then begin
SPYret(0), QQQret(0), indexentry(0), cumstockPL(0), stockPL(0), in- if SPYcorr > QQQcorr and SPYcorr > mincorr then begin
dexPL(0), gap = SPYret - stockret;
cumindexPL(0), totalPL(0), adate(" "), investment(10000); if gap > -minjump then begin
useSPY = true;
// returns useQQQ = false;
stockret = close/close[1] - 1; size = investment/close;
SPYret = close of data2/close[1] of data2 - 1; buy size shares this bar on close;
QQQret = close of data3/close[1] of data3 - 1; indexentry = close of data2;
indexsize = investment/close of data2;
// test for best correlation end;
SPYcorr = correlation(SPYret,stockret,lookbackper); end
QQQcorr = correlation(QQQret,stockret,lookbackper); else if QQQcorr > SPYcorr and QQQcorr > mincorr then begin
gap = QQQret - stockret;
// clear if gap > -minjump then begin
if marketposition = 0 then begin useSPY = false;
gap = 0; useQQQ = true;
exitgap = 0; size = investment/close;
useSPY = false; buy size shares this bar on close;
useQQQ = false; indexentry = close of data3;
size = 0; indexsize = investment/close of data3;
indexsize = 0; end;
end; end;
end;
// test exit for long stock, short index
if marketposition > 0 then begin // cumstockPL = netprofit + openpositionprofit;
exitgap = gap/2; // stockPL = cumstockPL - cumstockPL[1];
if useSPY then if marketposition > 0 and useSPY then begin
gap = stockret - SPYret stockPL = size*(close - close[1]);
else if useQQQ then indexPL = indexsize*(close[1] of data2 - close of data2);
gap = stockret - QQQret; end
if gap <= -exitgap then begin else if marketposition > 0 and useQQQ then begin
sell all shares this bar on close; stockPL = size*(close - close[1]);
useSPY = false; indexPL = indexsize*(close[1] of data3 - close of data3);
useQQQ = false; end
end; else if marketposition < 0 and useSPY then begin
end; stockPL = size*(close[1]- close);
indexPL = indexsize*(close of data2 - close[1] of data2);
end
// exit from a short stock, long index else if marketposition < 0 and useQQQ then begin
if marketposition < 0 then begin stockPL = size*(close[1]- close);
exitgap = gap/2; indexPL = indexsize*(close of data3 - close[1] of data3);
if useSPY then end;
gap = stockret - SPYret cumstockPL = cumstockPL[1] + stockPL;
else if useQQQ then cumindexPL = cumindexPL[1] + indexPL;
gap = stockret - QQQret; totalPL = cumstockPL + cumindexPL;
if gap <= exitgap then begin
buy to cover all shares this bar on close; if printdetail then begin
useSPY = false; adate = ELdatetostring(date);
useQQQ = false; If Currentbar = 1 then print(file("c:\tradestation\Fade Upgrades.csv"),
end; "Date,Close,SPY,QQQ,StkRet,SPYRet,QQQRet,SPYcorr,QQQcorr,UseS
end; PY,UseQQQ,gap,stockpos,",
"stockPL,indexpos,indexPL,cumStkPL,cumIxPL,TotalPL");
// new trade sell short print(file("c:\tradestation\Fade Upgrades.csv"),adate, ",", close:8:2, ",", close
if marketposition = 0 then begin of data2:8:2, ",",
if SPYcorr > QQQcorr and SPYcorr > mincorr then begin close of data3:8:2, ",", stockret:8:4, ",", SPYret:8:4, ",", QQQret:8:4, ",",
gap = stockret - SPYret; SPYcorr:8:4, ",",
if gap > minjump then begin QQQ c orr:8:4, ",", UseSPY, ",", UseQQQ, ",", ga p:8:4, ",",
useSPY = true; marketposition*size:8:2, ",",
useQQQ = false; stockPL:8:4, ",", indexsize:8:2, ",", indexPL:8:4, ",", cumstockPL:8:2, ",",
size = investment/close; cumindexPL:8:2, ",", totalPL:8:2);
indexsize = investment/close of data2; end;

16 • October 2021 • Technical Analysis of Stocks & Commodities


FIGURE 3: NET PROFITS OF STOCK (WFC), INDEX (SPY), AND TOTAL. FIGURE 5: NET PROFITS OF STOCK (PFE), INDEX (SPY), AND TOTAL.
This displays the total profits for Wells Fargo using a ±5% entry trigger. In A ±3.5% entry trigger was used for Pfizer, indicating lower overall volatility.
this case, the equity index leg netted zero and all the profits were made in Both the stock and equity index legs of the trade were profitable.
the long and short stock position.

All Trades Long Trades Short Trades All Trades Long Trades Short Trades
Total Net Profit $7,526 $3,248 $4,279 Total Net Profit $8,744 $7,923 $821
Profit Factor 1.11 1.05 3.4 Profit Factor 1.22 1.2 2.73
Total Trades 817 801 16 Total Trades 566 559 7
Percent Profitable 43.2% 42.8% 62.5% Percent Profitable 45.1% 44.7% 71.4%
Max Drawdown ($6,525) ($7,573) ($760) Max Drawdown ($3,007) ($2,894) ($1,187)
FIGURE 4: TRADE STATISTICS (WFC). This shows Wells Fargo (WFC) FIGURE 6: TRADE STATISTICS (PFE). Pfizer (PFE) using a ±3.5% entry
results using a ±5% entry trigger. As with TSLA, the short sales were trigger. Consistent with the previous tests, the short stock trades outperform
more reliable. here also, even with few opportunities.

gap was a positive 4%. big move, most likely the stock and index will move the
While there are only 15 short sales of TSLA, they are same way, offsetting each other.
much more reliable and produce a larger profit per trade, There are many trades that are long the stock and
shown in the table in Figure 2. short the index. That is good because you do not need
to borrow stock for a short sale, and there is little cost
Wells Fargo to selling an ETF. But each long stock trade produces
The entry trigger was 5%, slightly higher than TSLA. small gains, while a few short sales in the stock are both
In this case, the equity index leg netted zero and all the very reliable and have much larger gains.
profits were made in the long and short stock position I was disappointed that there were so few short sales
(see Figure 3). As with TSLA, the short sales were more of the stocks because my concept was to sell stocks on
reliable, as seen in the table in Figure 4. an upgrade. It would be good to see if you could increase
the number of short sales, perhaps by changing the entry
Pfizer criterion to be different for buys and sells.
Each stock has its own personality. Pfizer (PFE) tests Because the trades are active for only a short time,
preferred an entry difference of ±3.5%, indicating lower you can track multiple stocks and take the first trade
overall volatility. Both the stock and equity index legs
of the trade were profitable (Figure 5).
To show the consistency, and perhaps the robustness of
the concept, the short stock trades continue to outperform, To show the consistency and
even with few opportunities (Figure 6). perhaps the robustness of
the concept, the short stock
Summing it up trades continue to outperform,
The benefit of this approach is that it is market neutral. even with few opportunities.
Once in the trade, it is only important that the stock
price and index price converge. If the market makes a
October 2021 • Technical Analysis of Stocks & Commodities • 17
available. That way, your investment is not idle and your
total return is the sum of all trades.
If nothing else, this tells you not to chase the price Look for a difference of
when it moves up following an upgrade announcement. more than 5% in today’s
You will be able to enter at a better price.
stock price move compared
Perry J. Kaufman is a trader and financial engineer. to the selected index.
He is the author of many books on trading and market
analysis, including the sixth edition (2020) of Trading
Systems and Methods (with the first edition published Further reading
in 1978 as a seminal book in the field of technical Kaufman, Perry J. [2020]. Kaufman Constructs Trading
analysis), and Kaufman Constructs Trading Systems Systems (print and ebook editions), Amazon.
(2020). For questions or comments, please go to www. [2020]. Trading Systems and Methods, 6th Edi-
kaufmansignals.com. tion, Wiley.
[1995]. Smarter Trading, McGraw-Hill
The code given in this article is available in the Article
Code section of our website, Traders.com.

LOTTER/BACKTESTS is still within bounds, or whether it has expired due to a


Continued from page 12 substantial and permanent market change. The CBI can
also be used for equity curve trading by switching from
real to simulated trades when it drops below a limit.
is the initial drawdown probability that we would also
intuitively expect. Johann Christian Lotter, M.Sc., is CTO at oP group
In the sidebar, “CBI Indicator Code In C,” I provide Germany, a software firm that develops algorithms for
code in C for my CBI indicator. The CBI code can also financial analysis and algorithmic trading. He runs the
be downloaded from the 2021 code repository on http:// blog The Financial Hacker (www.financial-hacker.com)
financial-hacker.com. Zorro can be downloaded from and can be reached via email at [email protected].
https://zorro-project.com/download.php.
The code shown runs directly on Zorro. For other The code given in this article is available in the Article
platforms, the randomize function has to be replaced with Code section of our website, Traders.com. It also can be
the platform-specific function for randomizing a data array downloaded from the Financial Hacker blog at https://
by permutation. The rest is plain C code and compiles on financial-hacker.com in the 2021 script repository.
any C or C++ development system. The cbi function gets
the volume-neutral backtest returns in a double array Data further reAding
of length TestTime. The Repeats parameter determines Lotter, Johann Christian [2021]. “When Backtests Meet
the number of repetitions with shuffled backtest curves. Reality, Part 1,” Technical Analysis of StockS & com-
At 1, only the original curve is used. Since C variables moditieS, Volume 39: August.
cannot store factorials of some thousand samples, their Lotter, Johann Christian, editor and publisher, “The Fi-
logarithms are summed up instead with the recursive nancial Hacker,” blog, https://financial-hacker.com.
logsum function, then converted back to the factorials Aronson, David [2007]. Evidence-Based Technical
quotient by taking the exponential. Analysis, Wiley.
‡The Zorro Project, https://zorro-project.com
An effective solution ‡See Editorial Resource Index
I find the CBI an extremely useful indicator for observing
a live trading system to help determine whether the system
18 • October 2021 • Technical Analysis of Stocks & Commodities
The best way to stay best-in-class
is to keep getting better.

thinkorswim isn’t just a suite of platforms made for


the trading-obsessed—it’s made by them. We use
real feedback to improve our platforms, giving
you the innovative features traders ask for most.

Learn more at thinkorswim.com

Ranked #1 Platforms & Tools, 2021 StockBrokers.com Annual Review.


TD Ameritrade, Inc., member FINRA/SIPC. © 2021 Charles Schwab & Co., Inc. All rights reserved.
A New Trend Indicator

Cycle/Trend Analytics And


The MAD Indicator
Here, we introduce the moving average difference (MAD) provide the details of my research and the indicator
indicator and explain the rationale behind its creation. You development, and describe what the oscillator is showing
will find the indicator is robust yet reflects simplicity. you, which will reveal its rationale. I will also provide
code for it so you can implement it yourself.
by John F. Ehlers I think you will find that this trend indicator is robust

I
across a range of input parameters and yet has the
have been conducting a research project that elegance of simplicity.
I started as a way to gain insight into the
characteristics of cycles in market data. (See An oscillator-style indicator
my May 2021 S&C article, “A Technical De- When I began my research project, I wanted to display
scription Of Market Data For Traders,” and my an oscillator in a way that would demonstrate how the
February 2021 article, “Creating More Robust oscillator would behave as the length of the moving
PROSTOCKSTUDIO/SHUTTERSTOCK/

Trading Strategies With The FM Demodula- average was varied. This could provide some of the
CHART COLLAGE: NIKKI MORR

tor”). Ultimately, the research led to my development of insights into the characteristics of cycles that I was
a new trend indicator—the moving average difference looking for. The idea was to display the oscillator in a
(MAD) oscillator. range of colors as a function of the length of the mov-
In this article, I will demonstrate this new indicator, ing average.
20 • October 2021 • Technical Analysis of Stocks & Commodities
INDICATORS

One way to create an oscillator-style


indicator is to subtract the moving average of
price from price itself. The moving average
contains the DC (zero-frequency) component
and the low-frequency components of the
data. So, subtracting the moving average
from price results in an indicator that FIGURE 1: CYCLE MODE. Cycle/trend analytics shows the response to a pure cycle over
the range of moving average values.
has a nominal zero mean and the higher-
frequency cycle components in the data.
The sidebar “Cycle/Trend Analytics”
provides EasyLanguage code that displays
an oscillator in a range of colors as a function
of the length of the moving average.

Cycle mode
In the code given in the “Cycle/Trend
Analytics” sidebar, which is code to display
the oscillator in a color scheme, the default
mode is “cycle.” In that mode, price, which
starts as the close, is overwritten as a 30-bar
period sine wave. A cyan line is plotted to
show the input price. The difference between
two moving averages was added later, so
that line will be ignored for now. Moving
FIGURE 2: TREND MODE. The cycle/trend analytic shows the strength of the trend as the
averages and the oscillator (osc) array were width of the displays. The amount of separation between the reddest line and the yellowest
computed over a range from 5 to 30 bars. line reflects the strength of the trend. When the red line is on top, the trend is up. When the
Each osc was assigned a value for the color red line is on the bottom, the trend is down.
green from 255 to 0 as the length was varied
from 5 to 30. This value, combined with
the color red, produced a net color of bright
yellow when the length is 5 and a color of
bright red when the length is 30.
The resulting display for the “cycle”
mode is shown in Figure 1. The indicator
output leads the input by almost 90 degrees
for the shortest moving average. This is
no great surprise, because a short moving
average is almost like the price, but delayed
a small amount. It looks like a momentum
function when the difference is taken. But
a momentum is analogous to a derivative FIGURE 3: MAD INDICATOR, EMINI S&P 500 FUTURES CONTINUOUS CONTRACT,
in calculus, and the derivative of a sine 12/1/2019 TO 7/1/2021. The MAD (moving average difference) indicator displays the
wave is a cosine wave. In other words, the trend as an oscillator scaled as a percentage of price.
indicator output leads the phase of the input
by about 90 degrees. when the length of the moving average is greater than
The indicator output is exactly in phase with the price a half cycle period.
input when the length of the moving average is one half
the cycle period. Again, this is no surprise, because the Trend mode
summation of a sine wave over a half cycle period is The surprise comes when changing the CTMode input
exactly in phase with the price cycle in the same frame from “cycle” to “trend” in the operation of the code.
of reference. The indicator has a relatively lagging phase This input change causes the block of code containing a
October 2021 • Technical Analysis of Stocks & Commodities • 21
theoretical sine wave data input to be ignored when the The surprising result (to me) is that the predominant
code runs. In this case, the value of price as the close effect is that the amount of separation between the reddest
is not overwritten, and we see the indicator applied to line and the yellowest line reflects the strength of the
real data. An example of the indicator applied to closing trend. When the red line is on top, the trend is up. When
prices is shown in Figure 2. the red line is on the bottom, the trend is down.
Moreover, the high-frequency squiggles in all the
indicators tend to be nearly the same. That is because
when the difference is taken between the price and its
average, all of the indicator lines have similar high-
This trend indicator is robust frequency content.
across a range of input So, the idea is to show the trend by taking the difference
parameters and yet has the of two oscillators. The high-frequency components are
elegance of simplicity. canceled when the difference is taken. If the difference
of the length of the two moving averages are one half

CYCLE/TREND ANALYTICS
The following EasyLanguage shows the derivation Color2, Color3),0,4);
If Length = 8 Then Plot8[0](Osc[Length], "S8", RGB(Color1,
code resulting in the MAD indicator. Color2, Color3),0,4);
If Length = 9 Then Plot9[0](Osc[Length], "S9", RGB(Color1,
{
Color2, Color3),0,4);
Cycle/Trend Analytics
If Length = 10 Then Plot10[0](Osc[Length], "S10", RGB(Color1,
(C) 2021 John F. Ehlers
Color2, Color3),0,4);
}
If Length = 11 Then Plot11[0](Osc[Length], "S11", RGB(Color1,
Color2, Color3),0,4);
Inputs:
If Length = 12 Then Plot12[0](Osc[Length], "S12", RGB(Color1,
CTMode("cycle");
Color2, Color3),0,4);
Vars:
If Length = 13 Then Plot13[0](Osc[Length], "S13", RGB(Color1,
Price(0),
Color2, Color3),0,4);
Length(0),
If Length = 14 Then Plot14[0](Osc[Length], "S14", RGB(Color1,
NormalLength(0),
Color2, Color3),0,4);
Color1(0),
If Length = 15 Then Plot15[0](Osc[Length], "S15", RGB(Color1,
Color2(0),
Color2, Color3),0,4);
Color3(0);
If Length = 16 Then Plot16[0](Osc[Length], "S16", RGB(Color1,
Color2, Color3),0,4);
Arrays:
If Length = 17 Then Plot17[0](Osc[Length], "S17", RGB(Color1,
Osc[50](0);
Color2, Color3),0,4);
If Length = 18 Then Plot18[0](Osc[Length], "S18", RGB(Color1,
Plot1(0,"",white, 1, 1);
Color2, Color3),0,4);
Price = Close;
If Length = 19 Then Plot19[0](Osc[Length], "S19", RGB(Color1,
Color2, Color3),0,4);
If CTMode = "cycle" ThenBegin
If Length = 20 Then Plot20[0](Osc[Length], "S20", RGB(Color1,
Price = Sine(360*CurrentBar / 30);
Color2, Color3),0,4);
Plot2(Price,"", cyan, 4, 4);
If Length = 21 Then Plot21[0](Osc[Length], "S21", RGB(Color1,
Plot3(Average(Price, 5) - Average(Price, 30),"", green, 4, 4);
Color2, Color3),0,4);
End;
If Length = 22 Then Plot22[0](Osc[Length], "S22", RGB(Color1,
Color2, Color3),0,4);
Color1 = 255;
If Length = 23 Then Plot23[0](Osc[Length], "S23", RGB(Color1,
Color3 = 0;
Color2, Color3),0,4);
For Length = 5 to 30 Begin
If Length = 24 Then Plot24[0](Osc[Length], "S24", RGB(Color1,
Osc[Length] = Price - Average(Price, Length);
Color2, Color3),0,4);
End;
If Length = 25 Then Plot25[0](Osc[Length], "S25", RGB(Color1,
Color2, Color3),0,4);
For Length = 5 to 30 Begin
If Length = 26 Then Plot26[0](Osc[Length], "S26", RGB(Color1,
Color2 = 306 - 10. 2*Length;
Color2, Color3),0,4);

If Length = 27 Then Plot27[0](Osc[Length], "S27", RGB(Color1,
//If Length = 3 Then Plot3[0](Osc[Length], "S3", RGB(Color1,
Color2, Color3),0,4);
Color2, Color3),0,4);
If Length = 28 Then Plot28[0](Osc[Length], "S28", RGB(Color1,
If Length = 4 Then Plot4[0](Osc[Length], "S4", RGB(Color1,
Color2, Color3),0,4);
Color2, Color3),0,4);
If Length = 29 Then Plot29[0](Osc[Length], "S29", RGB(Color1,
If Length = 5 Then Plot5[0](Osc[Length], "S5", RGB(Color1,
Color2, Color3),0,4);
Color2, Color3),0,4);
If Length = 30 Then Plot30[0](Osc[Length], "S30", RGB(Color1,
If Length = 6 Then Plot6[0](Osc[Length], "S6", RGB(Color1,
Color2, Color3),0,4);
Color2, Color3),0,4);
If Length = 7 Then Plot7[0](Osc[Length], "S7", RGB(Color1,
End;

22 • October 2021 • Technical Analysis of Stocks & Commodities


the period of the dominant cycle, then the resultant will THE MAD (MOVING AVERAGE DIFFERENCE) INDICATOR
be exactly in phase with the input price. You can verify {
this by changing the length of the second moving average MAD (Moving Average Difference) Indicator
in the plotting of the green line to 20. This makes the (C) 2021 John F. Ehlers
}
difference between the length of the two moving averages
15, exactly one half the length of the 30-bar cycle. The Inputs:
result is that the green line is overwritten by the cyan ShortLength(8),
LongLength(23);
line, showing the two are exactly in phase.
Taking the difference of the two oscillator indicators Vars:
MAD(0);
is mathematically the same as just taking the difference
of the two moving averages, because the price term in MAD = 100*(Average(Close, ShortLength) - Average(Close,
each oscillator is canceled. LongLength)) / Average(Close, LongLength);

Plot1(MAD, "", red, 4, 4);


A “ thinking man’s” MACD Plot2(0,"", white, 1, 1);
So there you have it. Although the derivation is convoluted,
the MAD (moving average difference) indicator is basi-
cally just the difference of two simple moving averages his website at MESAsoftware.com.
whose averaging lengths are different by approximately Ehlers will hold his annual workshop online October
half the period of the dominant cycle in the data. The 18–22, 2021, during which he will teach and discuss
indicator becomes smoother as the length of the shorter concepts from his decades of work in digital signal
moving average is increased. The length of the longer processing.
moving average should be the length of the shorter one
plus half the period of the dominant cycle in the data. The code given in this article is available in the Article
If the dominant cycle is unknown, just make the length Code section of our website, Traders. com.
of the longer moving average be twice the length of the
shorter one. See our Traders’ Tips section beginning on page 46 for
As a difference of moving averages, the MAD indicator implementation of John Ehlers’ technique in various
is a “thinking man’s” MACD, because there is a rationale technical analysis programs and trading platforms. Ac-
to establish the lengths of the moving averages. Further, companying program code can be found in the Traders’
simple moving averages have a linear phase response Tips area at Traders. com.
so that the differencing obviates the need for a third
smoothing average. Further reading
Code for the MAD indicator code is given in the sidebar Ehlers, John F. [2021]. Windowing,” Technical Analysis of
“The MAD (Moving Average Difference) Indicator.” For Stocks & Commodities, Volume 39: September.
convenience, the indicator is plotted as a percentage of [2021]. “Creating More Robust Trading Strategies
the closing price. The normalizing term is an average to With The FM Demodulator,” Technical Analysis of
keep the indicator as smooth as possible. Stocks & Commodities, Volume 39: June.
An example of the MAD indicator is plotted in Figure [2021]. “A Technical Description Of Market Data
3. This indicator is relatively insensitive to parameter For Traders,” Technical Analysis of Stocks & Com-
variations over relatively wide ranges. modities, Volume 39: May.
[2016].“Measuring Market Cycles,” Technical
Next time Analysis of Stocks & Commodities, Volume 34:
Next month, I will offer an extension of this concept and September.
present a modification to this indicator. I’ll show how [2013]. Cycle Analytics For Traders, John Wiley
it can be used to improve your trade timing and reduce & Sons.
false signals. ‡TradeStation
‡See Editorial Resource Index
John Ehlers, a Contributing Editor to Stocks &
Commodities, is a pioneer in the use of cycles and
DSP (digital signal processing) technical analysis. He is
president of MESA Software. He can be reached through
October 2021 • Technical Analysis of Stocks & Commodities • 23
Adapting To Changing Market Volatility

Linear Regression Of
Price And Time
Part 2: The Regression Adaptive Moving Average (RAMA)
Here’s a novel approach to the problem of incorporating moving average techniques utilize some measure of
changing market volatility into a moving average. volatility to produce a modified exponential moving
average. Perry Kaufman’s adaptive moving average
by Mike B. Siroky, MD (KAMA) uses the sum of absolute price changes to

A
measure volatility. Other filters have been described
moving average has two important character- by John Ehlers (fractal dimension, entropy) and Tushar
istics: 1) it smooths the noise in the data, and Chande (standard deviation). What these techniques
2) it lags behind the most recent price action. have in common is that they alter the effective length of
The longer the time window of the moving an exponential moving average to make it more or less
average, the more lag is built in. Exponential responsive to price change.
moving averages give more weight to recent Approaching this problem in a different way, I will use
prices and thus reduce lag. However, since the statistical concept of linear regression to develop an
the smoothing factor is a constant, exponential averages adaptive moving average.
cannot adapt to changing market volatility. Thus, during
nontrending or range-bound markets, neither simple nor Introducing RAMA
exponential moving averages eliminate the potential for a In the first article in this series on linear regression of
EIGHT_STUDIO/SHUTTERSTOCK

large number of false signals or whipsaws that can erode prices versus time, we saw that, in the case of a positive
the trader’s capital. regression line slope, the most recent price estimated by
Enter the adaptive moving average in an attempt the regression equation is furthest above the mean price,
to adapt to changing market volatility. Most adaptive while the estimate furthest back in time is the furthest
24 • October 2021 • Technical Analysis of Stocks & Commodities
QUANTATATIVE ANALYSIS

below the mean. This is reversed in the case of a nega-


tive slope. The mean is always exactly at the midpoint
of the regression line. Thus, by adjusting the X value,
representing time in a time series, the estimated price is
adjusted above or below the mean value. This is shown
clearly in Figure 1.
Now let us visualize this relationship as prices move
through time (Figure 2). If we are looking at a 25-day
regression, the last 25 days’ closing prices are regressed

MICROSOFT EXCEL
against a number series extending from zero to 24. Now,
if we select an appropriate volatility measure, we can
adjust the X value to oscillate between zero and 24. FIGURE 1: REGRESSION OF PRICE VERSUS TIME. This demonstrates
Because of the association of high volatility and falling a five-day regression of price versus time, with price shown in black. The
prices, we want high volatility to produce an estimate regression line is in green, the mean price is shown in red. When the slope
close to recent prices, and low volatility to move the of the regression line is positive, the most recent price will be above the
mean, while the most distant price will be below the mean.
adaptive average away from current prices. After
testing various candidates, including average true range,
standard deviation, and Kaufman’s efficiency ratio, the
best candidate was the standard error of the regression
line itself. High standard error indicated high volatility
and vice versa for low standard error. The standard error
was then normalized by assigning each value a percentile
rank, so that the highest in a 25-day period was given a
percentile of 1.0 and the lowest a percentile rank of 0.0.
The percentile rank of standard error was then multiplied
by 24, to produce an adjusted time variable for the
Microsoft Excel’s FORECAST function. This adjusted
time variable is a continuous number series that has a FIGURE 2: MOST RECENT VS. MOST DISTANT REGRESSION ESTI-
minimum of zero and a maximum of 24. MATES. This depicts the most recent and most distant estimates from a
The 25-day regression adaptive moving average 25-day regression line, moving through time. The most recent estimate in
green closely tracks the current price, while the most distant estimate in
(RAMA) is shown in Figure 3. Note that prior to the red tracks prices 25 periods prior. The purple line is the 25-day mean price.
market decline in March 2020, two sell signals were The red down arrow indicates when the slope converts from positive to
given. The 25-day RAMA generally gives an earlier negative. The green up arrow indicates the point at which the slope turns
signal than the 25-day mean on both the buy and the sell from negative to positive.
side. A buy signal was given at the end of March 2020
(the green up arrow) very close to the actual bottom and
before prices crossed the 25-day simple moving average.
The buy signal remains in effect until a sell signal in the
middle of June 2020.
RAMA is a volatility-adjusted regression estimate of
the closing price. When period volatility is high, RAMA

Approaching this problem


in a different way, I will use FIGURE 3: REGRESSION ADAPTIVE MOVING AVERAGE (RAMA). This
the statistical concept of displays a 25-day RAMA in red against the 25-day mean in purple during a
linear regression to develop period of high volatility and rapidly declining prices followed by low volatil-
ity and recovering prices. The price series is in black. When price moves
an adaptive moving average. above RAMA and RAMA is below the mean, a buy signal is given (green
arrow). When price moves below RAMA and RAMA is above the mean, a
sell signal is given (red arrows).
October 2021 • Technical Analysis of Stocks & Commodities • 25
closing prices of your security in order from earliest to
latest starting in cell A3. This leaves the two rows above
blank for headings. In the next column, place the closing
prices and in the next column, number the rows using
the Excel command ROW(). This command returns the
row number of where your cursor is located. So, if you
are in cell C3, then

Row number = ROW() – 3 = 0

Copy this command down to the last row and now you
FIGURE 4: REGRESSION ADAPTIVE MOVING AVERAGE (RAMA). have your third column completed. Set up a fourth column
Shown here are closing prices of $SPX during the last six months of 2020
with a 25-day simple moving average and 25-day RAMA. Compared to
and label it “average n=25”. Move your cursor down to
Figure 3, this represents a more stable period of rising prices. cell D28 and enter “=average(b4:b28)”. Copy it down
to the last entered price and you have a 25-day simple
closely tracks the current price and remains above the moving average of closing prices. Your fifth column
mean. When volatility is low, RAMA moves below the will calculate the volatility measure “standard error of
mean price and moves further away from the current regression line”. Move your cursor to cell E28:
price. This adaptive action reduces your risk during
periods of high volatility, while reducing your chance =STEYX(b4:b28,c$4:c$28)
of being stopped out during periods of rising prices and
low volatility. Figure 3 shows RAMA in action during and copy down to the last row. Note the dollar sign in
a period of high volatility and rapidly declining prices column C, which contains the row numbers in column
followed by low volatility and recovering prices. C, fixing the array to the first 25 cells.
Meanwhile, Figure 4 shows RAMA in action during a The STEYX function measures the average deviation
more stable period of rising prices in the last six months of your data points from the regression line itself. It
of 2020. A definite sell signal developed at the beginning is a measure of volatility and has a high correlation
of September 2020 as prices moved below RAMA while with other measures of volatility such as average true
RAMA was above the simple moving average. This was range and standard deviation. The standard error of the
followed by a buy signal a month later and another buy regression is calculated and interpreted in much the same
signal a month after that (green up arrows). manner as the standard deviation from the mean, only it
The action inside the orange circle is instructive. measures variance from the regression line rather than
Prices dipped below the 25-day moving average and from the mean.
then recovered. RAMA did not give a sell signal because In your sixth row, you will measure the ranking of the
RAMA was not above the moving average when prices standard error from lowest to highest. You need to rank
went below it. RAMA went briefly above the moving the first 25 values of STEYX, so move your cursor down
average and then quickly reversed direction to fall below to row 52 and enter:
the mean. Instead, RAMA gave a second buy signal and
avoided a whipsaw. Immediately after the orange circle, =PERCENTRANK.INC(e28:e52,e52)
RAMA rose above the moving average, but price stayed
above RAMA and the buy signal remained in effect. This function will rank each standard error in relation
Here are the nuts and bolts of calculating RAMA to the other 24 in the series. If it is the lowest, it returns
using Microsoft Excel. In one column, place the dates of 0, and if it is the highest, it returns 1.00. Anything in
between is ranked between 0 and 1.00. Copy PERCEN-
TRANK.INC down to your last row.
You are now ready to calculate RAMA. Open up a 7th
RAMA is a volatility-adjusted column, which will be row G, and enter:
regression estimate of the
closing price. =FORECAST(f52*24,b28:b52,c$4:c$28)

In row F, we have the ranking of the standard error


26 • October 2021 • Technical Analysis of Stocks & Commodities
values. So if we have the highest standard error, the rank
will be 1.00 and the value of f52*24 will be 24. This
is the first argument in the RAMA calculation. If the
volatility is mid-range at 0.5, the value of F52*24 will
be 12. This tells the FORECAST function to calculate
the predicted price for day 12. Remember that we have
set up the time series to run from 0 to 24, so day 12 is
actually the 13th day and represents the midpoint of the
regression line. Rankings near 1.00 will produce recent
day values, rankings near zero will produce values
from 25 days ago. The second and third arguments in
the FORECAST command set up the regression line of FIGURE 5: RAMA & FRAMA. Using the same price data as in Figure 4,
shown here is the 25-day RAMA plotted in green and the fractal adaptive
closing price for a 25-day timeframe. moving average (FRAMA) plotted in red.

Backtesting RAMA and FRAMA


One of the best-known adaptive strategies is John Ehlers’
filtered average. This average is based on the fractal di-
mension of stock prices, which is a number that ranges
from 1 for a straight line (because it is a one-dimensional
figure) to 2 for a two-dimensional figure such as a rect-
angle. For stock prices, the fractal dimension (FD) is
generally around 1.5, somewhere between a line and a
figure. The closer the FD is to 1, the less noise is pres-
ent in the data, and vice versa—for high noise, the FD
closer to 2.
If we plot the fractal adaptive moving average FIGURE 6: RAMA VS. FRAMA. The scatterplot compares the regression
(FRAMA), we can compare its action to RAMA (see adaptive moving average (RAMA) with the fractal adaptive moving aver-
Figure 5). As you can see, the two moving averages age (FRAMA) using 20 years of $SPX daily prices. You can see from the
function in a similar way, moving closer to current prices scatterplot that RAMA and FRAMA produce similar results even though
when data noise is high and moving further away when they are derived differently. The R-squared value of 0.9965 indicates a
near-perfect correlation.
volatility is low. RAMA seems to do a better job of moving
away from prices during periods of low volatility. It is
interesting that two different approaches obtain similar Mike B Siroky, MD is a retired surgeon living in Arizona.
results, validating the concept of adjusting moving He is particularly interested in quantitative analysis and
averages with various volatility measures. improving predictive value of technical indicators. He
This is evident from the scatterplot of RAMA versus is the author of The Art of High Probability Investing
FRAMA over 20 years of daily prices for $SPX (see published on Amazon.com. He may be reached at mike.
Figure 6). [email protected].

Summary Further reading


The regression adaptive moving average (RAMA) is a Ehlers, John F. [2005]. “Fractal Adaptive Moving Aver-
novel approach to the problem of incorporating changing ages,” Technical Analysis of Stocks & Commodities,
market volatility into a moving average. It uses the Volume 23: October.
concept of linear regression of price versus time and is [2018]. “The Deviation-Scaled Moving Average,”
relatively simple to compute in Microsoft Excel. Using Technical Analysis of Stocks & Commodities,
the standard error of the regression line as a volatility Volume 36: July.
measure, it produces a filtered moving average that gives Chande, Tushar S. [1992]. “Adapting Moving Averages
early sell signals when rising volatility signals a potential To Market Volatility,” Technical Analysis of Stocks
downturn, but allows rising prices with low volatility to & Commodities, Volume 10: March.
run without interference from early exits.

October 2021 • Technical Analysis of Stocks & Commodities • 27


Explore Your Options
GOT A QUESTION ABOUT OPTIONS?
Jay Kaeppel has over three decades of experience in the options markets. He
was a head trader for a CTA firm, an options trading software developer,
and was a portfolio manager for an investment management firm. He is
presently Senior Research Analyst for Sentimentrader.com. He is the author
of several books, including The Four Biggest Mistakes In Option Trading;
The Option Trader’s Guide To Probability, Volatility, And Timing; and
Seasonal Stock Market Trends. Send your questions or topic suggestions
to Jay Kaeppel at [email protected]. Selected questions will appear
in a future issue of S&C.
Jay Kaeppel

FAST-MOVING BREAKOUTS (strike price of $230 plus the cost The particulars of this trade appear
I would like to buy breakouts on of the option) for buying this long in Figure 2 and the risk curves in
fast-moving stocks. Unfortunately, call was $247.43, or 8.6% above the Figure 3.
many of the stocks I find are very stock’s current price. As a result, the With ZS trading at $227.90 a share,
expensive. Even to buy call options call buyer needs not just a breakout some things to note include:
is proving to be cost prohibitive. Is but a fairly substantial rally in order
there a more cost-effective way to to profit. • The cost to enter this trade—and
make this type of play? Let’s consider an alternative out-of- the maximum risk—is $1,126
There are a variety of spread op- the-money call calendar spread. • The downside breakeven price
portunities that can fill this bill. Let’s Our example trade involves the is $221.31
talk about one that most traders don’t following: • The upside breakeven price is
think of as a directional strategy. $264.07
Many options traders are familiar • Buy the ZS Nov19 240 call @ • These breakeven prices assume no
with a calendar spread. They buy a $18.38 change in implied volatility
call or put at a given strike price in • Sell the ZS Aug 20 240 call @ • The maximum profit potential
a further-out expiration month and $7.12 is $877 (which would only be
simultaneously sell an option at the achieved if ZS closed at exactly
same strike in a closer expiration $240 at the August option expi-
month. Many traders don’t realize
The profit potential for ration)
that this strategy can be used as a this trade increases
directional play simply by trading over time as a function In a nutshell, this trade is a bet on
out-of-the-money calls or puts. of time decay. ticker ZS trading between $221 and
Let’s consider an example using $264 a share through August expi-
Zscaler (ticker ZS, see Figure 1).
After a massive rally from March
2020 into February 2021, the stock
pulled back and then again rallied to
a point where it threatened to break
out to a new high in early July. At the
time, the stock was trading at $227.90
a share. So, to buy 100 shares would
cost $22,790.
At the same time, the September
230 strike price call option was trad-
ing at $17.43 per contract. The good
PROFITSOURCE

news was that the cost to buy one


call ($1,743) was only about 7.6%
FIGURE 1: ZSCALER (ZS). Following a massive rally from March 2020 to early February 2021, the
of the cost of buying 100 shares of stock pulled back and then rallied again to a point in early July where it could break out to a new
ZS. However, the breakeven price high. Is there an option strategy that can help you to buy breakouts on fast-moving stocks?
28 • October 2021 • Technical Analysis of Stocks & Commodities
Explore Your Options
ration. Within this price range, this
trade shows a profit. Above or below
these prices losses can accrue.
Other factors to consider:

OPTIONSANALYSIS.COM
• If you look closely at the risk
curves in Figure 3, you will note
that they “roll over” once the
price exceeds $240 a share. As FIGURE 2: TRADE BREAKDOWN. This shows the details of the example trade, which is an out-of-
the-money call calendar spread on Zscaler (ZS).
a result, when putting together a
plan to manage this trade, there
should be some provision regard-
ing adjusting or exiting the trade
if the price of ZS shares reaches
$240 a share.
• If this happens sooner (see where
the red and blue lines roll over in
Figure 3) rather than later (note the
green and black lines in Figure 3),
the profit will be small. The profit
potential for this trade increases
over time as a function of time
decay, that is, the short August op-
tions will lose their time premium
more quickly than the longer-term FIGURE 3: RISK CURVES FOR EXAMPLE TRADE. Note that the risk curves “roll over” once the
November options. share price for ZS exceeds $240 a share. For this trade, you would likely want to exit or adjust the
trade if ZS approaches $240 a share.

Focusing on risk
As part of a trading plan, let’s also if ZS approaches $240 a share. De-
consider a course of action if ZS fails
The catalyst for this pending on whether $240 is reached
to move to the upside as hoped and trade was the belief immediately or not until August
instead begins to break down. Here that the stock would expiration, the expected profit can
there are no hard and fast rules. At the break out to the upside. range from roughly $55 per 1-lot to
extreme, a trader could hold this trade $877 per 1-lot.
until all the options expire, knowing A closer examination of the risk
that the worst-case loss is the $1,126 curves in Figure 3 suggests that: Option position versus
paid to enter the trade. stock position
But let’s consider another plan of • Stopping out at $211 a share would For the sake of example, look at the
attack. Remember that: incur a loss of between -$261 and green line in Figure 3 (the expected
-$390—depending on whether P/L as of 8/5). If this trade is exited on
• The catalyst for this trade was the the trade is stopped out sooner 8/5, with ZS trading at $240 a share,
belief that the stock would break or later. the expected profit is roughly $300.
out to the upside • Stopping out at $200 a share would In this scenario, the option trade
• The nearest support levels for ZS incur a loss of between -$450 will earn 27% ($300 profit on a $1,126
are near $211 and $200 a share. and -$650—again, depending on investment) in 29 calendar days.
whether the trade is stopped out Had we plunked down the $22,790
A trader could adopt the mindset sooner or later. to buy 100 shares of ZS, the stock
that if one or the other of the recent would have to rally to roughly $289
support levels is hit, they can call it Finally, let’s consider profit po- a share for us to earn 27%.
a “failed breakout” and abandon the tential. As stated earlier, we would
position at that price. likely want to exit or adjust the trade
October 2021 • Technical Analysis of Stocks & Commodities • 29
INTERVIEW

Student Of History, Investing In The Present

A Conversation
With David Lundgren
David Lundgren, CMT, CFA, is a 30-year investment industry veteran
with a focus on technical analysis strategies, particularly momentum
and trend following. Most recently, he was a managing director, portfolio
manager, and director of technical research at Wellington Management.
He has held similar positions at Fidelity Management and Thomson
Financial as well. In addition, he has launched several research and
investment firms, including Lundgren Financial Services, Breakaway
Research, and hedge fund Lyceum Capital.
Lundgren is a Chartered Financial Analyst (CFA) and a member of
the CFA Institute. He is also a Chartered Market Technician (CMT) and
serves on the CMT Association’s board of directors. He is a frequent
guest speaker at conferences and seminars, including the IFTA and CFA
Institute. He graduated from Babson College in 1988 with a degree in
finance and investments.
He co-hosts the monthly podcast “Fill the Gap” for the CMT Associa-
tion, which he launched at the start of 2021.
Stocks & Commodities contributing writer Karl Montevirgen in-
terviewed David Lundgren in April 2021 to ask him for some of his In investing, there are two
insights from his decades of experience in research and investment, as
well as to explore some of the strong historical links between technical
things that you have to get
and fundamental analysis. right in your mind: What is
your philosophy, and what
is your process?
You have three decades we speak with veteran market ana-
of experience in mar- lysts, money managers, and CMTs
ket analysis, technical (holders of the Chartered Market In my case, my first job was in
analysis, fundamental Technician, or CMT, designation). Canada. I was a broker and I had
analysis, and portfolio We like to ask our guests about their the good fortune of sitting next
management. You are also some- investment philosophy, their process, to someone who really leaned on
what of a rare bird in that you hold and their decision-making tools. technical analysis to manage his ac-
both a CMT and CFA designation. There is often a common theme about counts. So I had a front-row seat to
The latter is extremely difficult for how they got into the technical side watch somebody very successfully
most people to attain. Can you tell of the business, and it’s usually a very employ these tools—tools that I had
us a little bit about yourself and how similar story to mine—we started out just spent four years in college learn-
you got started on this dual path? on the fundamental side and then we ing didn’t work. So his work really
When I think about how I got into saw this shiny thing off in the corner attracted my attention. Since then, I
technical analysis, I don’t think my that was like, “Wow. What is that? It have either been a technical analyst or
path is all that unique. And I’ll tell you seems to be right an awful lot. And the portfolio manager exclusively using
why I say that: I co-host a monthly fundamental side seems to be wrong technical tools to make my invest-
ALEKSOREL/SHUTTERSTOCK

podcast with Tyler Wood for the CMT an awful lot.” So, the technical side ment decisions.
Association that’s called “Fill The just attracted my attention, and that
Gap,” which we launched at the be- seems to be a common theme for our You recently gave a presentation
ginning of this year. On the podcast, podcast guests as well. to the Boston chapter of the CFA
30 • October 2021 • Technical Analysis of Stocks & Commodities
Society. Your talk was titled “How fundamentals will simply
Fundamentally Minded Investors overwhelm any short-term
Can Use Technical Analysis Today.” emotions that investors A core premise about
If you could take the reverse may feel regarding the how I think about
focus—how technically minded fundamentals and news. technical analysis is
traders can use fundamental A perfect example of
analysis today—what do you think that is Tesla. There was
rooted in Dow theory.
you would you say? a lot of emotional charge
A core premise about how I think and passionate discussion
about technical analysis is rooted about whether Tesla was the greatest worked with were on the floor of the
in Dow theory. One of the things thing since sliced bread or whether it Chicago Board of Trade. So it was
Charles Dow observed over 100 years was the greatest fraud on Earth. Yet very much an in-the-weeds, short-
ago is that there are essentially three despite the heat of those debates, the term mindset at that time. Because
timeframes of trend. And each of reality is, the fundamentals have just of that early indoctrination into the
those timeframes of trend is driven completely overwhelmed the discus- technicals vis-à-vis the futures con-
by different things. In other words, sion. You can see on a chart of Tesla tracts and things like that, I wasn’t
the shorter the timeframe of trend stock that it’s become one of the really prone to paying a lot of atten-
you use, the more reactionary and best-performing stocks of the past tion to the fundamentals, because
responsive the trend is to various 10 years. And that’s for one reason it really didn’t matter. As I said, in
news items. So there’s a lot more only, and that’s fundamentals. those short-term trends, it was more
volatility, and it’s a lot more emotion- I think it’s important for investors in about just gauging short-term trends
ally charged. the longer-term timeframes to make regardless of why they were doing
It’s not to say that fundamentals sure they’re aligning themselves with, what they did. You’re just trying to
don’t matter in that short-term time- at minimum, the message of the mar- capture those trends.
frame. It’s just that in that short-term ket. If the trend is up and you don’t As I was saying earlier, the further
timeframe, what drives price action like the fundamentals, at the very you step out in timeframe, the more
is the emotional response to the least, don’t short it because there’s a you should pay attention to the funda-
fundamentals and news. It’s all about good chance that you’re wrong. But mentals. So I’ve sort of morphed from
how much the actual fundamentals if you can find companies that you being a pure technician to somebody
differ from expectations in any given like fundamentally and that have a who really respects the fundamentals.
moment. proper trend structure with relative What I’ve come to learn is that you
And then as you step out to the outperformance, that’s really where should lean on the fundamentals to
intermediate-term and long-term you can make hay while the sun is tell you what to buy. And you should
timeframes, the actual fundamentals shining. lean on the technicals to tell you
matter considerably more. In those when to buy.
timeframes of trend—which is where Both schools of thought have The way you can use it is to say,
I try to focus my energy—you’re not only an extensive history, but okay, I’ve screened 5,000 candidates
really just trying to find companies also have very sophisticated and and here are the 300 companies that
with good fundamental underpin- nuanced levels of depth. It seems meet my fundamental criteria. They
nings. That’s because history shows like an investor has to understand meet my criteria for what I think are
that companies with rapid revenue when to use which approach. That great companies based on all the stud-
growth, expanding margins, and is, we have to know when to use ies and research I’ve done in terms
above-average earnings growth tend either toolbox and specifically of what drives good performance
to outperform the market. which tool to use. for an individual company. So say I
So fundamentals matter in all For most of my career, I have actu- have my 300 candidates. They are not
timeframes. It’s just that the shorter- ally been purely a technical investor. always trending. And when they’re
term timeframe is more driven by It probably has to do with the very not trending, it could be for various
the emotional response that investors early stages of my career when I was reasons. But I’m interested in find-
have. And in the longer timeframe, into daytrading and I was advising on ing those companies with the proper
the investing process is more inten- bond futures contracts and the euro- fundamental setup that are trending
tional. In the long term, the actual dollar contract. Most of the traders I now. What that means is the market
October 2021 • Technical Analysis of Stocks & Commodities • 31
year. Sometimes I listen to yet there’s nothing in those books
them on audio recordings that’s not as applicable to today as it
It’s important for when I’m out going for a was the day they were written—which
investors in the longer- walk or doing something tells you a lot about investing.
term timeframes to make else. These books serve There was also Nicolas Darvas’
sure they’re aligning to remind me of many book published in the 1950s, How
themselves with the important concepts. I Made $2,000,000 In The Stock
The first book is Remi- Market. It’s a fantastic book. There’s
message of the market.
niscences Of A Stock Op- nothing in that book written 70 years
erator by Edwin Lefèvre. ago that’s not as applicable today as
Just about everybody in it was then. There’s also the invest-
has done its fundamental work and this field knows that book. The book ing principles you can learn from
has determined that right now is the is a fictionalized story that is based on the history of the Turtle Traders. It’s
time to buy them. the trading career of Jesse Livermore. channel breakouts and the Donchian
And that’s the way I’ve evolved as It follows his journey from the age of channels. If you want to buy stocks
an investor—to really lean on both 15, when he made his first $1,000, to that will go from $20 to $100, well,
tools and not really time the tools, so becoming a Wall Street legend. The that stock can’t go to $100 unless it
to speak. Use the tools consistently, book contains timeless lessons about goes through $25 first. And no matter
and allow the technicals to help you shorting stocks, commodity futures what happens over the next 100 years,
determine when is the best time to trading, and stock manipulation. that premise will never change.
buy stocks. The second book is called The So by reading these classic books,
Stock Market Barometer, written by it helps to reinforce the basics. And
To me, the closer you get to signal William Peter Hamilton. That was that’s important. Try not to go too
from noise, the more strategic the the first effort to really codify Dow far off into the crazy esoteric ways
approach. Whereas technicals have theory, although he didn’t actually of looking at the market because it’s
always been more of a tactical tool. refer to it as “Dow theory.” not necessary.
Do you agree with that? And then, of course, there’s The With investing, it’s not like you
Yes, I’d say it’s strategy versus Dow Theory by Robert Rhea, pub- have to reinvent the wheel to be a suc-
tactics. The strategic part is: What lished by Barron’s in 1932. To write cessful investor. You just have to be
do I want to own? What strategically his book, Rhea carefully studied 252 practical. Learn from the past. Stand
makes sense? And then you have editorials of Charles H. Dow and on the shoulders of the greats. They
to execute that strategy vis-à-vis William Peter Hamilton in order to have already paved the road for you.
tactics, and that’s where technicals present Dow theory in terms that From them, you will learn what you
come in. would be useful for the individual need to do. From there, it’s more about
You want to use both because great investor. the mental side of it. To succeed, you
tactics can sometimes overwhelm the Those three books are, to me, es- need to develop mental control and
strategy. And a really great strategy sential reading. control over your behavioral biases
can sometimes fail when you have And so, back to your question. when you’re executing your tactics.
poorly executed tactics. My interest in reading and recom- If you want to execute your tactics
mending those books demonstrates properly and purely, you must stick
As you indicated, the evolution my belief of how important it is to to your process.
of technical analysis stands on understand not just the core premise
the shoulders of Dow theory. of Dow theory, but also, as you said, to It’s important to have a process that
How important is it for traders to get to know the more nuanced levels has been known to work, and you
become thoroughly acquainted with of the theory. For that reason alone, need to apply it consistently.
Charles H. Dow’s concepts? Are it’s worth reading these books. And In investing, there are two things
they foundational to most technical consider: All three of these books that you have to get right in your
approaches? were written over 100 years ago or mind: What is your philosophy, and
I will mention three books that I close to it. (I believe The Dow Theory what is your process?
try to reread every year. Sometimes was actually written in 1932—so not
I even reread them more than once a quite a century ago, but almost.) And In your speaking engagements,
32 • October 2021 • Technical Analysis of Stocks & Commodities
you’ve quoted Paul Samuelson— on the weather patterns
the Nobel Prize-winning economist and other forces at work.
who is considered by some histo- The “waves” represent the If you can find companies
rians to be the founder of modern intermediate-term trend. that you like fundamentally
economics—on the notion that the And he referred to the and that have a proper
market is a perpetually forming short-term trend as the trend structure with relative
equilibrium that’s not unlike the “ripples.” The ripples are outperformance, that’s
surface of the ocean. You’ve quoted like droplets of water flit-
Benjamin Graham, who wrote in his tering around on top of the
really where you can make
book The Intelligent Investor that waves. And so, you have hay while the sun is shining.
investing is like a voting machine these three magnitudes
in the short term and a weighing of trend all unfolding at
machine in the long term. And that the same time. Dow used the ocean see it as black & white—it’s either
echoes Charles Dow. Could you analogy to illustrate that point. fundamentals or technicals: One
explain what these references mean And Paul Samuelson, in his book side is right, the other is wrong.
and why you sometimes include 50 years later, said something very In your talks, you give a formula
them in your talks? similar. It’s the idea that the market to describe fundamentals times
My quest is to break down the walls is constantly unsettled but it’s always value. Then you add a behavior
that exist between the fundamental returning to equilibrium, not unlike component to the equation. Can
and technical communities. So when the ocean. It’s the same analogy that you tell us about that formula and
I include those quotes in my talks or Charles Dow leaned on to make the what it illustrates?
presentations, my point is that the phi- very same point. And Benjamin Gra- Yes; to me, this gets back to the idea
losophies that underpin the technical ham said something along the same of knocking down the walls between
and fundamental investment styles lines when he wrote that in the long fundamental and technical thinking.
are virtually identical. term, the market is like a weighing It’s just not helpful to think of it in
The reason I quoted Charles Dow machine, but in the short term, it’s those stark black & white terms.
and then quoted Paul Samuelson’s more like a voting machine. And Instead, it’s helpful to think about
comments—which were made some that analogy corresponds similarly. how to put these things together. Not
50 years later—is to point out that they Graham made that comment 50 only does it make perfect sense to put
were saying virtually the same thing. years after Charles Dow made his these things together, in reality, they
It shows the commonalities that exist comments. But they all allude to the are together.
in sound investing principles, and it same thing: that in the long-term, the So the formula I like to show is:
shows that the basic principles stand market is driven by fundamentals. So
the test of time. in the long term, the market is like a P = (F * V)
In my lead-up to make that point, weighing machine. In the short term,
I like to talk about how in the late it’s driven by emotions, so it’s like a This basically encompasses the
1800s, when Charles Dow was writ- voting machine. three styles of investing all in one
ing his editorials in the Wall Street The philosophical underpinnings formula: technical (or momentum)
Journal about how he felt the markets of both schools of thought are virtu- investing, fundamental (or growth)
worked technically, he discussed ally identical. Both schools of thought investing, and value investing. The P
trend and the three timeframes: the hold that a market is efficient over stands for price, which is momentum,
short term, the medium term, and time. It is inefficient in the short term and that’s technical investing. The F
the long term. He used the ocean but it’s efficient in the long term. The stands for fundamentals. You’re try-
as an analogy to describe the very fundamentals matter; in fact, they ing to estimate what the future of the
complex notion of how these three are paramount. Without good fun- fundamentals is going to look like;
timeframes trend in different direc- damental trends, there are no good that’s growth investing. And then you
tions all at once. He referred to the price trends. have value investing: the V variable
primary trend—that is, the long-term is the price-to-earnings ratio, the
trend—as the “tides.” And then on top You speak well to the importance of price-to-sales ratio, or whatever you
of the tides, you have the “waves,” both components working together. decide you want to assign to those
which are crashing around based Meanwhile, there are those who fundamentals.
October 2021 • Technical Analysis of Stocks & Commodities • 33
really need to pick a part whether as a growth manager or value
of this formula and stick manager, you are not even implicitly
I’m interested in finding with it. saying the market is wrong—you are
companies with the proper For personal investing, explicitly saying the market’s wrong.
fundamental setup that are it’s critical for your suc- You are basically of the mindset that
trending now. cess to do that. From a “I think my estimates are better, I
business perspective, if think the market’s overestimating/
you’re out there trying to underestimating growth. And I see
When you look at this formula, raise capital and assets as a money a gap there that I perceive based on
what you recognize is that these three manager, the last thing you would my personal opinion that the market
styles are joined at the hip. Nobody do is raise capital for a growth ap- has it wrong. So I’m going to invest
makes money unless everybody proach and then all of a sudden take in a way that closes that gap either
makes money. There is no right way a value approach. There are times by going long or short, depending on
to invest. It’s just a matter of determin- when growth isn’t working, like from the direction.”
ing who you are as an investor and 2000 to 2006, and it may cause you It’s a different mindset operating on
figuring out where and how you want to want to take a value approach. the right side of the formula. If you’re
to engage with this formula. But you can’t just change into a on the left side of the formula and
If you look back through history, value manager. Or, maybe nothing operating as a technician, you come
you will see there have been very seems to be working so you jump to work every day with the exact op-
successful investors who have used on the momentum bandwagon. But posite opinion: “I believe the market
just price, there have been a number in business, nobody’s going to give is right.” That’s a totally different way
of very successful growth inves- you capital to do that. You have to to think about the world. And that’s
tors, and there have been a number pick the spot in the formula where why you can’t jump back and forth
of very successful value investors. you’re going to be. in this formula—you would be like
So clearly, it’s not about one style So there are a lot of reasons to be Dr. Jekyll and Mr. Hyde.
being better than the other. They mindful of where you’re going to Moreover, there is a degree of com-
all can work. Rather, it’s often the engage in this formula, and then stick plexity on both sides of the formula.
investor who gets in the way of the with it. That’s the whole point. It’s just On the right side of the formula, the
strategy working. This gets back to to demonstrate that there really isn’t a F opens a whole “Pandora’s box” of
behavioral biases and the emotional right way to do it. It’s just a question questions that you now have to answer
baggage that we bring to the whole of how you engage with the market on each stock under consideration. It’s
investment process. to ensure long-term success. a myriad of very complex questions
that need to be addressed with respect
Yes, investors and traders don’t If the different approaches are to the fundamental growth and how
often acknowledge that we ourselves joined at the hip so to speak, and you’re measuring it, how far out
are sometimes the biggest risk factor come down to the same thing, why you’re looking, what the competition
we face. does it matter which approach you looks like, and all these other things
I think problems come from inves- operate in? that need answers. And then, the V
tors engaging with this formula at the It’s important for you to figure out is just as complex. How do I value
wrong spot. The reason that happens who you are as an investor before this company? Am I looking out on
is because investing is very difficult. you engage. The two different sides estimates one year, 10 years? Am I
And nothing works every single time of the formula are very different. So comparing that current valuation to
or even every year. In theory, all three although they’re linked, each one the history of the company, or am I
investing styles can experience mean- requires a different skill set. comparing it to interest rates or to
ingful drawdowns. It’s those periods If you come to work every day the price of oil? How am I actually
of pain that force investors to jump to operating on the right side of that thinking about valuation?
another part of the formula that they formula, then every day you are mak- Both of those concepts—the funda-
don’t belong in. They don’t belong in ing the base case assumption that the mental and the valuation—are very
it because they’re simply not good market is wrong. Your estimate for involved questions to answer for each
at it. From a long-term performance growth, PE ratio, valuation estimates, company. And you have maybe 20 or
perspective, that’s a nightmare. You whatever it is that you’re looking at, 30 stocks that you follow and have
34 • October 2021 • Technical Analysis of Stocks & Commodities
to answer those same questions for. the target is either never
And then there are other things that achieved, or the trend just
you don’t know but the market knows steamrolls over the target, The market is inefficient in
about. So that’s the right side of the going on to achieve much the short term but efficient
formula, F & V. higher or lower levels than in the long term.
Meanwhile, the left side of the forecast.
formula is price. And it’s always I say all of this in
price. It’s that simple. You use the advance of answering your actual know it wasn’t obvious at all. Yet, the
power of price to help you navigate question only to provide context to market changed direction and hasn’t
the complex world that exists on the my feelings about forecasts gener- looked back since.
right side of the formula. ally. Forecasts are always available,
It’s an incredibly powerful solution but they are rarely meaningful. If we consider daytraders, swing
to bring these two things together. Whether generated using technical traders, and position traders, what
Use the right side of the formula to or fundamental techniques, all fore- level of engagement with the funda-
help you determine what to do. Use casts require one thing and one thing mentals would best benefit each?
the left side of the formula to help only to make them valid: price has Going back to what Charles Dow
you determine when to do it. to move to that forecasted target. In said over 100 years ago, the shorter
other words, all that ever really mat- your timeframe, the less fundamen-
You have commented in your talks ters is trend. If so, then why bother tals matter, particularly long-term
that technicians agree on the im- forecasting? Why not just follow the fundamentals. So to the extent that
portance of fundamentals, it’s just trend until it ends? fundamentals matter to short-term
that they have “hired” the market to So back to your question: As a traders, it would likely be in response
conduct the fundamental analysis trend follower, I am willing to engage to earnings beats and misses, earn-
for them. But can technical analy- with changes in long-term trends ings forecast changes, and perhaps
sis have the same forward-looking on the assumption that the market, analyst upgrades and downgrades.
focus that fundamental analysis in its infinite wisdom, has detected For longer-term trends, however,
does? After all, price itself is not meaningful shifts in the fundamental what really matters are things like
predictive, but fundamentals are. drivers of macro trends. In that mo- top-line growth, EPS growth, margin
Can technical analysis be predic- ment, it is not necessary for me to expansion, new product announce-
tive? How does technical analysis understand what those macro shifts ments, management changes, shifts
take into consideration economic are, let alone provide a forecast for in the competitive landscape, federal
and geopolitical undercurrents that how long they will last. It is my job regulations, and so on.
come into play in the market? to simply acknowledge they have Of course, every major trend
In the technical community, there changed, and to change with them. change starts with a reversal in the
are two schools of thought. One What I find most compelling about short-term intraday timeframe. But
says that technicals can be used to this approach is how long-term funda- by and large, it pays for position
forecast future market trends, while mentally driven trends tend to change traders to ignore that noise until it
the other says that it is enough to direction when current macro data is begins to alter the longer-term trend,
simply acknowledge when trends least supportive of that change. The as that would be confirmation that Mr.
have changed, and that one should bull market that followed the recent Market was growing more concerned
simply trade in the direction of that selloff in March 2020 is a perfect or optimistic about the company’s
new trend until it changes again, with- example of this. The macro data was longer-term prospects.
out forecasting how long it will last. I as bad as it had ever been in history,
am personally in the latter camp, not and forecasts for further collapse You mentioned some technically
because I don’t believe technicals can were everywhere. Yet, despite all oriented books that you recommend
provide a forecast—they surely can, the doom and gloom forecasts, the reading. Can you similarly sug-
by way of using price patterns, targets, market stabilized and turned higher gest some fundamentally oriented
retracements, projections, and tools as it sniffed out what turned out to be books, especially if you have sug-
of that nature. The issue is that those a record response from global central gestions for the technically minded
targets only matter if they are attained banks. We talk about it today as if it investor?
precisely. What is more typical is that was obvious back then, but clearly, we I’m not sure I can say there are
October 2021 • Technical Analysis of Stocks & Commodities • 35
overall market vis-à-vis the main tenets of that damaging
several macro economic school of thought. In Value Invest-
The fundamentals matter; indicators. He goes into ing, Montier takes it to a whole other
in fact, they are paramount. stock-specific factors as level as he absolutely eviscerates
Without good fundamental well, but not as in-depth the notion that markets are efficient,
trends, there are no good as O’Neil does. highlighting the momentum factor
Beyond that, a few among many other things as proof
price trends.
other books that I found that markets are indeed not efficient,
very helpful in develop- particularly in shorter timeframes. As
ing my personal invest- a trend follower, I found this book to
any fundamentally oriented books ing philosophy include 100 Baggers: be almost empowering.
that technical traders absolutely must Stocks That Return 100-To-1 And
read. The only thing technical trad- How To Find Them by Christopher David, thank you for speaking with
ers must absolutely, positively read W. Mayer; Quality Investing by us. You have shared insights that are
is the message of the market itself. Lawrence Cunningham, et al; and unique to your perspective and that
Everything else, technical books Value Investing by James Montier. will definitely make us think.
included, is just an aid to help with Like O’Neil, Mayer’s also goes into
things like general knowledge, risk great detail about the fundamental Karl Montevirgen is a financial
management, psychology, inspira- traits that have underpinned some content writer. His LinkedIn pro-
tion and motivation, and the like. In of history’s best-performing stocks. file can be found at https://www.
that light, to the extent that a funda- I have a lot of issues with the author’s linkedin.com/in/karl-montevirgen-
mentally oriented book might help heavy use of “hindsight bias,” as 4a66b517.
a technical investor hone his or her many of these great stocks have fallen
craft, it would be to help understand upwards of 90% several times on their Further reading
what fundamental drivers ultimately way to 100-bagger status, making it Lefèvre, Edwin [1923]. Reminiscenc-
cause prices to trend. That way, a hard to believe that us mere mortals es Of A Stock Operator, Doubleday
technical trader might try to make it a would not have lost our faith in the and Company.
practice to favor those securities that company. That said, as risk-aware Hamilton, William Peter [1922]. The
have those qualities, but only when trend followers, we can avoid those Stock Market Barometer, Harper
they are trending and outperforming pitfalls while at the same time have and Brothers.
the market, of course. an appreciation for what to be on the Rhea, Robert [1932]. The Dow
In that regard, although it was on lookout for on the hunt for the next Theory, Barron’s.
my list of books for those looking 100 bagger. Darvas, Nicolas [1960]. How I
to learn about technicals, I have to In Quality Investing, once again, Made $2,000,000 In The Stock
double down on my recommendation we get a heavy dose of what really Market.
of How To Make Money In Stocks, matters to long-term stock perfor- Graham, Benjamin [1949]. The Intel-
which is William O’Neil’s excellent mance, as Cunningham provides ligent Investor.
book that discusses in great detail real-time examples of holdings that O’Neil, William [1988]. How To
the fundamental factors that drive meet his definition of quality. Again, Make Money In Stocks, McGraw-
big winners in the stock market, and as trend followers, not all of these Hill.
details the technical strategies to charts cut it, particularly from a Zweig, Martin [1994]. Winning On
capture those trends. As to the idea relative perspective, but if the idea is Wall Street, Warner Books, Inc.
that fundamentals tell us what to buy to align our trend-following efforts Mayer, Christopher W. [2015]. 100
and technicals tell us when, O’Neil’s with companies that possess the Baggers: Stocks That Return
book captures that idea as well as any fundamental traits that historically 100-To-1 And How To Find Them,
book I could recommend. result in big winners, a technical Agora Financial.
A similar book, but with a slightly investor will surely learn a lot read- Cunningham, Lawrence, Torkell
more macro perspective, is Martin ing this book. T. Eide, and Patrick Hargreaves
Zweig’s Winning On Wall Street. In Finally, as a foot soldier in the war
that book, Zweig presents several against the efficient market hypoth-
tools for gauging the health of the esis, I have done my best to dismantle Continued on page 56
36 • October 2021 • Technical Analysis of Stocks & Commodities
Algo Q&A
ALGORITHMIC TRADING
Have a question about system or algo trading? Kevin J. Davey has over
30 years of system trading experience. Kevin is a full time trader, and also
teaches and consults via his Strategy Factory® online workshop (https://
kjtradingsystems.com). He is the author of 5 bestselling trading books, in-
cluding “Building Winning Algorithmic Trading Systems” and his latest
book “Algo Trading Cheat Codes.” Send your questions or topic suggestions
to Kevin Davey at [email protected]. Selected questions will
appear in a future issue of S&C.
Kevin J. Davey

SHOULD SIZE MATTER? trades early or ignore exit signals are trading 10 contracts, you just do
I am generally happy with my trading, completely. not know. If you don’t know the size
but I find that once I increase size, In short, when the money involved involved, you’ll be better grounded
my performance degrades. Do you gets large because of size, it can im- in your trading. You can’t be rattled
have any tips for me? pact every trader. How can a trader by the trade size if you do not know
I’ll make the assumption that you overcome this size issue? Here are a what it is.
are trading a liquid market with a few ideas:
good amount of volume. Most futures “Stop counting the dollars”—Stop
markets fall into this category. But if “Don’t boil the frog”—Toss a frog in counting trades in dollar terms, since
you are trading, say, low-volume milk a pot of boiling water, and he will im- that directly scales with the number
or lumber futures with any size, then mediately jump out. But put the frog of contracts. Instead, use percent-
your performance may be degrading age returns. That way, trading one
due to your size actually moving the contract with $3,000 will be the
market. If you don’t know the same percentage-wise as trading 10
For most traders though, the size involved, you’ll contracts with $30,000. By looking at
market is not the issue. Rather, it is be better grounded in the percentages, you could feel more
the trader’s own psychology that is your trading. comfortable trading the strategy.
degrading their performance. This
can be true for automated algo trades “Gamble till it doesn’t hurt”—
and discretionary traders. It really all in a room temperature pot of water Desensitize yourself to money. Hit
comes down to money. and slowly raise the heat, he will toler- the local casino, and play the slots,
Money impacts people in different ate it until he boils to death (so I’ve video poker, or a table game. Start
ways. I always hear one popular trad- heard, I have never tried it, and I don’t with 25-cent machines. At first it will
ing “guru” say, “Once you trade one recommend you try it either!). For be exciting, but eventually it will get
contract, it is easy to scale up and trade trading, keep the account small, and boring. Then jump up to 50 cents,
50 or 100 contracts.” I don’t think he make withdrawals as profits dictate. and play until that gets boring. Keep
trades, honestly, because that is total And maybe over time, retain some doing this for a few hours. Then go
BS. Scaling from one contract to 100 profits in the account to build your back and do it again. Eventually, you
in the ES, for example, means that size up slowly. Maybe in a year you will be immune to the dollar amount
each tick up or down rockets from double your size, rather than doubling you are gambling.
$12.50 to $1,250. That is not an easy every few weeks. Take profits along
transition for a trader to stomach! the way. Just go slow and increase Ramping up size can be a daunting
You might think this is just an issue only as you feel comfortable. experience. For many, it is psycho-
for discretionary traders, since they logical or emotional torture, since
have to click the “buy 100 contracts” “Mr. Monkey—see no evil”—If you everything gets measured in dollars.
button. But algo traders can be just have a trading partner, have him or With my suggestions, though, you
as freaked out by the large dollar her mirror your trades or execute the should be able to find ways to handle
amounts. This could lead them trades for you, without revealing the increased trade size.
to temporarily turn off strategies, size they are trading. Maybe they
override their algos to exit profitable are not trading at all, maybe they
October 2021 • Technical Analysis of Stocks & Commodities • 37
TRADING ON MOMENTUM

Looking For Repeating Patterns

Swing Trading 50SMA Pivots


One of the more valuable strategies Consistent pivots in an rectly identified pivots all six times
you can use as a technical trader uptrend that this occurred during the last six
is to look for patterns that repeat When looking at patterns that repeat months. Armed with this knowledge,
consistently over time. themselves, one of the first things for example, you would know not to
you can do as an active trader is to short the market if it merely drops
by Ken Calhoun develop a trading plan designed to to the 50 SMA because you saw the

In
profit from technical entry signals. pivots occur every single time this
this month’s column, For example, in Figure 1 (SPY), you pattern was observed in the past.
we’ll look at how can see that the 50 SMA line cor- Similarly, you can use these pivots
consistently the S&P as entry signals for new trades.
has pivoted off of the
50 simple moving The value comes from Step-by step action plan
average (SMA) line during the last seeing whether or not Here’s how you can start using this
six months. These signals can be strategy:
used as part of your trading plan, to
there is a consistent,
help you make effective trade deci- repeatable pattern Step 1: Look for uptrending charts
sions when you see similar patterns that can help you similar to those seen in Figure 1 and
in the charts of instruments that you make winning trades. be sure to plot the 50 SMA line.
are trading.

eSIGNAL

FIGURE 1: 50 SMA PIVOT SIGNALS THE SPY PIVOTED EVERY SINGLE TIME IT TOUCHED THE 50 SMA.
38 • October 2021 • Technical Analysis of Stocks & Commodities
TRADING ON MOMENTUM

Step 2: If it looks similar to this from seeing whether or not there is


pattern, you can use this knowledge a consistent, repeatable pattern that Moving averages
to identify entry signals for your can help you make winning trades. are simply derived
next upcoming trade. This particular pattern has held for from the data set
six months, a very long time. You can
Step 3: The good thing about this use a similar approach with much
produced by each
approach is that you will know shorter time durations, including day’s price action.
relatively quickly whether or not it daytrading. Developing consistency
is successful, based on whether or in your trades is a function of your
not it pivots as it has in the past. risk management, entries and exits, use this sequence of signals to help
and the use of technical patterns that you enter your positions as the trend
Step 4: You can also use these generate consistent entry signals. continues.
technical entry signals to scale into
your winning position every time Trade management tips Ken Calhoun moderates a popular
this pattern repeats itself during Look to see that the pattern repeats live trading room for active traders.
the uptrend. itself a minimum of twice prior to He is the founder of TradeMastery.
using it for your trades. In Figure com, an interactive webinar site
Insights: Why this 1, for example, we would have used for active traders, and is a UCLA
technique works this signal starting in May 2021, the alumnus.
Moving averages are simply derived third occurrence of the 50 SMA pivot
from the data set produced by each signal. As usual, it is often wise to
day’s price action. The value comes scale into a successful trade. You can

Get the exact information you want online at Store.Traders.com at the


StockS & commoditieS Online Store

• PDF versions of past articles


• Convenient credit-card transaction
• File available for download as soon as
transaction approved
• Prices start as low as $2.95
• Full line of S&C products
• Easy to start or renew your subscription

MAgAzines ARticles Books

suBscRiBe Renew Hot DeAls

s&c weAR softwARe sHop now!

https://store.traders.com
October 2021 • Technical Analysis of Stocks & Commodities • 39
A Trend-Following Approach

The Directional Cross Strategy


Here we introduce a simple chart-based strategy you How to use the directional cross
can consider. strategy
The combination of the indicators used in this strategy
by Azeez Mustapha provides buy alerts and sell alerts. For a buy alert, the

T
lower line of the envelope (blue) on the chart would cross
he directional cross strategy capitalizes on the lower band of the Bollinger Bands upwards. The cross
trend change. It seeks to give signals about happens just after the simple moving average (red) that is
potential new directional moves in the market. between the envelope lines crosses the Bollinger Bands
The strategy makes use of three tools: a simple below (see Figure 1).
moving average (SMA), price envelopes, and For a sell alert, the upper line of the envelope (blue)
Bollinger Bands. The combination of the three on the chart would cross the upper band of the Bollinger
tools produces the strategy’s signals. Bands downwards. The cross happens just after the simple
This strategy works in trending markets. A trending moving average (red) that is between the envelope lines
market is one that is ascending with higher highs and crosses the Bollinger Bands downwards (see Figure 2).
higher lows or descending with lower highs and lower
lows. To trade profitably in forex, you will want to be • Buy alert (Figure 1): The lower line of the envelope
able to ride the trend to acquire pips as the market moves should cross the lower band of the Bollinger Bands
in the direction of the trade entry. upwards. The cross occurs just after the SMA crosses
Profitable trading involves correctly determining where the Bollinger Bands below.
the market is disposed to go before it moves, and you • Sell alert (Figure 2): The upper line of the envelope
VLADUM/SHUTTERSTOCK

want to stay with the direction the market is heading. should cross the upper band of the Bollinger Bands
Trend-following tools can help. downwards. The cross happens just after the SMA
crosses the Bollinger Bands downwards.
40 • October 2021 • Technical Analysis of Stocks & Commodities
FOREX TRADING

For the entry and exit,


patience is required for this
strategy. The tools used on
the chart must form perfect
setups of crosses before a
trade is activated, either
for entering short or long.
Impatience would prompt
the trader to enter when the
setup is not fully formed. This
would lead to other impulsive

TRADINGVIEW
and rash decisions by the
trader. That could eventually
FIGURE 1: BUY ALERT EXAMPLE. For a buy alert, the lower line of the envelope (blue) on the chart should
affect the trader’s psychology cross the lower band of the Bollinger Bands upwards. The cross happens just after the simple moving average
negatively, which would (red) that is between the envelope lines crosses the Bollinger Bands below.
lead to unhealthy trading.
This is why it’s important to
approach the market with a
consistent methodology to
navigate any asset’s natural
gyrations.
Note that ranging markets
aren’t a good fit for this
strategy. It is therefore
advisable for the trader to
stay out of the market when
consolidation is noticed. For
this strategy, a ranging market
would produce multiple FIGURE 2: SELL ALERT EXAMPLE. For a sell alert, the upper line of the envelope (blue) on the chart should
buys and sell signals within cross the upper band of the Bollinger Bands downwards. The cross happens just after the simple moving
a short period of trading. average (red) that is between the envelope lines crosses the Bollinger Bands downwards.
Each quick change in market
direction would not give a
trade enough of a chance to
run in one direction. Such
quick turnarounds would
eventually lead to loss. (See
Figure 3.)

Proper risk manage-


ment in trading
Healthy trading involves
proper risk management. The
trader shouldn’t risk more
than 2% of his account per FIGURE 3: RANGING MARKET EXAMPLE. Ranging markets aren’t a good fit for this strategy since it’s a trend-
trade. This is very important following strategy. Notice the consolidation area in this chart. With this strategy, a ranging market would produce
for the trader’s confidence. too many buys and sell signals within a short period of time, producing whipsaw and leading to losses.
Huge losses can be very
stressful psychologically for the trader. It may cause trading. The amount of pips between the entry and the
the trader to lose trust in himself and his strategy. It is stop-loss combined with the lot size are used to determine
also important to note that there will always be losses in the percentage of capital being risked.
October 2021 • Technical Analysis of Stocks & Commodities • 41
Setting the stop-loss can use your trading platform’s controls to set up the
The stop-loss helps the trader’s equity to be secured dur- envelopes.
ing a losing trade. The capital drain during losing trades For example, if you use TradingView, under the settings
can be limited with use of a planned stop-loss. for the envelope indicator, change the length to 12, and
To set a stop-loss for a long trade using the strategy, set the percent to 1. Uncheck “exponential” as it is not
locate the previous area of support or the immediate low being used here. For the style, the color can be changed
on the chart. The stop-loss should be placed slightly under to fit your preference.
the old low or below the previous support. If you work in MetaTrader, the settings are also very
To set the stop-loss for a short trade using the strategy, easy to adjust for setting up the envelopes. For the
the trader should locate the previous area of resistance parameters, set the period to 12. Set the shift to zero, set
or immediate highs on the chart. The stop-loss should the deviation to 0.100, and set the method to “simple.”
be placed slightly above the old high or previous Finally, apply the settings to the “close.”
resistance. For the style of the envelope, the colors are set to the
This strategy seeks long-term profitability. It offers trader’s preference. The colors must be set to distinguish
room for greater reward compared to risk. The trader them from other indicators on the chart. You want the
can make multiple trades of 1:2 or 1:3. pixels onscreen for both the upper band and the lower
Exit the trade when the moving average appears to cross band to be clearly seen and distinguished to make the
the Bollinger Band in the opposite direction. At the point work easier. The pixels determine the thickness of the
of crossing, the trader can prepare to open a new trade in band lines displayed on the chart.
another direction while securing the first profit.
Setting the stop-loss helps the trader to trade without Bollinger Bands setup
worries of margin calls. This can also save the trader the Bollinger Bands are easily set up on your trading plat-
stress of looking at the chart too many times. form. For the style, you want to select a color you are
The trader should learn to take partials at breakeven comfortable with and can see well. Whatever color you
when trade is running in the right direction. This helps choose, the color should be different from the other in-
to preserve capital. dicators on the chart so you can easily recognize each
indicator. Also, the number of pixels used to display the
Setting up the indicators for the lines should be adjusted to control line thickness so that
strategy the lines are clearly visible—you don’t want the lines to
On the chart, two waves of three lines are formed. This be too faint.
consists of a total of six lines seen on the chart. In MetaTrader, for Bollinger Bands, set the period to
The envelope has two lines (represented by the 20, set the deviation to 1.0, and set the shift to 10. Choose
blue color on the chart in my examples). One of the to apply to the closing price. For line thickness, it is okay
lines is slightly higher than the other but they move in to use the third level of thickness for the pixel settings.
accordance. In TradingView, under the input settings, set the length
Since this is a strategy that uses visual chart inspection, to 20 for Bollinger Bands. The source should be “close,”
you want to set up the indicators on your chart with the standard deviation (SD) should be set as 1, and the
clear and easily distinguishable lines so you can read offset should be set to 10.
the chart easily. This helps you to be able to study the
price moves more efficiently and will assist you with Simple moving average setup
alerts for buys and sells. The last indicator used for the strategy is the simple
moving average.
Envelope setup In MetaTrader, set the period to 12, set the shift to
First, you set up the price envelopes indicator. You zero. The method for the SMA is set to “simple.” Set it
all to apply to closing prices. For the style, use a color of
your preference. For the number of pixels, again, make
the thickness of the SMA line large enough to be able
The directional cross strategy to easily see it on the chart.
capitalizes on trend change. The indicator timeframe should be the same as what

Continued on page 56
42 • October 2021 • Technical Analysis of Stocks & Commodities
JOHN EHLERS MESA WORKSHOP, nologies are written as functions to wave and large market trends.
OCT. 18–22, 2021 simplify coding. In addition, Ehlers There is no cost for CMT members;
John Ehlers will hold his MESA will disclose MESA. $100 for nonmembers.
workshop on October 18–22, 2021 Code will be distributed prior to the cmtassociation.org
(Monday–Friday). It will be held workshop so that users will be able to
virtually as a live event over Webex. ask questions at the workshop. SLOPEALERTS FOR REAL-TIME
The workshop will run four hours a The workshop cost is $4,000. Trad- NOTIFICATION
day after market close, with open ers can view the full list of topics to The technical analysis website Slope
discussion on Friday. be covered and download a syllabus, Of Hope (slopeofhope.com) has
The workshop will teach algorith- as well as enroll in the workshop, at released its latest version of Slope-
mic trading techniques and how to the MESA Software website. Alerts, which allows a trader to be
apply digital signal processing and www.mesasoftware.com notified of specific events in the equity
a scientific approach to your trading, or cryptocurrency markets via email,
based on Ehlers’ decades of experi- 2021 ASIA PACIFIC SUMMIT, SMS text message, or the Telegram
ence and research. In the workshop, OCT. 2–3 (VIRTUAL) messaging system.
Ehlers, who is the author of Rocket The 2021 Asia Pacific Summit, To set up an alert, the trader sup-
Science For Traders, will provide all presented by CMT Association, plies the symbol to follow, the condi-
the indicators and trading strategies will take place virtually on October tion that constitutes an alert, and the
he has developed, including a very 2–3, 2021 (Saturday–Sunday). The trader’s choice of notification style.
fast WFO (walk-forward optimizer) conference will bring together prac- A variety of price information can
in EasyLanguage, and new strate- titioners to share their perspectives be monitored, including % change,
gies that demonstrate robust out-of- on today’s investment ecosystem. latest price, net change, day’s high,
sample performance. Over the two-day summit, partici- day’s low, 52-week high, and 52-
pants can tune into 12 sessions. Ses- week low. Any of these fields could
sions will be hosted by CMT vol- be compared to a variety of technical
unteers from Eastern counties and indicators, absolute numeric values,
regions including Australia, Japan, or other criteria.
ASEAN, Hong Kong and Greater Moreover, the user can take ad-
China, India, and the Middle East. vantage of chart-based alerts, which
lets the trader point at a given object
on a chart (such as a trendline) and
stipulate that an event related to
that drawn object (such as the price
Topics will include cycle theory, crossing above it or below it) should
effective data smoothing and filtering constitute an alert. This makes it
techniques, spectrum estimators, data convenient for visually oriented
correlation, correct position sizing, traders to lay out the rules for their
and predictions. notifications.
New this year are: MESA Predict; This year’s theme is “Finding Or-
an expanded discussion of FIR win- der In Chaos,” reflecting the second
dowing (see Ehlers’ article in the year of the pandemic as the world
September 2021 issue of S&C titled continues to seek some order amidst
“Windowing”); the critical nature of the chaos. Factors in today’s invest-
filter phase response; the FM nature ment ecosystem include cryptocur-
of market data (see Ehlers’ article rencies, central bank policy, inflation,
in the May 2021 issue of S&C); an and economic recovery. In various
FIR filter bridging cycle mode and sessions, Ayush Nagaraj will speak
trend mode; a universal indicator for about how his process is evolving
algorithmic trading; and a simple for systematic trading; Scott Carney slopeofhope.com
recipe for you to build your own will speak on harmonics; and Mark
robust strategies. The core tech- Galasiewski will speak on Elliott
October 2021 • Technical Analysis of Stocks & Commodities • 43
The Death Cross And The Golden Cross

Can Crosses Help Our Trade?


The death cross and golden cross are technical patterns cross was the only signal used to take a trade, then it is
that are often used to signal stock selloffs or rallies. questionable if the trade would have succeeded. Once
again, this depends on how long the trade was held. As

T
by Stella Osoba, CMT the chart shows, the sideways movement, which contin-
ued until early 2020, resolved in a sharp downtrend. The
he death cross selloff eventually happened but not until well after the
When the 50-day moving average moves below signal happened.
the 200-day moving average, the technical pat- After forming a W bottom (see Figure 1), EBAY started
tern is often termed a death cross. The faster a massive trend reversal.
average moving below the slower average is
often a sign of an impending selloff. The golden cross
Figure 1 is a daily chart of eBay, Inc. (EBAY). You A golden cross is formed when the faster moving average
can see the death cross marked on the chart when the (blue line) moves above the slower moving average (green
shorter-term moving average (faster line/blue line) slips line). The signal is indicated on the chart in Figure 1. The
PESHKOVA/SHUTTERSTOCK

below the slow line (green line). Since moving averages moving averages are lagging indicators, so the signal did
are lagging indicators, we can see that the downtrend not coincide with the reversal. The averages did not cross
had already been in effect well before the death cross until the uptrend was well underway, nearer to about
signal, also after a large gap down in price. If the death halfway up its current move. However, using the golden
44 • October 2021 • Technical Analysis of Stocks & Commodities
TECHNICAL ANALYSIS

cross as a signal would


have resulted in a suc-
cessful trade because
of the steepness of the
uptrend.
Once again, this
shows that technical
signals are not me-
chanical; they were
not meant to be since
market psychology,
which they depict,
is not mechanical.
Sometimes, technical
signals can result in
successful trades and
sometimes not. People
often disparage tech-
nical analysis because
they say signals do
not work, but it is im-
portant to remember
that signals and chart
patterns are the map
and not the territory.
The market does not
know what it should
do. Our job is to let it
tell us what it will do,
using technical signals
as a guide to lead us in
the right direction.
In this case, if you
had decided to use

STOCKCHARTS.COM
the crosses as signals
for trades, then the
correct method would
have been to take both FIGURE 1: DAILY CHART FOR EBAY
trades depending on
the signals. With the first trade, the short trade, you ‡StockCharts.com
would have likely lost money unless you held on into ‡See Editorial Resource Index
the March decline. The second trade, which is the long
trade, would have been more successful if you could have
held on during the reactions and let the trade run until
a signal told you the uptrend was over. It is important to remember
that signals and chart
Stella Osoba is a trader and financial writer. She is a patterns are the map and
frequent contributor to Technical Analysis of Stocks not the territory.
& Commodities magazine and Traders.com Advantage
as well as other financial publications.

October 2021 • Technical Analysis of Stocks & Commodities • 45


The focus of Traders’ Tips this month is At Traders.com you can also right-
John Ehlers’ article in this issue, “Cycle/ click on any chart to open it in a new tab
Trend Analytics And The MAD Indicator.” or window and view the chart at a much
Here, we present the October 2021 Trad- larger size.
ers’ Tips code with possible implementa- The Traders’ Tips section is provided to
tions in various software. help readers implement a selected technique
The code for the following Traders’ Tips from an article in this issue or another re-
selections is posted here: cent issue. The entries here are contributed
by software developers or programmers for
• Traders.com → S&C Magazine → software that is capable of customization.
Traders’ Tips
New contributor this month: TradingView

rgb(255, 306 - 10.2 * 18, 0, 0), 2)


plot(trendPrice - sma(trendPrice, 19), "Osc19", color.rgb(255, 306
- 10.2 * 19, 0, 0), 2)
F TRADINGVIEW: OCTOBER 2021 TRADERS’ TIPS CODE plot(trendPrice - sma(trendPrice, 20), "Osc20", color.rgb(255, 306
The TradingView Pine code for the cycle/trend analytics indica- - 10.2 * 20, 0, 0), 2)
tor presented by John Ehlers in his article in this issue, “Cycle/ plot(trendPrice - sma(trendPrice, 21), "Osc21", color.rgb(255, 306
- 10.2 * 21, 0, 0), 2)
Trend Analytics And The MAD Indicator,” is as follows: plot(trendPrice - sma(trendPrice, 22), "Osc22", color.rgb(255, 306
- 10.2 * 22, 0, 0), 2)
// (C) 2021 John F. Ehlers plot(trendPrice - sma(trendPrice, 23), "Osc23", color.rgb(255, 306
// TradingView Pine Script for PineCoders - 10.2 * 23, 0, 0), 2)
// translated from EasyLanguage by Ricardo Santos plot(trendPrice - sma(trendPrice, 24), "Osc24", color.rgb(255, 306
//@version=4 - 10.2 * 24, 0, 0), 2)
study("TASC 2021.10 - Cycle/Trend Analytics") plot(trendPrice - sma(trendPrice, 25), "Osc25", color.rgb(255, 306
- 10.2 * 25, 0, 0), 2)
string i_mode = input("trend", "Mode", options = ["cycle", "trend"]) plot(trendPrice - sma(trendPrice, 26), "Osc26", color.rgb(255, 306
- 10.2 * 26, 0, 0), 2)
float cyclePrice = 0.0 plot(trendPrice - sma(trendPrice, 27), "Osc27", color.rgb(255, 306
float trendPrice = 0.0 - 10.2 * 27, 0, 0), 2)
color c_cyan = color.new(#00ffff, 20) plot(trendPrice - sma(trendPrice, 28), "Osc28", color.rgb(255, 306
- 10.2 * 28, 0, 0), 2)
if i_mode == "cycle" plot(trendPrice - sma(trendPrice, 29), "Osc29", color.rgb(255, 306
cyclePrice := sin(360 * bar_index / 30) - 10.2 * 29, 0, 0), 2)
trendPrice := cyclePrice plot(trendPrice - sma(trendPrice, 30), "Osc30", color.rgb(255, 306
else if i_mode == "trend" - 10.2 * 30, 0, 0), 2)
cyclePrice := na
trendPrice := close

plot(trendPrice - sma(trendPrice, 05), "Osc05", color.


rgb(255, 306 - 10.2 * 05, 0, 0), 2)
plot(trendPrice - sma(trendPrice, 06), "Osc06", color.
rgb(255, 306 - 10.2 * 06, 0, 0), 2)
plot(trendPrice - sma(trendPrice, 07), "Osc07", color.
rgb(255, 306 - 10.2 * 07, 0, 0), 2)
plot(trendPrice - sma(trendPrice, 08), "Osc08", color.
rgb(255, 306 - 10.2 * 08, 0, 0), 2)
plot(trendPrice - sma(trendPrice, 09), "Osc09", color.
rgb(255, 306 - 10.2 * 09, 0, 0), 2)
plot(trendPrice - sma(trendPrice, 10), "Osc10", color.
rgb(255, 306 - 10.2 * 10, 0, 0), 2)
plot(trendPrice - sma(trendPrice, 11), "Osc11", color. FIGURE 1: TRADINGVIEW. https://www.tradingview.com/chart/51Oot9eU
rgb(255, 306 - 10.2 * 11, 0, 0), 2)
plot(trendPrice - sma(trendPrice, 12), "Osc12", color.
rgb(255, 306 - 10.2 * 12, 0, 0), 2)
plot(trendPrice - sma(trendPrice, 13), "Osc13", color.
rgb(255, 306 - 10.2 * 13, 0, 0), 2)
plot(trendPrice - sma(trendPrice, 14), "Osc14", color.
rgb(255, 306 - 10.2 * 14, 0, 0), 2)
plot(trendPrice - sma(trendPrice, 15), "Osc15", color.
rgb(255, 306 - 10.2 * 15, 0, 0), 2)
plot(trendPrice - sma(trendPrice, 16), "Osc16", color.
rgb(255, 306 - 10.2 * 16, 0, 0), 2)
plot(trendPrice - sma(trendPrice, 17), "Osc17", color.
rgb(255, 306 - 10.2 * 17, 0, 0), 2)
plot(trendPrice - sma(trendPrice, 18), "Osc18", color.
FIGURE 2: TRADINGVIEW. https://www.tradingview.com/x/YmwQ9EM3

46 • October 2021 • Technical Analysis of Stocks & Commodities


plot(cyclePrice, "Cycle Price", c_cyan, 3) Cycle/Trend Analytics And The MAD Indicator
plot(sma(cyclePrice, 5) - sma(cyclePrice, 30), "MA delta", color. by John F. Ehlers
green, 3)
hline(0, "Zero", color.white)
Version: 1.00 08/12/2021
The Pine code for the MAD indicator presented by John
Formula Parameters: Default:
Ehlers in his article in this issue is as follows: CTMode Cycle

//@version=4 Notes:
// (C) 2021 John F. Ehlers The related article is copyrighted material. If you are
// TradingView Pine Script for PineCoders not a subscriber of Stocks & Commodities, please visit
// translated from EasyLanguage by Ricardo Santos www.traders.com.
study("TASC 2021.10 - MAD Moving Average Difference")
int i_shortLength = input(8, "Short Length") **********************************/
int i_longLength = input(23, "Long Length") var fpArray = new Array();
var bInit = false;
float shortAvg = sma(close, i_shortLength)
float longAvg = sma(close, i_longLength) function preMain() {
float mad = 100 * (shortAvg - longAvg) / longAvg setStudyTitle("Cycle/Trend Analytics");
setCursorLabelName(" ", 0);
plot(mad, "MAD", mad > 0 ? color.lime : color.red, 2) setCursorLabelName(" ", 1);
hline(0, "Zero") setPriceStudy(false);
setDefaultBarFgColor(Color.RGB(0x00,0x94,0xFF), 0);
These indicators are available on TradingView at: setDefaultBarFgColor(Color.green, 1);
setPlotType( PLOTTYPE_LINE , 0 );
tradingview.com/u/PineCodersTASC/#published-scripts setPlotType( PLOTTYPE_LINE , 1 );
—TradingView setDefaultBarThickness(4, 0);
https://www.tradingview.com setDefaultBarThickness(4, 1);

var x=0;
fpArray[x] = new FunctionParameter("CTMode", FunctionPa-
rameter.STRING);
with(fpArray[x++]){
addOption("Cycle");
F ESIGNAL: OCTOBER 2021 TRADERS’ TIPS CODE addOption("Trend");
For this month’s Traders’ Tip, we’ve provided the CycleTrend setDefault("Cycle");
Analytics.efs and Moving Average Difference Indicator. }
}
efs studies based on the article in this issue by John Ehlers,
“Cycle/Trend Analytics And The MAD Indicator.” These var bVersion = null;
studies, in combination, create a trend indicator that is simple var xClose = null;
var xColor2 = [];
and robust. var Osc = [];
The study contains formula parameters that may be con-
figured through the edit chart window (right-click on the function main(CTMode) {
if (bVersion == null) bVersion = verify();
chart and select “edit chart”). A sample chart is shown in
Figure 3.
To discuss this study or download a complete copy
of the formula code, please visit the EFS library dis-
cussion board forum under the forums link from the
support menu at www.esignal.com or visit our EFS
KnowledgeBase at www.esignal.com/support/kb/efs.
The eSignal formula script (EFS) is also available for
copying & pasting from this magazine’s website at
Traders.com in the Traders’ Tips section.
/**********************************
Provided By:
Copyright 2019 Intercontinental Exchange, Inc. All Rights
Reserved.
eSignal is a service mark and/or a registered service mark
of Intercontinental Exchange, Inc.
in the United States and/or other countries. This sample
eSignal Formula Script (EFS)
is for educational purposes only.
Intercontinental Exchange, Inc. reserves the right to modify
and overwrite this EFS file with each new release.

Description: FIGURE 3: ESIGNAL. Here is an example of the studies plotted on a daily chart of SPY.

October 2021 • Technical Analysis of Stocks & Commodities • 47


if (bVersion == false) return; overwrite this EFS file with each new release.

if ( bInit == false ) { Description:


xClose = close(); Cycle/Trend Analytics And The MAD Indicator
addBand(0, PS_DASH, 1, Color.white, 1); by John F. Ehlers

if (CTMode == "Cycle") {
xPrice = efsInternal('Calc_Price'); Version: 1.00 08/12/2021
}
else xPrice = xClose; Formula Parameters: Default:
ShortLength 8
Color1 = 255; LongLength 23
Color3 = 0;
Notes:
for (i = 2; i <= 27; i++) { The related article is copyrighted material. If you are not a sub-
xColor2[i] = 306 - 10.2 * (i+3); scriber
} of Stocks & Commodities, please visit www.traders.com.

bInit = true; **********************************/


} var fpArray = new Array();
if (getCurrentBarCount() < 30) return; var bInit = false;

for (i = 2; i <= 27; i++){ function preMain() {


count = i + 3; setStudyTitle("Moving Average Difference Indicator");
Osc[i] = xPrice.getValue(0) - sma(count, xPrice, 0); setCursorLabelName("MAD", 0);
setBarFgColor(Color.RGB(Color1,xColor2[i],Color3), i); setPriceStudy(false);
setCursorLabelName("S"+ count, i); setDefaultBarFgColor(Color.RGB(0x00,0x94,0xFF), 0);
} setPlotType( PLOTTYPE_LINE , 0 );

if (CTMode == "Cycle") {
Osc[0] = xPrice.getValue(0); var x=0;
Osc[1] = sma(5, xPrice, 0) - sma(30, xPrice, 0) fpArray[x] = new FunctionParameter("ShortLength", Function-
} Parameter.NUMBER);
with(fpArray[x++]){
return Osc; setLowerLimit(1);
} setDefault(8);
}
function Calc_Price(){ fpArray[x] = new FunctionParameter("LongLength", Function-
return (Math.sin(2 * Math.PI * getCurrentBarIndex() / (30))); Parameter.NUMBER);
} with(fpArray[x++]){
setLowerLimit(1);
function verify(){ setDefault(23);
var b = false; }
if (getBuildNumber() < 779){ }

drawTextAbsolute(5, 35, "This study requires version 10.6 or var bVersion = null;
later.", var xClose = null;
Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text. var xMAD = null;
RELATIVETOLEFT|Text.BOLD|Text.LEFT,
null, 13, "error"); function main(ShortLength, LongLength) {
drawTextAbsolute(5, 20, "Click HERE to upgrade.@ if (bVersion == null) bVersion = verify();
URL=http://www.esignal.com/download/default.asp", if (bVersion == false) return;
Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.
RELATIVETOLEFT|Text.BOLD|Text.LEFT, if ( bInit == false ) {
null, 13, "upgrade"); xClose = close();
return b; addBand(0, PS_DASH, 1, Color.grey, 1);
} xMAD = efsInternal('Calc_MAD', xClose, ShortLength,
else LongLength);
b = true;
bInit = true;
return b; }
}
if (getCurrentBarCount() < LongLength || getCurrentBarCount()
< ShortLength) return;
/**********************************
Provided By:
Copyright 2019 Intercontinental Exchange, Inc. All Rights Re- return xMAD.getValue(0);
served. }
eSignal is a service mark and/or a registered service mark of
Intercontinental Exchange, Inc. function Calc_MAD(xClose, ShortLength, LongLength){
in the United States and/or other countries. This sample eSignal ret = 100 * (sma(ShortLength, xClose) - sma(LongLength,
Formula Script (EFS) xClose)) / sma(LongLength, xClose);
is for educational purposes only. return ret;
Intercontinental Exchange, Inc. reserves the right to modify and }

48 • October 2021 • Technical Analysis of Stocks & Commodities


function verify(){
var b = false;
if (getBuildNumber() < 779){

drawTextAbsolute(5, 35, "This study requires version


10.6 or later.",
Color.white, Color.blue, Text.
RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.
BOLD|Text.LEFT,
null, 13, "error");
drawTextAbsolute(5, 20, "Click HERE to upgrade.@
URL=http://www.esignal.com/download/default.asp",
Color.white, Color.blue, Text.
RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text. FIGURE 4: WEALTH-LAB. This example chart shows recent trades taken by the system if
BOLD|Text.LEFT, applied to a daily chart of SPY.
null, 13, "upgrade");
return b;
}
else
b = true;

return b;
}

—Eric Lippert
eSignal, an Interactive Data company
800 779-6555, www.eSignal.com

F WEALTH-LAB: OCTOBER 2021 TRADERS’ TIPS


CODE
We have added John Ehlers’ MAD indicator into
Wealth-Lab 7’s recent build for the convenience of our
users. This gives you the ability to quickly prototype
FIGURE 5: WEALTH-LAB. This demonstrates setting up the system using Wealth-Lab 7’s
various trading systems based on the indicator. For building blocks.
example, Figure 4 shows a classic trading system—the
MACD (now MAD) crossing above the zero line is often
considered a bullish signal, and vice versa.

System rules
• Enter when the MAD indicator crosses over its
zero line
• Exit when the MAD indicator crosses under its
zero line

Figure 5 shows an example of applying Ehlers’ new


MAD indicator in Wealth-Lab’s building blocks. In
this way, no coding is needed when you use our build-
ing blocks to set up a strategy.
—Gene Geren, Robert Sucher
Wealth-Lab team
www.wealth-lab.com FIGURE 6: NEUROSHELL TRADER. This NeuroShell Trader chart shows the MAD indicator
applied to MSFT.

F NEUROSHELL TRADER: OCTOBER 2021


TRADERS’ TIPS CODE To implement the indicators, select new indicator from the
John Ehlers’ MAD indicator, as described in his insert menu and use the indicator wizard to create the fol-
article in this issue, “Cycle/Trend Analytics And The MAD lowing indicator:
Indicator,” can be easily implemented in NeuroShell Trader Divide( Avg1-Avg2( Close, 20, 40), Avg( Close, 40) )
by combining some of NeuroShell Trader’s 800+ indicators.
October 2021 • Technical Analysis of Stocks & Commodities • 49
A sample chart displaying the indicator is shown
in Figure 6.
Users of NeuroShell Trader can go to the Stocks
& Commodities section of the NeuroShell Trader
free technical support website to download a copy of
this or any previous Traders’ Tips.
—Ward Systems Group, Inc.
[email protected]
www.neuroshell.com

F NINJATRADER: OCTOBER 2021 TRADERS’ TIPS


CODE
The indicators described in John Ehlers’ article in this
issue, “Cycle/Trend Analytics And The MAD Indica-
tor,” are available for download at the following links
for NinjaTrader 8 and for NinjaTrader 7:
FIGURE 7: NINJATRADER. This daily chart shows the EMINI S&P 500 futures continuous
NinjaTrader 8: www.ninjatrader.com/SC/October- contract with the cycle/trend analytics indicator in the topmost pane set to “cycle,” followed by
2021SCNT8.zip the cycle/trend analytics set to “trend” in the next pane down, and finally the MAD indicator in
NinjaTrader 7: www.ninjatrader.com/SC/October- the bottommost pane from 12/1/2019 through 7/2/2021.
2021SCNT7.zip

Once the file is downloaded, you can import the


indicators into NinjaTrader 8 from within the control
center by selecting Tools → Import → NinjaScript
Add-On and then selecting the downloaded file for
NinjaTrader 8. To import in NinjaTrader 7, from with-
in the control center window, select the menu File →
Utilities → Import NinjaScript and select the down-
loaded file.
You can review the source code for these indicators
in NinjaTrader 8 by selecting the menu New → Nin-
jaScript Editor → Indicators from within the control FIGURE 8: OPTUMA. This sample chart displays John Ehlers’ MAD indicator on S&P 500
center window and selecting the CycleTrendAnalytics emini futures.
or MAD file. You can review the indicators’ source
Group (www.optuma.com/ehlers) and will be available to all
code in NinjaTrader 7 by selecting the menu Tools → Edit
clients. Here is the scripting code for the MAD oscillator:
NinjaScript → Indicator from within the control center win-
dow and selecting the CycleTrendAnalytics or MAD file. //MvgAv Inputs;
NinjaScript uses compiled DLLs that run native, not in- #$Short = 8;
#$Long = 23;
terpreted, which provides you with the highest performance //Calculate MAD;
possible. S1 = MA(BARS=$Short, CALC=Close);
A sample chart displaying these indicators is shown in L1 = MA(BARS=$Long, CALC=Close);
100 * ((S1 - L1)/L1)
Figure 7.
—Kate Windheuser —[email protected]
NinjaTrader, LLC www.optuma.com
www.ninjatrader.com

F AIQ: OCTOBER 2021 TRADERS’ TIPS CODE


The importable AIQ EDS file based on John Ehlers’
® article in this issue, “Cycle/Trend Analysis And The
MAD Indicator,” can be obtained on request via email to
F OPTUMA: OCTOBER 2021 TRADERS’ TIPS CODE [email protected]. The code is also available
The cycle and trend modes and MAD oscillator discussed in on the magazine’s website at Traders.com in the Traders’
John Ehlers’ article in this issue (“Cycle/Trend Analytics And Tips section. Code for the author’s indicator is set up in the
The MAD Indicator”) will be added to Optuma’s Ehlers Tool AIQ code file.

50 • October 2021 • Technical Analysis of Stocks & Commodities


S&C Digital Edition
Did you know that every subscriber to Technical Analysis of  Stocks & Commodities magazine
has full access to the magazine in digital format? No waiting for the mail to be delivered, no need to carry
around back issues — just log on to Traders.com on any internet-capable device to read any issue or article
we’ve ever published, either in your browser, or downloaded to your device as a pdf for reading anytime,
anywhere. Every subscription includes:

Digital Edition — the complete magazine as PDF, Complete Digital Archive — from 1982 through
available to read in your browser or download to to the present. More than 17,000 pages of articles,
your device for offline viewing. You will still receive product reviews, charts, spreadsheets, and code.
the printed magazine unless you opt for a digital-
only subscription. Working Money — insight on how to minimize
your losses and maximize your profits while invest-
ing for maximum growth.

Traders.com Advantage — whether you need to


learn how an indicator works or just want to know
what a trader is looking at now, this is your source
of real-time information.

Article Code — download or copy & paste code


presented in past issues of Stocks & Commodities
— including Traders’ Tips code.

Optimized Trading — starting points when trying


to decide what values to input into your charting
software. Search for a certain symbol or company
or build your own portfolio.

Visit www.Traders.com to find out more!


Email: [email protected] • Phone: 206-938-0570 facebook.com/STOCKSandCOMMODITIES @STOCKSandCOMM
!CYCLE/TREND ANALYTICS AND THE MAD INDICATOR
!Author: John F. Ehlers, TASC Oct 2021
!Coded by: Richard Denning, 8/15/2021

!MAD (Moving Average Difference) Indicator


!(C) 2021 John F. Ehler

Shortlength is 8.
LongLength is 23.
MAD is 100*(simpleavg([Close], ShortLength) -
simpleavg([Close], LongLength)) /
simpleavg([Close], LongLength).

Figure 9 shows the MAD indicator on a chart of


Tesla, Inc. (TSLA).
—Richard Denning
[email protected]
for AIQ Systems

F TRADERSSTUDIO: OCTOBER 2021


TRADERS’ TIPS CODE FIGURE 9: AIQ. This shows a chart of Tesla, Inc. with the MAD indicator applied.
The importable TradersStudio file based
on John Ehlers’ article in this issue, “Cycle/Trend Ana-
lytics And The MAD Indicator,” can be obtained on
request via email to [email protected].
The code is also available on this magazine’s website
at Traders.com in the Traders’ Tips section.
Code for the author’s indicators is provided in the
following files:

Function EHLERS_MAD: Computes the MAD


indicator
Indicator plot EHLERS_MAD_IND: Plots the
MAD indicator on a chart
'CYCLE/TREND ANALYTICS AND THE MAD INDICATOR
'Author: John F. Ehlers, TASC Oct 2021
'Coded by: Richard Denning, 8/15/2021
FIGURE 10: TRADERSSTUDIO. The MAD indicator is shown on a chart of Microsoft Inc
'MAD (Moving Average Difference) Indicator (MSFT) during 2011–2012.
'(C) 2021 John F. Ehler
Function EHLERS_MAD(ShortLength,LongLength)
'Shortlength=8
'LongLength=23
two moving averages normalized to +/-100. The code in C
EHLERS_MAD = 100*(Average(Close, ShortLength) - for Zorro is as follows:
Average(Close, LongLength)) / Average(Close, LongLength)
End Function var MAD(vars Data, int ShortPeriod, int LongPeriod)
{
return 100*(SMA(Data,ShortPeriod)/
Figure 10 shows the indicators on a chart of Amazon Inc. SMA(Data,LongPeriod)-1.);
(AMZN) from 2012 to 2014. }
—Richard Denning
[email protected] According to Ehlers, the two periods should differ by half
for TradersStudio the period of the dominant cycle in the data. This ensures
that the indicator output is in phase with the dominant cycle,
thus indicating its trend with no lag. For putting that to the
F T HE ZORRO PROJECT: OCTOBER 2021 TRAD- test, we can apply an SMA 5-20 difference to a 30-period
ERS’ TIPS CODE sine wave. The code for this is as follows:
In his article in this issue, “Cycle/Trend Analytics function run()
And The MAD Indicator,” John Ehlers proposes a new trend {
indicator, the MAD (moving average difference) oscillator. MaxBars = 200;
asset(""); // dummy asset
As the name suggests, the indicator is just the difference of ColorUp = ColorDn = 0; // don't plot a price curve

52 • October 2021 • Technical Analysis of Stocks & Commodities


vars Sine = series(genSine(30,30));
var Diff = SMA(Sine,5) - SMA(Sine,20);
plot("Sine",Sine[0]-0.5,LINE,BLUE);
plot("MAD",Diff,LINE,RED);
}

The resulting chart is shown in Figure 11. The chart dis-


plays the SMA 5-20 difference (red) applied to a 30-period
sine wave (blue). We can see that the red difference is indeed
exactly in sync with the blue sine wave.
In our tests this seems to work only with the selected
5-20-30 periods from Ehlers’ code. We tried other SMA
periods like 10 and 25, but the red curve gets a phase shift
although the difference is the same. Maybe Ehlers will shed
some light on that phenomenon in a future article.
Here’s the code to replicate his chart with SPY data from
the STOOQ website: FIGURE 11: ZORRO PROJECT. The chart displays the SMA 5-20 difference (red)
applied to a 30-period sine wave (blue). We can see that the red difference is exactly
void run() in sync with the blue sine wave.
{
StartDate = 20191201;
EndDate = 20210701;
BarPeriod = 1440;

assetAdd("SPY","STOOQ:*");
asset("SPY");
plot("MAD",MAD(seriesC(),8,23),NEW,RED);
}

The resulting chart in Figure 12 matches Ehlers’ example.


Note that his normalization by dividing through the longer
SMA introduces a small phase shift. So the chart would look
slightly different with a plain SMA difference.
In his next article, Ehlers indicates that he will show ex-
amples of the indicator, so we will wait until then before
testing it in a trading system.
The MAD oscillator and test script can be downloaded FIGURE 12: ZORRO PROJECT. This example SPY chart replicates the chart in
from the 2021 script repository on https://financial-hacker. John Ehlers’ article in this issue.
com. The Zorro platform can be downloaded from https://
zorro-project.com.
—Petra Volkova F EXCEL: OCTOBER 2021 TRADERS’ TIPS CODE
The Zorro Project by oP group Germany In his article in this issue, “Cycle/Trend Analytics And The
https://zorro-project.com MAD Indicator,” John Ehlers walks us through the develop-
ment of his moving average difference (MAD) indicator.
The mathematical steps and the charting techniques used

FIGURE 13: EXCEL, CYCLE MODE ANALYTIC. This displays the SMA oscillators with lengths from 5 to 30 using a 30-bar sine wave as input.

October 2021 • Technical Analysis of Stocks & Commodities • 53


FIGURE 14: EXCEL, TREND MODE ANALYTIC. This shows the same set of SMA oscillators using the closing price as input.

FIGURE 15: EXCEL, MAD INDICATOR. Here you can see the MAD indicator plotted using lengths 8 and 23.

FIGURE 16: EXCEL, MAD INDICATOR. This chart demonstrates the trend mode oscillator and MAD indicator.

to illustrate the steps are both informative and colorful. MAD indicator as the difference between two simple mov-
First, I’ll show a set of “price minus SMA-of-price” os- ing averages (Figure 15).
cillators where the length of the SMA varies from 5 to 30. A key point of the development of MAD is the choice of
Figure 13 shows the cycle mode and Figure 14 shows the lengths for the shorter and longer moving averages.
trend mode. Ehlers has a couple of comments on this topic:
Ehlers notes that when you substitute the close price as the
input, “the separation between the reddest line and the yel- • MAD becomes smoother as the length of the shorter
lowest line reflects the strength of the trend.” Further, “When moving average becomes longer.
the red line is on top, the trend is up and when the red line • If the dominant cycle of the input is known, then the
is on the bottom, the trend is down.” This leads us to Ehlers’ difference between the averaging lengths should be ap-

54 • October 2021 • Technical Analysis of Stocks & Commodities


proximately half the period of the dominant cycle. End;
• If the dominant cycle is unknown, make the length of Color1 = 255;
the longer average twice the length of the shorter aver- Color3 = 0;
age. For Length = 5 to 30 Begin
Osc[Length] = Price - Average(Price, Length);
End;
Finally, a bit of visual perspective: See Figure 16.
For Length = 5 to 30
Begin
To download this spreadsheet: The spreadsheet file for Color2 = 306 - 10.2*Length;
this Traders’ Tip can be downloaded from traders.com in //If Length = 3 Then Plot3[0](Osc[Length], "S3", RGB(Color1,
the Traders’ Tips area. To successfully download it, follow //Color2, Color3),0,4);
If Length = 4 Then Plot4[0](Osc[Length], "S4", RGB(Color1,
these steps: Color2, Color3),0,4);
If Length = 5 Then Plot5[0](Osc[Length], "S5", RGB(Color1,
• Right-click on the link to the Excel file, then Color2, Color3),0,4);
If Length = 6 Then Plot6[0](Osc[Length], "S6", RGB(Color1,
• Select “save target as” to place a copy of the spreadsheet Color2, Color3),0,4);
file on your hard drive. If Length = 7 Then Plot7[0](Osc[Length], "S7", RGB(Color1,
—Ron McAllister Color2, Color3),0,4);
Excel and VBA programmer If Length = 8 Then Plot8[0](Osc[Length], "S8", RGB(Color1,
[email protected] Color2, Color3),0,4);
If Length = 9 Then Plot9[0](Osc[Length], "S9", RGB(Color1,
Color2, Color3),0,4);
If Length = 10 Then Plot10[0](Osc[Length], "S10", RGB(Color1,
Color2, Color3),0,4);
If Length = 11 Then Plot11[0](Osc[Length], "S11", RGB(Color1,
Color2, Color3),0,4);
If Length = 12 Then Plot12[0](Osc[Length], "S12", RGB(Color1,
F TRADESTATION: OCTOBER 2021 TRADERS’ TIPS CODE Color2, Color3),0,4);
In his article “Cycle/Trend Analytics And The MAD Indi- If Length = 13 Then Plot13[0](Osc[Length], "S13", RGB(Color1,
cator,” author John Ehlers discusses how his research into Color2, Color3),0,4);
If Length = 14 Then Plot14[0](Osc[Length], "S14", RGB(Color1,
characteristics of cycles in market data led to the development Color2, Color3),0,4);
of a new trend indicator called the moving average difference If Length = 15 Then Plot15[0](Osc[Length], "S15", RGB(Color1,
(MAD). First, the two modes (“cycle” and “trend”) of the Color2, Color3),0,4);
If Length = 16 Then Plot16[0](Osc[Length], "S16", RGB(Color1,
cycle/trend analytics indicator provide a foundational context Color2, Color3),0,4);
for the MAD oscillator. Essentially, the MAD oscillator is a If Length = 17 Then Plot17[0](Osc[Length], "S17", RGB(Color1,
difference between two simple moving averages with varying Color2, Color3),0,4);
If Length = 18 Then Plot18[0](Osc[Length], "S18", RGB(Color1,
lengths. The difference in lengths should be approximately Color2, Color3),0,4);
half the period of the dominant cycle in the data. If unknown, If Length = 19 Then Plot19[0](Osc[Length], "S19", RGB(Color1,
it is suggested to make the length of the longer moving average Color2, Color3),0,4);
If Length = 20 Then Plot20[0](Osc[Length], "S20", RGB(Color1,
twice that of the shorter one. Color2, Color3),0,4);
If Length = 21 Then Plot21[0](Osc[Length], "S21", RGB(Color1,
Indicator: TASC AUG 2021 MAB Color2, Color3),0,4);
// TASC OCT 2021 If Length = 22 Then Plot22[0](Osc[Length], "S22", RGB(Color1,
// Cycle/Trend Analytics Color2, Color3),0,4);
// (C) 2021 John F. Ehlers If Length = 23 Then Plot23[0](Osc[Length], "S23", RGB(Color1,
Inputs:
CTMode("trend"); // "cycle" or "trend"

Vars:
Price(0),
Length(0),
NormalLength(0),
Color1(0),
Color2(0),
Color3(0);

Arrays:
Osc[50](0);

Plot1(0,"",white, 1, 1);
Price = Close;

If CTMode = "cycle" Then
Begin
Price = Sine(360*CurrentBar / 30);
Plot2(Price,"", cyan, 4, 4); FIGURE 17: TRADESTATION. A daily chart of the continuous E-mini S&P 500 Index
Plot3(Average(Price, 5) - Average(Price, 30),"", green, 4, 4); with the indicators applied.

October 2021 • Technical Analysis of Stocks & Commodities • 55


Color2, Color3),0,4); LongLength(23);
If Length = 24 Then Plot24[0](Osc[Length], "S24", RGB(Color1,
Color2, Color3),0,4); Vars:
If Length = 25 Then Plot25[0](Osc[Length], "S25", RGB(Color1, MAD(0);
Color2, Color3),0,4); MAD = 100*(Average(Close,
If Length = 26 Then Plot26[0](Osc[Length], "S26", RGB(Color1, ShortLength) - Average(Close,
Color2, Color3),0,4); LongLength)) / Average(Close,
If Length = 27 Then Plot27[0](Osc[Length], "S27", RGB(Color1, LongLength);
Color2, Color3),0,4);
If Length = 28 Then Plot28[0](Osc[Length], "S28", RGB(Color1, Plot1(MAD, "", red, 4, 4);
Color2, Color3),0,4); Plot2(0,"", white, 1, 1)
If Length = 29 Then Plot29[0](Osc[Length], "S29", RGB(Color1,
Color2, Color3),0,4); This article is for informational purposes. No type of
If Length = 30 Then Plot30[0](Osc[Length], "S30", RGB(Color1,
Color2, Color3),0,4); trading or investment recommendation, advice or strategy
End is being made, given or in any manner provided by Trade­
Station Securities or its affiliates.
Indicator: TASC OCT 2021 MAD —John Robinson
// TASC AUG 2021 TradeStation Securities, Inc.
// MAD (Moving Average Difference) Indicator www.TradeStation.com
// (C) 2021 John F. Ehlers

Inputs:
ShortLength(8),

INTERVIEW Montier, James [2009] Value Invest- “Fill The Gap,” monthly podcast,
Continued from page 36 ing, Wiley. https://cmtassociation.org/devel-
Lundgren David [1993]. “Stochastic opment/podcasts
Indicators And Trading,” Techni-
[2016]. Quality Investing: Owning cal Analysis of Stocks & Com-
The Best Companies For The Long modities, Volume 11: March.
Term, Harriman House. Lundgren, David, and Tyler Wood,

MUSTAPHA/DIRECTIONAL CROSS
Continued from page 42
Profitable trading involves
correctly determining where
we used for TradingView—the length should be set to the market is disposed to go
12. The source should be “close,” and the offset should before it moves.
be zero. The style should be set to your preference.

AN EFFECTIVE STRATEGY
The directional cross strategy can be an effective strat- FURTHER READING
egy in the right market environment with proper risk Mustapha, Azeez [2021]. “A Simple Forex Trend-Fol-
management in place. lowing Strategy,” Technical Analysis of StockS &
commoditieS, Volume 39: April.
Azeez Mustapha is an analyst at Instaforex Companies ‡MetaTrader ‡TradingView
Group and a blogger at Advfn.com, and as well as a ‡See Editorial Resource Index
freelance author for trading magazines. He is a trading
signals provider at some websites. He can be reached via
email at [email protected].
56 • October 2021 • Technical Analysis of Stocks & Commodities
Free Information From Advertisers
Advertiser Page Advertiser Page How to reach us
Brokerages Software For questions, address changes, or
Interactive Brokers 3 MetaStock 11 ordering information for Technical
ibkr.com/progateway MetaStock.com/traders-summit Analysis of Stocks & Commodities
magazine and its online publications:
Ninjatrader 5 Ninjatrader 5
Toll-free 800 832-4642
ninjatrader.com ninjatrader.com
(800-Technical) or:
TD Ameritrade 19 VectorVest 64 206 938-0570.
thinkorswim.com www.ProfitLockerPro.com/SC
Email us at:
Publications Websites [email protected].
Stocks & Commodities 2, 39, 51, 63 Stocks & Commodities 2, 39, 51, 63 Or write to us at:
Store.Traders.com, Traders.com Store.Traders.com, Traders.com 4757 California Ave. SW,
Seattle, WA 98116-4499.
Software
AbleSys 7
Do your magazines arrive tattered
www.ablesys.com/SCM
and torn? Polybagging of magazines
(domestic delivery) is available for
$6/year.
Single back issues from the current
Editorial Resource Index
year (subject to availability) are $8
The Zorro Project .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 AIQ.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 prepaid. Subscribers have access to
EasyLanguage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 TradersStudio. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 our digital archive of all past articles.
TradeStation.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 StockOdds.net. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 Individual articles can be purchased
Microsoft Excel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 mystockodds.com.. . . . . . . . . . . . . . . . . . . . . . . . . . . 60
from the Online Store at our website,
Traders.com.
ProfitSource. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
OptionsAnalysis.com.. . . . . . . . . . . . . . . . . . . . . . . 29 Editorial feedback
We always want to know more about
eSignal.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
the needs of our readers: What kinds of
TradingView. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
articles would you like to see more of?
StockCharts.com.. . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 What do you find useful? Address your
Wealth-Lab.com. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 written questions and comments to edi-
NeuroShell Trader (Ward Systems Group) .. . . 49 [email protected] or to: Editor, Stocks
NinjaTrader. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 & Commodities, 4757 California Ave
Optuma. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 SW, Seattle, WA 98116-4499. Sorry, we
cannot perform research on individual
financial questions not related to this
For more information about our advertisers, go to Traders.com/reader where magazine and we cannot respond to
you will find the alphabetized list of this month’s advertisers. For reference, the all mail. Letters or emails containing
list is also printed above along with the corresponding page number for each ad. questions or information that other
Just follow the simple directions below and the advertisers will get your requests readers may enjoy or that relate to
the same day! our articles or technical analysis top-
ics may be published in our Letters to
Step 1: Go to Traders.com/reader and S&C column.
scroll through the list of our current month’s Join us on Facebook
advertisers.Click the box for each adver- at www.facebook.com/
tiser you’d like to hear from. At the bottom STOCKSandCOMMODITIES
of the list, click Continue when finished.
Follow us on Twitter
Step 2: Fill out your contact information @STOCKSandCOMM
and click Send Request. Your request will
then be sent to the advertisers you selected.
To receive information on the products and services listed in the Editorial
and Advertisers’ Indexes, go to: Traders.com/reader. These indexes are
And that’s it! published solely as a convenience. While every effort is made to maintain
accuracy, last-minute changes may result in omissions or errors.

October 2021 • Technical Analysis of Stocks & Commodities • 57


FUTURES LIQUIDITY

T
rading liquidity is often over- very high volumes. The greatest number three-year period. Thus, all numbers in
looked as a key technical of dots indicates the greatest activity; this column have an equal dollar value.
measurement in the analysis futures with one or no dots show little Columns indicating percent margin
and selection of commodity activity and are therefore less desirable and effective percent margin provide
futures. The following explains how to for speculators. a helpful comparison for traders who
read the futures liquidity chart pub- Courtesy of CBOT wish to place their margin money ef-
lished by Technical Analysis of Stocks ficiently. The effective percent margin
& Commodities every month. is determined by dividing the margin
value ($) by the three-year price range of
Commodity futures contract dollar value, and then multiply-
The futures liquidity chart shown be- ing by one hundred.
low is intended to rank publicly traded
futures contracts in order of liquidity. Stocks
Relative contract liquidity is indicated Trading liquidity has a significant ef-
by the number of dots on the right-hand fect on the change in price of a secu-
side of the chart. rity. Theoretically, trading activity can
This liquidity ranking is produced by serve as a proxy for trading liquidity
multiplying contract point value times All futures listed are weighted equally and equals the total volume for a given
the maximum conceivable price motion under “contracts to trade for equal dol- period expressed as a percentage of the
(based on the past three years’ historical lar profit.” This is done by multiplying total number of shares outstanding. This
data) times the contract’s open interest contract value times the maximum pos- value can be thought of as the turnover
times a factor (usually 1 to 4) for low or sible change in price observed in the last rate of a firm’s shares outstanding.

Trading Liquidity: Futures


Contracts to
Effective
Commodity Futures Exchange % Margin Trade for Equal Relative Contract Liquidity
% Margin
Dollar Profit
S&P 500 E-Mini (Sep ’21) CME 5.7 11.2 2 ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••>>>>>>
10-Year T-Note (Sep ’21) CBOT 1.3 10 14 ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••>
Ultra T-Bond (Sep ’21) CBOT 3.6 13.4 4 •••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
Russell 2000 E-Mini (Sep ’21) CME 3.3 5.9 2 ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
5-Year T-Note (Sep ’21) CBOT 0.7 7.2 19 •••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
Nasdaq 100 E-Mini (Sep ’21) CME 6.2 10.1 1 ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
Crude Oil WTI (Oct ’21) NYMEX 9.6 5.9 2 ••••••••••••••••••••••••••••••••••••••••••••••••••••••••
Ultra 10-Year T-Note (Sep ’21) CBOT 1.8 10.2 9 •••••••••••••••••••••••••••••••••••••••••••••••••
T-Bond (Sep ’21) CBOT 2.3 13.2 8 •••••••••••••••••••••••••••••••••••••••••••••••
Gold (Dec ’21) COMEX 5.5 16.4 4 •••••••••••••••••••••••••••
2-Year T-Note (Sep ’21) CBOT 0.2 3.3 22 ••••••••••••••••••••••••••
Soybean (Nov ’21) CBOT 4.3 10.8 4 ••••••••••••••••••••••
Corn (Dec ’21) CBOT 9.8 22 19 ••••••••••••
Dow Futures Mini (Sep ’21) CBOT 5.6 11.7 3 •••••••••••
S&P 500 VIX (Sep ’21) CFE 50.8 17.3 4 •••••••••••
Euro FX (Sep ’21) CME 1.7 18.4 17 ••••••••••
Soybean Meal (Dec ’21) CBOT 1.7 5.1 3 ••••••••••
Eurodollar (Dec ’21) CME 0.1 3.3 35 •••••••••
Gasoline RBOB (Oct ’21) NYMEX 8.7 10.8 4 •••••••••
Natural Gas (Oct ’21) NYMEX 7.7 12.2 9 ••••••
ULSD NY Harbor (Oct ’21) NYMEX 7.6 10.9 4 •••••
Australian Dollar (Sep ’21) CME 2.5 10.9 14 ••••
Coffee (Dec ’21) ICE/US 14.5 27.7 6 ••••
S&P Midcap E-Mini (Sep ’21) CME 5.6 9.8 2 ••••
Sugar #11 (Oct ’21) ICE/US 6.7 12.5 19 ••••
British Pound (Sep ’21) CME 2.8 17.3 17 •••
Silver (Sep ’21) COMEX 12.9 26.1 4 •••
Wheat (Dec ’21) CBOT 6.9 16.2 15 •••
Canadian Dollar (Sep ’21) CME 1.6 12.5 24 ••
Cotton #2 (Dec ’21) ICE/US 6.3 13 10 ••
Hard Red Wheat (Dec ’21) KCBT 7.2 14.6 13 ••
High Grade Copper (Sep ’21) COMEX 7 14 4 •• CBOT Chicago Board of Trade, Division of CME
Japanese Yen (Sep ’21) CME 2 23.2 23 •• CFE CBOE Futures Exchange
30-Day Fed Funds (Aug ’21) CBOT 0 2 23 • CME Chicago Mercantile Exchange
Bitcoin Futures (Aug ’21) CME 36.9 39.4 1 • COMEX Commodity Exchange, Inc. CME Group
Canola (Nov ’21) ICE/CA 8.8 17.4 26 • ICE-EU Intercontinental Exchange-Futures - Europe
Cocoa (Dec ’21) ICE/US 8.1 31.4 34 • ICE-US Intercontinental Exchange-Futures - US
Crude Oil Brent (F) (Oct ’21) NYMEX 8.4 11.2 5 • KCBT Kansas City Board of Trade
Lean Hogs (Oct ’21) CME 5.6 9.6 11 • MGEX Minneapolis Grain Exchange
Live Cattle (Oct ’21) CME 3.4 9.2 12 • NYMEX New York Mercantile Exchange

Mexican Peso (Sep ’21) CME 6.3 29.2 43 •
2110
Platinum (Oct ’21) NYMEX 9.3 21.4 11 •
Trading Liquidity: Futures is a reference chart for speculators. It compares markets “Relative Contract Liquidity” places commodities in descending order according to
according to their per-contract potential for profit and how easily contracts can be bought how easily all of their contracts can be traded. Commodities at the top of the list are easi-
or sold (i.e., trading liquidity). Each is a proportional measure and is meaningful only est to buy and sell; commodities at the bottom of the list are the most difficult. “Relative
when compared to others in the same column. Contract Liquidity” is the number of contracts to trade times total open interest times a
The number in the “Contracts to Trade for Equal Dollar Profit” column shows how volume factor, which is the greater of:
many contracts of one commodity must be traded to obtain the same potential return In volume
as another commodity. Contracts to Trade = (Tick $ value) x (3-year Maximum Price 1 or exp –2
In 5000
Excursion).

58 • October 2021 • Technical Analysis of Stocks & Commodities


ADVISORY SERVICES ADVISORY SERVICES SOFTWARE

Yes, You Can Cash In On Chaos! Certified


INTENSIVE OPTION MENTORING Chaos Traders Courses teach you how. Build and test
Learn to earn at http://moneytide.com?r=s systems without
McMillan Analysis, Corp. EMini MoonTide Hotline up 234 months in a row
http://daytradingforecasts.com?r=s
coding!
“tailored to my knowledge”
www.NeuroShell.com
“can’t recommend it enough” EDUCATIONAL
“program paid for itself”
[email protected] JOHN EHLERS WORKSHOP TO ADVERTISE CONTACT:
18–22 October — Online
An intimate and intense Ed Schramm
learning experience [email protected] • (206) 938 0570

www.MESASoftware.com
TRADERS'
RESOURCE

TOP 10 VIEWED BROKERAGES FOR TRADERS


LINKS
Self-directed traders, as Stocks &
Commodities readers usually are,
Brokerage Company
have more choices than ever in their 1. NinjaTrader Brokerage NinjaTrader Group, LLC
search for speed, pricing efficiency,
2. Interactive Brokers Interactive Brokers
and good accounting when it comes
to brokerages. First, you have to 3. AvaTrade AvaTrade
find a brokerage that handles your tradable; you
4. TD Ameritrade TD Ameritrade, Inc.
can choose between a full-service brokerages or a
discount brokerage. Full service would mean you 5. Fidelity Active Trader Pro Fidelity Investments
would sit down with your broker, whereas discount
6. Charles Schwab Charles Schwab
brokerage would involve trading online without any
advice from a professional. Most institutions that 7. Infinity Futures Infinity Futures
offer full service brokerages also have the discount
8. Schwab Active Trading Charles Schwab
broker option.
Other considerations are what kinds of tools or 9. Investrade Discount Securities Investrade Discount Securities
services do they provide? Do they provide real-time
10. AGN Futures AGN Futures
data? Which markets do they give you access to? Do
they have account minimums? How fast are their These are the 10 Brokerage listings clicked on most often on the Traders’ Resource website, in
executions? How much are their commissions? What order of clicks received. This is not an editorial rating or ranking. For more information on spe-
cific products and services, try checking store.Traders.com for archived S&C product reviews.
kind of support do they offer?
With the presence of freely available company
information online, retail brokerage research is less valuable than TRADERS’ RESOURCE AT TRADERS.COM
it ever has been. Nevertheless, if you’re in less intensively studied Our full Traders’ Resource database is available at our website,
but highly commercial markets such as futures, a brokerage’s Traders.com. There, you’ll not only find a listing of brokerages,
ability to provide market statistics, hedging activity reports, and you’ll also find information on products and services in numerous
other commercial information may be critical to your trading and other categories as well, such as data services, software, hardware,
investing decisions. trading systems, consultants, advisors, publications, courses,
Finally, don’t forget the security of your money. Inquire about and more. Just click on the Traders’ Resource link, then choose
a brokerage’s clearing operations, and if you’re in equities, about a category, or use the search feature to find products or services
Securities Investor Protection Corp. (SIPC) coverage. with specific attributes.
The information in Traders’ Resource is the most accurate at the time of posting and is subject to change. Because the vendors posting to Traders’ Resource are responsible for their own listing, Technical Analysis, Inc. declines any and all
liability for any representations made by the businesses and individuals listed. Nor can Technical Analysis, Inc. endorse any business or individual listed on Traders’ Resource. Technical Analysis, Inc. makes no warranties, express or im-
plied, as to the accuracy and reliability of claims herein. You agree to release Technical Analysis, Inc., together with its respective employees, agents, officers, directors and shareholders, from any and all liability and obligations whatsoever
in connection with or arising from your use of Traders’ Resource. If at any time you are not happy with the information posted to Traders’ Resource or object to any material within Traders’ Resource, your sole remedy is to cease using it. This
list is updated frequently. If you are aware of a business that should be listed, please email us at [email protected].

October 2021 • Technical Analysis of Stocks & Commodities • 59


Trading Perspectives
SOME PERSPECTIVES ON THE EQUITIES WORLD
Rob Friesen is a professional trader and president & COO of Bright Trading
(www.stocktrading.com), a proprietary trading firm hosting independent
trader/members, an online trading school, and utilizing the StockOdds
database (www.mystockodds.com). Courses on advanced hedged trad-
ing and basket trading are also offered. This column shares his thoughts
and outlooks on trading, locating opportunity, probabilistic outcome, and
maintaining perspective throughout industry changes. He can be reached
at [email protected] or via stocktrading.com. Rob Friesen

STATISTICAL BACKDROPS WITH time protecting their downside, but and US oil fund ETFs (XLE, XOP,
IF-THEN PARAMETERS from a trader’s perspective, we could USO) having substantial negative
The framework I will discuss here be long some historically better performance, as well as gold and
can apply to daily trading activity, performers and short the worst silver (GLD, SLV) and the senior and
swing trading, or investing. performers. junior miners (GDX, GDXJ).
There are many useful inputs to We can see some standouts to focus Having this map of the market prior
utilize for context, no matter which on long, such as the financials (XLF, to entering a season provides the
type of trading styles, methods, and KRE, KBE) and utilities (XLU). market participant with a significant
time durations you undertake. Many For the short side, commodities advantage over those who are not
market participants limit themselves don’t historically behave very well aware. Any form of tape reading,
by electing to use only what they are in October, with energy, exploration chart reading, or indicator reading
familiar with, have been introduced
to, or acquire through third-party October Average Performances in Percentage
means. Few truly do their own Market ETFs Sector SPDR ETFs
homework, remaining vigilant in
DIA SPY QQQ IWM XLB XLC XLE XLF XLI XLK XLP XLRE XLU XLV XLY
seeking out beneficial tools, research,
or data in order to evolve and expand 0.59 0.79 1.06 0.28 0.55 -1.40 -1.30 1.84 0.54 0.83 1.19 -1.60 2.80 0.49 0.13
their trading business or investing. Other ETFs
As I have mentioned in previous
articles, October is a volatile month XRT XOP USO TLT BND VNQ KRE KBE IWD IWF GLD GDX GDXJ SLV EEM
but not a down month on average for -0.61 -3.30 -4.90 -1.14 -0.27 0.86 2.80 2.70 0.87 0.54 -0.40 -2.0 -4.60 -0.56 1.20
the major market indices. Figure 1
FIGURE 1: STOCKODDS SEASONALITY ALMANAC. This shows historical average performance
shows a list of ETFs and their average of various ETFs for the month of October.
performances for October.
As we prepare for a market that may
be up as it has been in the past, we
would focus on the strongest stocks
in the strongest groups, sectors, and
industries. We should however run
the scenario of what it would look
like to have a negative catalyst (or
more than one) push the market down.
The world seems to throw plenty of
surprises at its inhabitants these days,
WWW.MYSTOCKODDS.COM

so by having a seasonality context to


lean on, we can plan for what should
be, and yet we can also be prepared
and quick to respond when or if the
FIGURE 2: XLU AND SPY, AVERAGE % CHANGE. A lot can happen in a month, and thus monthly
opposite occurs. average performance figures don’t tell the full story. Here you can see the ups and downs XLU has
Investors have a more challenging experienced on its way to achieving its average monthly performance.
60 • October 2021 • Technical Analysis of Stocks & Commodities
Trading Perspectives
would have better outcomes when Average
Signal Top Performing Industry
aligned with the money flow, and if Performance in %
that flow is in keeping with historical First trading day of October Water utilities 0.23
patterns, then again, the advantage First Friday of October Electric utilities 0.81
goes to the informed.
Regarding patterns: There can Third Friday of October Electric utilities 0.43
be fundamental reasons why these Last trading day of October Gas utilities 0.14
monthly patterns exist. We can
FIGURE 3: STOCKODDS SEASONALITY ALMANAC. This shows top-performing industries on
perform the same analysis for any days in October.
day of the week, week of the month,
month of the year, and as we roll
into October, researching for greater
data granularity is recommended.
The reason for this is that a lot can
happen in a month.
For example, XLU, which has a
monthly average performance of
2.8%, doesn’t arrive at that gain in a
straight line, as you can see in Figure
2. XLU tends to start out the month
a bit rough but then performs well
from the first Friday through mid-
month seasonality (payroll deposits),
then drops in performance in the last
five trading days of the month. This
would mean that seasonality could
play a role in trade optimization.
Focusing on any discount in utility
companies near the end of September
or early October coupled with odds
of performing well could again give
the trader an edge.
Figure 3 shows even further
granularity. So as we can see, not
every utility stock goes up each
trading day of October. Even though
utility stocks perform well on average,
they do so at different rates and some FIGURE 4: STOCKODDS SEASONALITY ALMANAC. October monthly average performance for
certain stocks.
even go down. By using seasonality
data such as in this example, you If we are looking for investment industry approach with longs and
can be advantaged by selecting the ideas for the month of October, viewing shorts. Or they can work within a
best-performing industries within the seasonality almanac shows some single group and go long the best
a sector. Next you could screen for excellent choices with great odds and performing and short the worst
which stocks perform best from those average performance (see Figure 4). performing. If you wanted to cover
best-performing industries. For example, LRCX has performance
For example, on the first Friday of of 7.42 % for the month. You can
October, Nextera Energy (NEE) has also see that some of the electric
This framework can
odds of 75 with average performance utility stocks like AEP and NEE apply to daily trading
of 1.03%. Edison International has are showcased with great average activity, swing trading,
odds of 87.5 with 1.05% average performance for the entire month. or investing.
performance. Traders can take a diversified
October 2021 • Technical Analysis of Stocks & Commodities • 61
Trading Perspectives
the best-performing 10 days of
October for utilities and be long and
short over those 10 days, this is what
two baskets (one long and one short)
could look like: 10 LONGS and 10
SHORTS (Figure 5).
One of the ways you can use IF-
THEN statements to enhance your
trading is by preparing ahead of
time and knowing in which sea-
sons the groups that are favored
to outperform and underperform.
Strategically looking for discount
just before a strong season can give
you an advantage and mean-reverting
potential. Likewise, a group at pre-
mium before an under­performing FIGURE 5: 10-DAY AVERAGE PERFORMANCE FOR BEST 10 DAYS OF OCTOBER FOR UTILITY
period can provide your shorts with STOCKS. If you wanted to cover the best-performing 10 days of October for utilities, this is what two
this same advantage. baskets (one long and one short) could look like: 10 longs and 10 shorts.
Figure 6 dis-
plays another
example from
the streak re-
port dashboard
from the close
of August 17
(being able to
plan for the next
day is a great
resource). We
like to find long
ideas and short
ideas that com- FIGURE 6: STOCKODDS DASHBOARD. Streak report on August 17, 2021.
bine to take the
market out of the equation Focus: Buying Bullish Reversals Focus: Shorting Bearish Reversals
as much as possible. The Results from August 18: August 18, 2021 Results from August 18:
streak report from August LYFT = 0.96% SPY = -1.09% VZ = -1.26%
17 provided some great UBER = -0.29% DIA = -1.05% MRK = -1.32%
trade ideas for August 18. CZR =  1.07% QQQ = -0.96% BIIB = -2.26%
WIX = 2.27% IWM = -0.87% ICLR = -0.49%
Focusing on the symbols OKTA = -0.74% AMGN = -1.89%
that streaked up provided
FIGURE 7: USING THE STREAK REPORT FOR NEXT-DAY TRADING IDEAS. Focusing on the symbols that
opportunity for mean re- streaked up provided opportunity for mean reversion or reversals back down, and stocks that had streaked down
version or reversals back provided opportunity for mean reversion or reversals back up.
down. Stocks that had
streaked down provided opportunity opportunities—present traders and gapping down substantially and senti-
for mean reversion or reversals back investors with an excellent frame- ment is sour, then you may choose
up (Figure 7). work. Remember, no matter what the to be defensive in consumer staples
When armed with seasonality for market throws at you, you can utilize and utilities, and hedge with SPY.
context, signals and subsequent per- the odds and average performance The methods I outlined here can be
formance—and qualifying premium approach daily for swing trades or a applied in a variety of ways.
or discount prior to performance longer-term approach. If the market is
62 • October 2021 • Technical Analysis of Stocks & Commodities
Subscribe Or Renew Today!
A subscription to Technical Analysis of  Stocks & Commodities magazine
gets you so much more than just a magazine:

• Full access to our Digital Edition


The complete magazine as a PDF
you can download.

• Full access to our Digital Archives


Every article since 1982!

• Complete access to Working Money


The information you need to invest
smartly and successfully.

• Access to Traders.com Advantage


Ideas, insights, evaluations, tips
and techniques that can help you
trade smarter.

8999
1 year.........................
$

2 years.................... 149
$ 99

3 years.................... 199
$ 99

Or try our best value subscription:

PROFESSIONAL TRADERS’ STARTER KIT


5-year subscription to S&C magazine that includes everything above
PLUS a free* book, Charting The Stock Market: The Wyckoff Method,
$
29999
all for a price that saves you $150 off the year-by-year price! only around
*Shipping & handling charges apply for foreign orders. $$
5 a month!

Visit www.Traders.com to find out more!


Email: [email protected] • Phone: 206-938-0570 facebook.com/STOCKSandCOMMODITIES @STOCKSandCOMM
ALWAYS KNOW WHEN TO SELL ANY STOCK

Maximize Your Profits and Limit Risk


Sell
Alert
2/18/21 That’s a

157%
$104.26

Profit
in only 4 months!
Purchase
Date
10/22/20
$40.60

ProfitLocker Pro is the Ultimate Trading Stop!


It eliminates emotion, stress and guesswork from your selling decisions.

Only ProfitLocker Pro will:


3 Automatically set stop-prices customized for each stock
in your portfolio
3 Monitor your stocks and alert you when it’s time to sell,
so you can take profits or cut losses
3 Display and track your stop on a chart

TRY PROFITLOCKER PRO FREE!


Visit: www.ProfitLockerPro.com/SC | Call: 1-888-658-7638

You might also like