Category Archives: back testing

System Development Using Artificial Intelligence

The AIQ code based on Domenico D’Errico and Giovanni Trombetta’s article in August 2017 Stock & Commodities issue, “System Development Using Artificial Intelligence,” is shown here. You can also download the EDS file from here

Are humans or computers better at trading? This question has been around on many fronts since the era of punch cards, and as technology advances, you question whether machines have limits. It’s the same with trading, and here’s an algorithm that may shed some light on which performs better…

!ARTIFICAL INTELLIGENCE FOR SYSTEM DEVELOPMENT
!Authors: Domenico D'Errico & Giovanni Trombetta, TASC August 2017
!Coded by: Richard Denning, 6/08/2017
!www.TradersEdgeSystems.com

!INPUTS:
O is [open].
C is [close].
H is [high].
L is [low].
exitBars is 8.
exitBarsP is 6.
enterGap is -0.08.

!CODE:
AvgP is (O+C+H+L)/4.
MedP is (H+L)/2.
MedB is (O+C)/2.

AvgP1 is valresult(AvgP,1).
AvgP2 is valresult(AvgP,2).
AvgP3 is valresult(AvgP,3).

MedP1 is valresult(MedP,1).
MedP2 is valresult(MedP,2).
MedP3 is valresult(MedP,3).
MedP4 is valresult(MedP,4).

MedB1 is valresult(MedB,1).
MedB2 is valresult(MedB,2).
MedB3 is valresult(MedB,3).
MedB4 is valresult(MedB,4).

!ENTRY & EXIT RULESl
Gandalf if 
  (AvgP1exitBars-1)
 or ({position days}>=exitBars-1)
 or ({position days}>=exitBarsP-1 and (C-{position entry price}>0)).

EntryPr is min(val([low],1) + enterGap,[open]).

Buy if Gandalf and [low] <= EntryPr.

See Figure 10 for how to set up the pricing in a backtest.
Sample Chart

FIGURE 10: AIQ. This shows the EDS backtest settings for entry pricing.
—Richard Denning
info@TradersEdgeSystems.com
for AIQ Systems

Detecting Swings

The AIQ code based on Domenico D’Errico’s article in the May 2017 issue of Stocks & Commodities issue, “Detecting Swings,” is provided here.

I tested the author’s four systems using the NASDAQ 100 list of stocks on weekly bars, as did the author, from 3/16/2005 through 3/14/2017. Figure 7 shows the comparative metrics of the four systems using the four-week exit. The results were quite different than the author’s, probably due to a different test portfolio and also a 10-year test period rather than the author’s 20-year period. In addition, my test results show longs only, whereas the author’s results are the average of both the longs and shorts.

Sample Chart

FIGURE 7: AIQ. As coded in EDS, this shows the metrics for the author’s four systems run on NASDAQ 100 stocks (weekly bar data) over the period 3/16/2005 to 3/14/2007.

The Bollinger Band (Buy2) system showed the worst results, whereas the author’s results showed the Bollinger Band system as the best. The pivot system (Buy1) showed the best results, whereas the author’s results showed the pivot system as the worst. I am not showing here the comparative test results for the Sell1 thru Sell4 rules, as all showed an average loss over this test period.

!DECTECTING SWINGS
!Author: Domenico D'Errico, TASC May 2017
!Coded by: Richard Denning, 3/15/17
!www.TradersEdgeSystems.com

!Set to WEEKLY in properties

Low is  [low].
Low1  is valresult(Low,1).
Low2  is valresult(Low,2). 
High is [high].
High1  is valresult(High,1).
High2  is valresult(High,2). 
PivotLow if Low1 &lt; Low2  and Low1 &lt; Low.
PivotHigh if High1 &gt; High2  and High1 &gt; High.

Buy1 if  PivotLow.  
Sell1 if  PivotHigh.    

!Set parameter for bollinger bands to 12 with 2 sigma (weekly) in charts:
Buy2 if [close] &gt; [Lower BB] and valrule([close] &lt;= [Lower BB],1).
Sell2 if [close] &lt; [Upper BB] and valrule([close] &gt;= [Upper BB],1).

