Swing Trading With Three Indicators

The AIQ code based on Donald Pendergast’s article in the December 2013 issue of Stocks & Commodities, “Swing Trading With Three Indicators,” is provided at the following website: www.TradersEdgeSystems.com/traderstips.htm.

In addition to coding the author’s system as described in his article — which uses the following rules: buy to enter long and sell to exit the longs; short to enter shorts and cover to exit shorts — I created a second system that uses average true range to get the breakout amount. I also added some additional trend filters that use the NASDAQ 100 index.

All trading was simulated using closing prices to determine whether an entry/exit had occurred, and then the trades are entered/exited the next day at the open. My modified system uses rules to “BuyATR,” “SellATR,” “ShortATR,” and “CoverATR.” A comparison of equity curves is shown in Figure 7. In testing the short side, neither the author’s original system nor my modified system was able to produce profitable results, although my modified system has a smaller total loss than the author’s original system.

Image 1

FIGURE 7: AIQ, EQUITY CURVE. Here is a comparison of the equity curves for Donald Pendergast’s original system and my modified system trading the NASDAQ 100 list of stocks for the period 1/5/2000 to 10/9/2013.

The code and EDS file can be downloaded from www.TradersEdgeSystems.com/traderstips.htm.

!SWING TRADING WITH THREE INDICATORS
!Author: Donald Pendergast, TASC December 2013
!Coded by: Richard Denning 10/10/2013
!www.TradersEdgeSystems.com
!INPUTS:
emaLen is 50.
smaLen is 5.
breakAmt is 0.05.
atrLen is 10.
atrMult is 0.04.
H is [high].
L is [low].
C is [close].
C1 is valresult(C,1).
price is C.
emaLenLT is 200.
!UDFs:
maH is simpleavg(H,smaLen).
maL is simpleavg(L,smaLen).
ema is expavg(C,emaLen).
emaLT is expavg(C,emaLenLT).
TR is Max(H - L,max(abs(C1 - L),abs(C1- H))).
ATR is simpleavg(TR,atrLen).
ATRpct is simpleavg(TR/C,atrLen).
ndxC is tickerUDF("NDX",C).
emaNDX is tickerUDF("NDX",ema).
emaNDXlt is tickerUDF("NDX",emaLT).
!SYSTEM RULES:
!Author's system:
Buy if price > maH+breakAmt and C > ema.
Sell if price < maL.
Short if price < maL-breakAmt and C < ema.
Cover if price > maH.
!Modified system using average true range:
BuyATR if price > maH+atrMult*ATR and C > ema and ndxC < emaNDX and ndxC > emaNDXlt .
SellATR if price < maL-atrMult*ATR.
ShortATR if price < maL-atrMult*ATR and C < ema and ndxC > emaNDX.
CoverATR if price > maH+atrMult*ATR.
—Richard Denning
info@TradersEdgeSystems.com
for AIQ Systems

Reversing the MACD: The Sequel

In “Reversing MACD: The Sequel” in the November 2013 issue of Stocks and Commodities, author Johnny Dough presents functions that return price values for the MACD indicators. I am providing AIQ code for the following functions based on the AmiBroker code given in Dough’s article:

  • PMACDsignal returns price where the MACD crosses its signal line or where there is an MACD histogram cross of the zero line
  • PMACDlevel returns price where the MACD is equal to the level value
  • PMACDeq returns price where the MACD is equal to the previous bar MACD.

I created some additional rules to show reports that display the price values of the functions:

  • The ShowValues rule will display all function values for stocks that are over the minPrice level input
  • The NearXO rule will list only those stocks that are less than or equal to the average range percentage of crossing over of the MACD oscillator
  • The PMACxup rule lists cross-ups today on the MACD oscillator using the PMACDsignal price
  • The PMACxdn “if” rule lists cross-downs today on the MACD oscillator using the PMACDsignal price.

The NearXO report is useful if you want to enter a position on a buy or sell stop-on-close when the MACD oscillator crosses zero. This report sorts by the MACD oscillator. The ones with a positive MACD oscillator amounts calculate the price that would be used to go short at the close for a cross-down on the oscillator. The ones with negative MACD oscillator amounts calculate the price that would be used to go long at the close for a cross-up on the oscillator.