!Set parameter for Wilder RSI to 5 (weekly) in charts:
Buy3 if [RSI Wilder] &gt; 40 and valrule([RSI Wilder] &lt;= 40,1).
Sell3 if [RSI Wilder] &lt; 60 and valrule([RSI Wilder] &gt;= 60,1).

Buy4 if [RSI Wilder] &lt; 40  And Low &gt; Low1.
Sell4 if [RSI Wilder] &gt; 60  And High &lt; High1.    

Exit if {position days} &gt;= 4.

The code and EDS file can be downloaded from http://aiqsystems.com/detectingswings.EDS

—Richard Denning

info@TradersEdgeSystems.com

for AIQ Systems

One Good Reason NOT to Pick a Bottom in DIS

A better title for this article might be “How to Avoid Losing 98% in Disney.”
The recent dip in the price of Disney stock may ultimately prove to be a buying opportunity.  But for reasons detailed below I am going to let this one pass.
If you have read my stuff in the past you know that I look a lot at seasonal trends.  This is especially true for sectors and commodities – which in some cases can be tied to recurring fundamental factors.  I have occasionally looked at individual stocks (here and here and here), but tend to think that an individual company’s fundamentals can change so drastically over time that a persistent seasonal trend is less likely.
It appears that there are exceptions to every rule.
In Figure 1 below we see that after a strong run up from its 2009 low, Disney finally topped out in August of 2015. Since that time it’s been a string of large moves up and down – with the latest being down. This might prompt one to consider the latest dip as a buying opportunity.  And in fact, maybe it is. But I won’t be making that play myself based simply on a seasonal trend in DIS stock that was highlighted by Brooke Thackray in his book Thackray’s 2017 Investor’s Guide.
0Figure 1 – Is latest dip in DIS a buying opportunity?  Maybe, but history suggests we look elsewhere….(Courtesy AIQ TradingExpert)
When NOT to Own Disney Stock
In his book, Thackray highlights the period from June 5th through the end of September as an “unfavorable” period for DIS stock.  He also listed a specific “favorable” period that I’ll not mention here.  For purposes of this article I made the following changes:
*The “unfavorable” period begins at the close on the 5th trading day of June and ends at the close on the last trading day of September.
*The rest of the year – i.e., end of September until the close on the 5th trading day of June – is considered the “favorable” period.
Also, the test uses price data only.  No dividends are included nor is any interest assumed to be earned while out of DIS stock.
The results are fairly striking.  From the end of 1971 through the end of 2016:
*$1,000 invested in DIS on a buy-and-hold basis grew +8,042% to $81,422 (average annual +/- = +15.8%)
*$1,000 invested in DIS only during the “favorable” period grew +430,874% to $4,309,735 (average annual +/- = +25.0%)
*$1,000 invested in DIS only during the “unfavorable” period declined -98% to $18.89 (average annual +/- = (-6.9%))
It’s sort of hard to ignore the difference between +430,784% and -98%.
Figure 1 displays the cumulative performance during the unfavorable period from 1971 through 2016.
1
Figure 1 – Growth of $1,000 invested in DIS only from close of June Trading Day #5 through the end of September (1971-2016)
Figure 2 displays the growth of $1,000 during the favorable period (blue line) versus a buy-and-hold approach (red line).
2
Figure 2 – Growth of $1,000 invested in DIS only from the end of September through June Trading Day #5 (blue) versus Buy-and-Hold (red); 1971-2016
*The favorable period showed a net gain in 39 out of 45 years (87%)
*The unfavorable period showed a net gain in only 13 out of 45 years (29%)
*Buy-and-hold showed a net gain in 28 out of 45 years (62%)
Figure 3 displays year-by-year results.
Year Favorable Unfavorable Buy/Hold
1972 78.1 (3.5) 71.9
1973 (53.5) (12.0) (59.1)
1974 4.4 (56.4) (54.4)
1975 175.6 (12.4) 141.5
1976 5.2 (6.9) (2.0)
1977 (28.2) 19.1 (14.4)
1978 4.6 (3.3) 1.2
1979 1.2 10.5 11.9
1980 20.8 (5.8) 13.8
1981 42.8 (28.7) 1.9
1982 16.0 4.4 21.1
1983 (5.7) (11.6) (16.7)
1984 25.6 (9.6) 13.6
1985 94.4 (3.3) 88.0
1986 98.3 (23.0) 52.8
1987 14.6 20.1 37.6
1988 4.2 6.5 10.9
1989 32.7 28.3 70.3
1990 28.4 (29.4) (9.3)
1991 14.4 (1.5) 12.8
1992 51.3 (0.7) 50.2
1993 16.0 (14.5) (0.8)
1994 23.2 (12.4) 7.9
1995 27.7 0.3 28.0
1996 18.4 0.0 18.4
1997 43.3 (0.9) 41.9
1998 36.9 (33.6) (9.1)
1999 15.8 (15.8) (2.5)
2000 4.0 (4.8) (1.1)
2001 23.6 (42.1) (28.4)
2002 12.6 (30.1) (21.3)
2003 50.9 (5.2) 43.0
2004 28.9 (7.6) 19.2
2005 (2.5) (11.6) (13.8)
2006 41.8 0.8 43.0
2007 (6.2) 0.4 (5.8)
2008 (24.4) (7.0) (29.7)
2009 29.1 10.1 42.1
2010 16.1 0.2 16.3
2011 30.4 (23.4) (0.0)
2012 15.9 14.6 32.8
2013 54.3 (0.6) 53.4
2014 17.2 5.2 23.3
2015 20.4 (7.3) 11.6
2016 5.0 (5.6) (0.8)
2017 ? ? ?
# Years UP 39 13 28
# Years DOWN 6 32 17
Average % +/- 25.0 (6.9) 15.8
Figure 3 – Year-by-Year Results
Summary
Brooke Thackray found an extremely interesting and robust “unfavorable” seasonal trend in DIS stock.  Of course none of the data above guarantees that DIS stock is doomed to languish and/or decline in the months ahead.  But I for one do not intend to “buck the odds” and play the long side of DIS for a while.
Jay Kaeppel  Chief Market Analyst at JayOnTheMarkets.com and AIQ TradingExpert Pro http://www.aiqsystems.com) client. 
Disclaimer:  The data presented herein were obtained from various third-party sources.  While I believe the data to be reliable, no representation is made as to, and no responsibility, warranty or liability is accepted for the accuracy or completeness of such information.  The information, opinions and ideas expressed herein are for informational and educational purposes only and do not constitute and should not be construed as investment advice, an advertisement or offering of investment advisory services, or an offer to sell or a solicitation to buy any security.

Detecting Swings

The AIQ code based on Domenico D’Errico’s article in the May 2017 issue of Stoks Commodities, “Detecting Swings,” is provided below.

I tested the author’s four systems using the NASDAQ 100 list of stocks on weekly bars, as did the author, from 3/16/2005 through 3/14/2017. Figure 7 shows the comparative metrics of the four systems using the four-week exit. The results were quite different than the author’s, probably due to a different test portfolio and also a 10-year test period rather than the author’s 20-year period. In addition, my test results show longs only, whereas the author’s results are the average of both the longs and shorts.

Sample Chart
 
FIGURE 7: AIQ. As coded in EDS, this shows the metrics for the author’s four systems run on NASDAQ 100 stocks (weekly bar data) over the period 3/16/2005 to 3/14/2007.

The Bollinger Band (Buy2) system showed the worst results, whereas the author’s results showed the Bollinger Band system as the best. The pivot system (Buy1) showed the best results, whereas the author’s results showed the pivot system as the worst. I am not showing here the comparative test results for the Sell1 thru Sell4 rules, as all showed an average loss over this test period.

!DECTECTING SWINGS
!Author: Domenico D'Errico, TASC May 2017
!Coded by: Richard Denning, 3/15/17
!www.TradersEdgeSystems.com

!Set to WEEKLY in properties