I ran the NearXO report on September 10, 2013 using the NASDAQ 100 list of stocks. There were 12 that showed up on the report, meaning they were near a cross-up or cross-down of the MACD oscillator.

In Figure 5, I show a chart of Qiagen NV (QGEN), which appeared on the report. The report showed that a next day’s close price of 20.72 or higher would cause the MACD oscillator to go from negative to positive. On September 11, 2013, QGEN closed at 20.98 and the MACD oscillator moves to a positive number.

Image 1

FIGURE 5: AIQ. Here’s a sample chart of QGEN with the MACD oscillator, looking for closing price (white line) and price to make a cross up or cross down on the oscillator (dark green line).

The AIQ code and EDS file can be downloaded from www.TradersEdgeSystems.com/traderstips.htm.

!REVERSING MACD: THE SEQUEL
!Author: Johnny Dough, TASC November 2013
!Coded by: Richard Denning 9/9/2013
!www.TradersEdgeSystems.com
!INPUTS:
price is [close].
period_X is 12.
period_Y is 25.
period_Z is 9.
level is 0.
minPrice is 10.
rangeFactor is 1.
!PMACDsignal returns price where MACD crosses signal line
!  or MACD histogram cross of 0:
alphaX is 2 / ( 1 + period_X ).
alphaY is 2 / ( 1 + period_Y ).
alphaZ is 2 / ( 1 + period_Z ).
One_alphaX is 1 – alphaX.
One_alphaY is 1 – alphaY.
One_alphaZ is 1 – alphaZ.
MACDvalue is expavg( price, period_X ) – expavg( price, period_Y ).
MACDvalue_1 is valresult(MACDvalue,1).
MACDsignal is expavg( MACDvalue, period_Z ).
PMACDsignal is ( MACDsignal – expavg( price, period_X ) * one_alphaX
+ expavg( price, period_Y ) * one_alphaY ) / ( alphaX – alphaY ).
!PMACDlevel returns price where MACD is equal to level value
! e.g. PMACDlevel(0, C, 12, 16) would return the series
!      where next price would make MACD=0
PMACDlevel is (Level + expavg( price, period_Y ) * one_alphaY
– expavg( price, period_X )* one_alphaX ) / ( alphaX – alphaY ).
!PMACDeq returns price where MACD is equal to previous bar MACD
PMACDeq is ( expavg( price, period_X ) * alphaX
– expavg( price, period_Y )* alphaY ) / ( alphaX – alphaY ).
!ADDITIONAL CODE NOT PROVIDED BY AUTHOR:
PMACDsignal_1 is valresult(PMACDsignal,1).    !PLOT-OFFSET BY ONE DAY
MACDosc_1 is val([MACD osc],1).              !Prior day’s MACD oscillator value
!RULES FOR GENERATING REPORTS:
PMACxup if price > PMACDsignal_1
and valrule(price <= PMACDsignal_1,1) and price > minPrice.
PMACxdn if price < PMACDsignal_1
and valrule(price >= PMACDsignal_1,1) and price > minPrice.
PMACDsigPct is (PMACDsignal / [close] – 1) * 100.
AvgRangePct is simpleavg(([high]/[low]-1)*100,200).
NearXO if price > minPrice and abs(PMACDsigPct) <= AvgRangePct*rangeFactor.
ShowValues if price > minPrice.
—Richard Denning
info@TradersEdgeSystems.com
for AIQ Systems

April 6, TIme Tested Trading Tips.

An Excerpt from the Timely Trades Letter.

The market has been in a tight trading range for two weeks.
When the market is in a tight range most stocks do not move much
if they hit their trigger points so as noted in previous Letters,
tight ranges like this are best left alone. Trying to force trades
when the market is in a tight range will generally just churn the
account. These tight ranges do not last long, and are often followed
by nice tradable moves. When the market moves out of the range, I
will be actively trading in the direction of the break.

When the market is resting in a narrow trading range, instead of
swing trading I spend some time reviewing lessons I have learned
during the last twenty years. Some of the important ones are:

• There is no magic to trading. It is about putting the odds on
your side and not trading unless they are. This sounds simple,
but it takes a few years to get good at it. And like most things,
while you are learning it is best to work with someone. The
learning time is long because traders have to see how things
behave in different markets, and learn to trade the odds and
not their feelings. Read this paragraph again.

• The market will not adapt to us, we must adapt to it. Swing
trading in a trading range environment presents higher than
average risk. Traders can compensate for higher risk market
conditions by trading fewer positions and using smaller position
sizes. Failure to do this can be costly.


* Successful traders adjust their trading style, trading system,
holding Period, and exit strategies based on the current market
conditions. This is a process I refer to as market adaptive
trading. It is better to Learn how to adapt to the market rather
than running from one trading idea to the next looking for the
next super system. Being frustrated that the market is not doing
not what you want often leads to losses. The market does what
it wants, we just need to adapt to it. This will take time to learn,
be patient. Read this paragraph again.

* As a trader I do not care which way the market moves, I can
make money either way. It is important to be able to quickly
react to whatever the market does and not be emotionally
attached to any particular choice.

* I cannot control what the market does, so I have a plan for
whichever path it picks and then trade the plan.

* Successful trading is not about predicting what the market is
going to do. It is about knowing how to react to whatever it
actually does.

* Always be thinking about taking and protecting profits.

* If you are not sure what to do, exit the position. There will be
other good setups.

* You do not need to trade every day. Let the setups come to you
and take the best ones. When the market is moving there lots
of good setups to trade. If there are few setups, or most are
failing, then listen to the message of the market.

* Do not rush in, there is plenty of time to get into a
tradable move when the market changes. If a trend
is worth trading, then by definition you do not have
to be in on the first day.

* Never enter a position without a plan for exiting.

* Do not count your chickens before they hatch. You do not
have a profit until you are back in cash.

* Never trade with money you cannot afford to lose.

* Trading is not a team sport. Stay away from chat rooms and
financial TV. Seek the truth, not support from others with
your point of view.

Steve Palmquist a full time trader who invests his own money in the market every day. He has shared trading techniques and systems at seminars across the country; presented at the Traders Expo, and published articles in Stocks & Commodities, Traders-Journal, The Opening Bell, and Working Money. Steve is the author of, “Money-Making Candlestick Patterns, Backtested for Proven Results’, in which he shares backtesting research on popular candlestick patterns and shows what actually works, and what does not. Steve is the publisher of the, ‘Timely Trades Letter’ in which he shares his market analysis and specific trading setups for stocks and ETFs. To receive a sample of the ‘Timely Trades Letter’ send an email to sample@daisydogger.com. Steve’s website:www.daisydogger.com provides additional trading information and market adaptive trading techniques. Steve teaches a weekly web seminar on specific trading techniques and market analysis through Power Trader Tools.


Terms of Use & Disclaimer:
This newsletter is a publication for the education of short term stock traders. The newsletter is an educational and information service only, and not intended to offer investment advice. The information provided herein is not to be construed as an offer or recommendation to buy or sell stocks of any kind. The newsletter selections are not to be a recommendation to buy or sell any stock, but to aid the investor in making an informed decision based on technical analysis. Readers should always check with their licensed financial advisor and their tax advisor to determine the suitability of any investment or trade. Trading stocks involves risk and you may lose part or all of your investment. Do not trade with money you cannot afford to lose. All readers should consult their registered investment advisor concerning the risks inherent in the stock market prior to investing in or trading any securities.

Trading Tips, March 22.

An Excerpt from the Timely Trades Letter.

Horizontal support and resistance levels should always be considered when selecting potential trades. Since stocks often consolidate, or bounce near support and resistance the distance between the entry point and support (for shorts) or resistance (for longs) is an important consideration when deciding whether or not to take a particular trade. I want to find trades with ‘room to run’ as the stock pulls back and approaches support.

Trading is based on being positioned to profit if the stock, or the market, does the usual thing in a given situation. Since stocks often bounce from support, candidates with a larger distance to support from the entry are more attractive because they have more ‘room to run. When a trading pattern occurs near support it may just drop to support and bounce, thereby limiting potential profits.