Low is  [low].
Low1  is valresult(Low,1).
Low2  is valresult(Low,2). 
High is [high].
High1  is valresult(High,1).
High2  is valresult(High,2). 
PivotLow if Low1 < Low2  and Low1 < Low.
PivotHigh if High1 > High2  and High1 > High.

Buy1 if  PivotLow.  
Sell1 if  PivotHigh.    

!Set parameter for bollinger bands to 12 with 2 sigma (weekly) in charts:
Buy2 if [close] > [Lower BB] and valrule([close] <= [Lower BB],1).
Sell2 if [close] < [Upper BB] and valrule([close] >= [Upper BB],1).

!Set parameter for Wilder RSI to 5 (weekly) in charts:
Buy3 if [RSI Wilder] > 40 and valrule([RSI Wilder] <= 40,1).
Sell3 if [RSI Wilder] < 60 and valrule([RSI Wilder] >= 60,1).

Buy4 if [RSI Wilder] < 40  And Low > Low1.
Sell4 if [RSI Wilder] > 60  And High < High1.    

Exit if {position days} >= 4.
—Richard Denning
info@TradersEdgeSystems.com
for AIQ Systems
Editor note: The code and EDS file can be downloaded from http://aiqsystems.com/Detecting_Swings_TASC_May_2017.EDS

Exponential Standard Deviation Bands

The AIQ code based on Vitali Apirine’s article in the 2017 issue of Stocks & Commodities magazine, “Exponential Standard Deviation Bands”

Editor note: “Author Vitali Apirine presented a method intended to help traders see volatility while a stock is trending. These bands, while similar to Bollinger Bands, are calculated using exponential moving averages rather than simple moving averages. Like Bollinger Bands, they widen when volatility increases and narrow as volatility decreases. He suggests that the indicator can be used as a confirming indication along with other indicators such as the ADX. Here’s an AIQ Chart with the Upper, Lower and Middle Exponential SD added as custom indicators.”

 

 

To compare the exponential bands to Bollinger Bands, I created a trend-following trading system that trades long only according to the following rules:
  1. Buy when there is an uptrend and the close crosses over the upper band. An uptrend is in place when the middle band is higher than it was one bar ago.
  2. Sell when the low is less than the lower band.
Figure 8 shows the summary test results for taking all signals from the Bollinger Band system run on NASDAQ 100 stocks over the period 12/9/2000 to 12/09/2016. Figure 9 shows the summary test results for taking all signals from the exponential band system on NASDAQ 100 stocks over the same period. The exponential band system improved the average profit per trade while reducing the total number of trades.

Sample Chart

FIGURE 8: AIQ. Here are summary test results for taking all signals from the Bollinger Band system run on NASDAQ 100 stocks over the period 12/9/2000 to 12/09/2016.

Sample Chart

FIGURE 9: AIQ. Here are summary test results for taking all signals from the exponential band system run on NASDAQ 100 stocks over the period 12/9/2000 to 12/09/2016.
The EDS file can be downloaded from http://aiqsystems.com/EDS/Exponential_Standard_Deviation_Bands.EDS 
and is also shown here:
!Exponential Standard Deviation Bands
!Author: Vitali Apirine, TASC February 2017
!Coded by: Richard Denning 12/11/2016
!www.TradersEdgeSystems.com!INPUT:
xlen is 20.
numSD is 2.

!INDICATOR CODE:
ExpAvg is expavg([close],xlen).
Dev is [close] – ExpAvg.
DevSqr is Dev*Dev.
SumSqr is sum(DevSqr,xlen).
AvgSumSqr is SumSqr / xlen.
ExpSD is sqrt(AvgSumSqr).

!UPPER EXPONENTIAL SD BAND:
UpExpSD is ExpAvg + numSD*ExpSD.  !PLOT ON CHART

!LOWER EXPONENTIAL SD BAND:
DnExpSD is ExpAvg – numSD*ExpSD.   !PLOT ON CHART

!MIDDLE EXPONENTIAL SD BAND:
MidExpSD is ExpAvg.