I also apply the same concepts of support, resistance, and accumulation to the market itself to determine if trading is appropriate. If I am trading shorts and the market is approaching support I become cautious. The reason is that the market often bounces or bases near support and thus shorts would be less attractive. When the market is clearly trending and well away from support I will use larger position sizes in my trades than when the market is approaching a support level. I cannot influence what the market does, but I can react to it and reduce my risks by taking smaller position sizes when the market is approaching a support level.

Someone usually asks the question, ‘yes, but what if the market had broken below support, would it not have been better to hold onto the short positions’?


I trade based on what the market usually does, not what I hope may
happen, or what sometimes happens. Since the market often bounces when retesting important lows I will stop taking new shorts and take profits on existing ones when the market approaches support. The market has two choices when it approaches support. It can bounce or it can break bellow. If the market bounces I will not incur potential losses from new shorts and will have the profits from the positions I closed. If the market breaks below support I will have the profits from the positions I closed and can easily take new positions to get back in the game. There is less risk in taking the profits when the market approaches support. It is tough to go broke taking profits. It is easy to go broke by holding on too long.


Things to do each evening:

Look at the price and volume action on the NASDAQ. Where are support and resistance levels? How is the volume on recent up and down days. Given the recent daily range, how many days would it take to reach support or resistance?

Look at each of your positions for the same information listed above. Where are your stops, and do they need to be adjusted? Do you have any stocks that are extended (consider profit taking) or ones that are breaking trend lines or support (consider exiting)?

Review your watch list of interesting patterns and make a list of the best set ups to take a look at tomorrow. Review the watch list for patterns that are no longer valid and delete those stocks from the

watch list.

Learning to trade with the Market is a key part of taking investment results to the next level. It’s harder than it sounds, and takes some experience. I haven’t met many traders who got the experience by paper trading, the pain of losing is what causes people to spend thetime and effort to review their trades and learn from the mistakes.Don’t just write off losses, learn from them, they are part of the tuition you pay to learn how to trade.


Learning to sell as the Market approaches resistance takes some practice, since after a nice run most people want to put more money in.

I generally place a protective stop immediately after entering the trade. The stop is normally under the previous day’s low, or the low of the pattern. Remember that the protective stop is just to keep you from having a bad loss. If you leave the stop at its initial protective value and use it as your only exit you will lose money. Generally set the initial protective stop at the point where the trade set up would be invalidated, then watch the behavior of the stock and the market to determine when to get out. I also make sure the stop is not at a round number, or something that ends in 5 since this is where most people place the stop. Instead of 23.00, I would place the stop at 22.95. Instead of 18.95, I would use 18.84.


Steve Palmquist a full time trader who invests his own
money in the market every day. He has shared trading
techniques and systems at seminars across the country;
presented at the Traders Expo, and published articles in
Stocks & Commodities, Traders-Journal, The Opening Bell,
and Working Money. Steve is the author of, “Money-Making Candlestick Patterns, Backtested for Proven Results’, in which he shares backtesting research on popular candlestick patterns and shows what actually works, and what does not. Steve is the publisher of the, ‘Timely Trades Letter’ in which he shares his market analysis and specific trading setups for stocks and ETFs. To receive a sample of the ‘Timely Trades Letter’ send an email to sample@daisydogger.com. Steve’s website:www.daisydogger.com provides additional trading information and market adaptive trading techniques. Steve teaches a weekly web seminar on specific trading techniques and market analysis through Power Trader Tools.


Terms of Use & Disclaimer:
This newsletter is a publication for the education of short
term stock traders. The newsletter is an educational and
information service only, and not intended to offer investment advice. The information provided herein is not to be construed as an offer or recommendation to buy or sell stocks of any kind. The newsletter selections are not to be a recommendation to buy or sell any stock, but to aid the investor in making an informed decision based on technical analysis. Readers should always check with their licensed financial advisor and their tax advisor to determine the suitability of any investment or trade. Trading stocks involves risk and you may lose part or all of your investment. Do not trade with money you cannot afford to lose. All readers should consult their registered investment advisor concerning the risks inherent in the stock market prior to
investing in or trading any securities.

en_GBEnglish
en_GBEnglish