!BOLLINGER BANDS FOR COMPARISON:
DnBB is [Lower BB].  !Lower Bollinger Band
UpBB is [Upper BB].  !Upper Bollinger Band
MidBB is simpleavg([close],xlen). !Middle Bollinger Band
!REPORT RULE TO DISPLAY VALUES:
ShowValures if 1.

!TRADING SYSTEM USING EXPPONENTIAL SD BANDS:
UpTrend if MidExpSD > valresult(MidExpSD,1).
BreakUp if [close] > UpExpSD.
BuyExpSD if UpTrend and BreakUp and valrule(Breakup=0,1).
ExitExpSD if [Low] < DnExpSD.  ! or UpTrend=0.

!TRADING SYSTEM USING BOLLINGER BANDS:
UpTrendBB if MidBB > valresult(MidBB,1).
BreakUpBB if [close] > UpBB.
BuyBB if UpTrendBB and BreakUpBB and valrule(BreakupBB=0,1).
ExitBB if [Low] < DnBB.  ! or UpTrend=0.

—Richard Denning
info@TradersEdgeSystems.com
for AIQ Systems

MatchMaking a seasonal Energy play

If you follow jay Kaeppel’s posts in this blog, you’ll know that he’s the master of research on all things seasonal. This past week he posted a seasonal article on energy using FSESX – Fidelity Select Energy Services. Previously he had noted the bullish tendency for ticker FSESX during the months of February, March and April.  In his follow up piece, he added one more “favorable” month and then also looked at a 6-month “unfavorable” period. The article is included at the end of this post so you can see the results.

As Mutual funds are not for everyone, we went in search of alternative tickers that could closely match FSESX in performance characteristics. Using AIQ Matchmaker we compared the price action of FSESX against our universe of stocks and ETFs looking for a match.

Matchmaker uses Spearman Rank Correlation analysis to identify a close match to FSESX. The closer the result to 1000, the higher the correlation. Anything over 950 is a very close match. Here’s the results.
Figure 1. MatchMaker correlation for last 4 years – FSESX vs stocks and ETFs
The ETF IEZ – iShares Oil and Equipment & Services showed a very high correlation over the 4 years we tested. OIH – Oil Service Holders, another ETF, also showed high correlation.
Here’s an AIQ overlay chart of recent daily price action comparing FSESX vs IEZ.
 
Figure 2. Recent daily price action comparing FSESX vs IEZ.
IEZ appears to be a good surrogate for FSESX at least over the last 4 years.
We also wanted a visual of the seasonal pattern in action. Fortunately we have a tool still in development at AIQ that’s just right for this. Basically it provides a price comparison of ‘x’ numbers of years of the same ticker overlaid on each other.
Here’s 3 of the last 4 years on IEZ, the average of the years displayed is in black. We highlighted the Feb, Mar, Apr and Dec in yellow. We could have included more years but for illustration purposes it was easier to show the 3 years (the chart gets busy with too many lines on it!)
 
Figure 3 – IEZ seasonal chart (beta) for 3 years with average.
The Feb, Mar, Apr period has a definite bullish tendency, the Dec period does Ok too. You’ll notice the tendency for IEZ to fall sharply in January. Conclusion? IEZ is a reasonable surrogate for FSESX if you’re contemplating this seasonal move.
_________________________________________________________
The article this follow up is based upon is by Jay Kaeppel and is included below. Jay is Chief Market Analyst at JayOnTheMarkets.com and AIQ TradingExpert Pro client. http://jayonthemarkets.com/

When to Feel ‘Energetic’ (or NOT)

If you are looking for a market sector with some serious seasonal trends, look no further than the energy sector. Previously I had noted the bullish tendency for ticker FSESX during the months of February, March and April.  In this piece, we will add one more “favorable” month and then also look at a 6-month “unfavorable” period.
For the record, the information that follows is not being recommended as a standalone strategy.  It is presented simply to make you aware of certain long-term trends that have been very persistently bullish (or bearish as the case may be) in the energy sector.
4 Favorable Months
*The four “favorable” months for our test are February, March, April and December
Figure 1 displays the growth of $1,000 invested in ticker FSESX only during these four months every year since 1986 versus simply buying-and-holding ticker FSESX.
1
Figure 1 – Growth of $1,000 invested in FSESX only during Feb, Mar, Apr, Dec every year since 1986
Starting in 1986, an initial $1,000 investment grew to $76,019 (or +7,500%) versus $10,237 (or 923%) using a buy-and-hold strategy.
6 Unfavorable Months
The six “Unfavorable” months are June, July, August, September, October and November.
First the “positive” news:
*This 6-month period has managed to show a gain 14 times in 31 years – so by no means should you consider this period a “sure thing” loser
*During 4 separate years – 1997, 2003, 2004 and 2010 – the “unfavorable” months registered a cumulative gain in excess of +30%.
Doesn’t sound all that “unfavorable” so far does it?  But here’s the catch: Despite the occasional 30%or more gain, it is fair to refer to this 6-month period as “unfavorable” as the cumulative long-term results of buying and holding FSESX during these months has been nothing short of devastating.
Figure 2 displays the growth of $1,000 invested in ticker FSESX only between the end of May and the end of November every year starting in 1986.
3
Figure 2 – Growth of $1,000 invested in FSESX only during June through November every year since 1986
Starting in 1986, an initial $1,000 investment declined to just $82, or a cumulative loss of -91.8%
Figure 3 displays some comparative data between favorable and unfavorable periods as well as using a Buy-and-Hold strategy.
Measure Buy-and-Hold 4 Favorable Months 6 Unfavorable Months
Average Annual % +(-) 12.8 16.5 (-4.2)
Median Annual % +(-) 8.7 15.5 (-1.8)
Standard Deviation 33.4 20.1 24.6
# Years UP 18 26 14
# Years DOWN 13 5 17
Worst Year (-55.4) 2008 (-7.6) 1994 (-62.8) 2008
$1,000 becomes $10,237 $76,019 $82
Cumulative % +(-) +923% +7,500% (-92%)
Figure 3 – Comparative Results
Figure 4 displays the year-to-year results for a Buy-and-Hold approach versus holding only during the 4 “favorable” months or the “Unfavorable” 6 months.
Year All 12 months % +(-) 4 Favorable % +(-) 6 Unfavorable % +(-)
1986 (8.9) (5.2) (9.2)
1987 (20.7) 22.9 (40.1)
1988 (4.2) 22.8 (16.3)
1989 50.3 27.1 16.2
1990 8.7 4.9 (11.2)
1991 (19.9) 4.1 (25.0)
1992 4.9 (1.6) (1.3)
1993 16.4 24.5 (10.7)
1994 (0.5) (7.6) 3.1
1995 40.0 33.7 2.0
1996 45.9 22.5 20.8
1997 43.9 (4.9) 32.9
1998 (41.4) 26.5 (50.5)
1999 80.9 74.1 7.5
2000 51.7 77.6 (21.1)
2001 (22.4) 20.8 (32.4)
2002 2.2 26.2 (18.0)
2003 13.1 15.5 (16.0)
2004 26.2 1.2 30.2
2005 47.4 4.8 34.0
2006 (9.1) (4.1) (1.8)
2007 58.3 25.6 16.7
2008 (55.4) 10.5 (62.8)
2009 60.4 24.5 9.6
2010 31.7 21.6 33.7
2011 (18.5) 3.1 (16.8)
2012 (3.9) 0.7 9.6
2013 14.1 0.3 11.5
2014 (19.5) 7.2 (26.7)
2015 (19.7) 2.9 (17.9)
2016 44.2 28.4 20.1
Figure 4 – Yearly % +(-) for Buy-and-Hold versus 4 Favorable Months versus 6 Unfavorable Months
Summary
There is no guarantee from year-to-year results of buying and holding ticker FSESX during the “Favorable 4” months will show a gain and/or outperform the “Unfavorable 6” months. And there is by no means any guarantee that the “Unfavorable 6” will show a loss during any given year (note that 2016 saw the Unfavorable 6 generate a cumulative gain of +20.1%!).  So just remember that we are talking about some very long-term  trends here.
Still, most investors can discern the difference between:
*Favorable 4 months gain = +7,500%
*Unfavorable 6 months loss = (-92%)
This type of difference is what we “quantitative types” refer to as “statistically significant.”

Back to Basics with MACD (Part 2)

In this article I detailed one relatively “simple” approach to using the MACD indicator to identify potentially bullish opportunities.  In this piece we will look at one to actually put those signals to use.
The Limited Risk Call Option
One possibility upon generating a bullish signal as described in the last article is to buy shares of the stock/ETF/index/etc in question.  Not a thing wrong with that.  But there is a less expensive alternative.
Figure 1 reproduces Figure 1 from the last piece showing ticker XLF.  Let’s look at the signal generated on 2/12/16.
1Figure 1 – Ticker XLF (Courtesy AIQ TradingExpert)
One alternative that I like is to use the “Percent to Double” routine at www.OptionsAnalysis.com to find an inexpensive call option that has lot of upside potential.  The input screen with a few key input selections highlighted appears in Figure 1a (if it looks intimidating please note that a reusable set of criteria can be captured in a “Saved Wizard”, which appear towards the lower right of of Figure 1a.  Once a set of criteria is saved it can be reused by simply clicking on the Wizard name and clicking “Load”.)
NOTE: My own personal preference is to consider options that have at least 45 days left until expiration (as time decay can become a very negative factor as option expiration draws closer).

1a

Figure 1a – Percent to Double Inputs (Courtesy www.OptionsAnalysis.com)

Figure 1b displays the output screen.
NOTE: For my own purposes I like to see a Delta of at least 40 for the option I might consider buying (nothing “scientific” here.  It is just that the lower the Delta the further out-of-the-money the option strike price is. I prefer to buy a strike price that is not too far from the current price of the stock; hence I look for a Delta of 40 or higher).  With XLF trading at $20.49, in Figure 1b I have highlighted the 2nd choice on the list – the April 21 call – which has a delta of 43.1bFigure 1b – Percent to Double Output (Courtesy www.OptionsAnalysis.com)
So a trader now has two alternatives:
*Buy 2 Apr 21 strike price XLF calls for $70 apiece ($140 total cost; 86 total deltas)
*Buy 86 shares of XLF at $20.49 apiece ($1,760 total cost, 86 total deltas)
Figure 1c displays the particulars for buying a 2-lot of the April 21 call for a total cost of $140.1cFigure 1c – XLF Apr 21 call (Courtesy www.OptionsAnalysis.com)
By 3/18 the shares had gained 11% and the Apr 21 call had gained 143%.  See Figure 1d.1dFigure 1d – XLF Apr 21 call (Courtesy www.OptionsAnalysis.com)
Summary
Obviously not every trade works out as well as this one.  Still, the key things to remember are:
*The option trade cost $140 instead of $1760
*The worst case scenario was a loss of $140.
Something to think about.
Chief Market Analyst at JayOnTheMarkets.com and TradingExpert Pro client

Back to Basics with MACD

One danger of getting “way to into” the financial markets is that you can find yourself progressing into some needlessly complicated stuff (“Hi, my name is Jay”).  I mean it is only natural to wonder “hey, what if I divided this indicator value by that indicator value” and such.  But once you start finding yourself taking an exponential moving average of a regression line with a variable lag time, well, you can find yourself “a tad far afield.”  (Trust me on this one).  Which leads us directly to:
Jay’sTradingMaxim #44: Every once in awhile it pays to remember that the end goal is simply to make money.  The more easily the better.
So today let’s go back to a simple “basic approach.”
The Bullish MACD Divergence
We will define an “asset” as any stock, ETF, commodity, index, etc. that can be traded on an exchange (and for my purposes, there should be a liquid market for options on that asset).
Step 1. An asset price falls to a new 20-day low and the MACD value is less than 0.  Note the MACD value on this date.
Step 2. Not less than one week but not more than 2 months later:
*Price closes below its closing level in Step 1
*The MACD indicator is above its level at the time of Step 1
Step 3. The next time the daily MACD indicator “ticks higher” a buy alert is triggered
Can it really be that simple?  The Good News is “Yes, it can.”  The Bad News is that “It isn’t always.”  To put it another way, like a lot of trading methods it can generate a surprising abundance of useful trading signals.  However, there is no guarantee that any given signal will turn out to be timely.  In other words:
This method gives you a good guideline for when to get in, but:
*It may be early at times (i.e., price will move lower still before advancing)
*It will at times be flat out wrong
*You still have to decide when to exit the bullish position.
*Call options are useful with this approach as it allows you to risk a limited amount of capital.
Examples
Figures 1 through 4 highlight some recent examples using this method.  Note that the charts show only entry points.  Exit points are “a separate topic”.
1
Figure 1 – Ticker XLF (Courtesy TradingExpert Pro)
2
Figure 2 – Ticker WMT (Courtesy TradingExpert)
3
Figure 3 – Ticker AAPL (Courtesy TradingExpert)
4
Figure 4 – Ticker GDX (Courtesy TradingExpert)
As you can see, some signals were quite timely while others were quite early.  For the record, I started getting bullish on gold and gold stocks early in 2016 based in part on the multiple alerts that appear in Figure 4.
Chief Market Analyst at JayOnTheMarkets.com and TradingExpert Pro client

ADX Breakouts

The AIQ code based on Ken Calhoun’s article in the March 2016 issue of Stocks and Commodities, “ADX Breakouts,” is provided at www.TradersEdgeSystems.com/traderstips.htm.
Since I mainly work with daily bar strategies, I wanted to test the ADX concept from the article on a daily bar trading system. So I set up a system that buys after a stock has based around the 200-day simple moving average (Basing200). Basing200 is coded in the system as:
  • The stock closing above the 200-SMA only 19 bars or less out of the last 100 bars, and
  • The stock closing greater than two bars above the 200-SMA in the last 10 bars.
For exits, I used the following built-in exits: a capital-protect exit set at 80% and a profit-protect exit set at 80% once profit reaches 5% or more.
I ran this system on the NASDAQ 100 list of stocks in the EDS backtester over the period 12/31/1999 to 1/11/2016. I then ran a second test on the system using the ADX filter (ADX must be greater than 40 at the time of the signal to buy). I used the same list of stocks, exits, and test period.
Figure 8 shows the first test without the filter: 883 trades, 1.84% average profit per trade, 1.51 reward/risk. Figure 9 shows the second test with the filter: 151 trades, 2.12% average profit per trade, 1.66 reward/risk.
Sample Chart
FIGURE 8: AIQ, WITHOUT FILTER. Here are the EDS test results for the example system without the ADX filter.
Sample Chart
FIGURE 9: AIQ, WITH FILTER. Here are the EDS test results for the example system with the ADX filter.
Although all of the key metrics are better with the filter, there is a significant reduction in the number of trades. In fact, 151 trades would not be sufficient for a trading system over this long test period. If one wanted to use the filter, then the list of stocks would need to be increased to about 2,000 stocks.
!ADX BREAKOUTS
!Author: Ken Calhoun, TASC March 2016
!Coded by: Richard Denning, 1/11/2016
!www.TradersEdgeSystems.com

!NOTE; THIS SAMPLE SYSTEM IS FOR 
           !DAILY BAR TESTING OF ADX FILTER ONLY

SMA200 is simpleavg([close],200).
HD is hasdatafor(250).
Above200 if ( [close] > SMA200 ) .
Basing200 if CountOf(Above200,10) >2
 and CountOf(Above200,100) 200. 
ADXhi if [ADX] >= 40.
BuyADX if Buy and ADXhi.
This code and EDS file can be downloaded from www.TradersEdgeSystems.com/traderstips.htm.
—Richard Denning
info@TradersEdgeSystems.com
for AIQ Systems