All posts by admin

A Seasonal Strategy With Leveraged ETFs

The AIQ code and EDS file for Gerald Gardner’s article in October 2012 Stocks and Commodities, “A Seasonal Strategy With Leveraged ETFs,” is provided at the following website: www.TradersEdgeSystems.com/traderstips.htm.

To test Gardner’s seasonal system with the leveraged exchanged traded funds (ETFs) DBC and DDM using AIQ’s Portfolio Manager, a trading simulation was run with the following capitalization and cost settings:

  • Maximum of two open positions
  • Size each position at 50 % of mark-to-market total capital
  • Take no more than two new positions per day
  • Compute the mark-to-market capital each day
  • Three cents per share was deducted for each round turn trade.

In Figure 7, I show the resulting statistics and equity curve compared to the S&P 500 index (SPX). For the period 9/1/2006 to 8/13/2012, the system returned an average internal rate of return of 13.7% with a maximum drawdown of 32% on 3/5/2009. These statistics differ from the author’s due to my test starting earlier, and also, I picked up three trades that the author did not show in his list of trades with returns of -15.4%, -8.0%, and 1.0%. These differences may be due to differences in our data. In my test, there were only 12 trades and I would like to see more trades before I would rely on this as a trading strategy. This is the problem with testing systems on ETFs — there is not enough data.

Image 1
FIGURE 7: AIQ, EQUITY CURVE. Here is the equity curve for my test system that uses the seasonal system for the period 9/1/2006 to 8/13/2012. Only the ETFs DBC and DDM were traded on each signal
 
 
! SEASONAL STRATEGY WITH LEVERAGED ETFs
! Author: Gerald Gardner
! Coded by: Richard Denning 8/14/12
! www.TradersEdgeSystems.com

! ABBREVIATIONS:
C is [close].
C1 is valresult(C,1).
O is [open].
H is [high].
H1 is valresult(H,1).
L is [low].
L1 is valresult(L,1).
V is [volume].
PEP is {position entry price}.
PD is {position days}.
OSD is offsettodate(month(),day(),year()).

! UDFs AND RULES FOR STRATEGY:
SMA50 is simpleavg(C,50).
OK_BUY  if (month() >= 1 and month() <= 4)
or (month() >= 10 and month() <=12).
BUY if OK_BUY and C > SMA50.
SELL if month() = 5.

 
—Richard Denning

info@TradersEdgeSystems.com

This email address is being protected from spambots. You need JavaScript enabled to view it.

for AIQ Systems

Market Log 9-18-2012 some signs of topping

The last market Expert Rating 10 days ago was 98-2. WAL (Weighted Action List) and the US (Unconfirmed SIgnals) show a different picture. The WAL analyzes all the high up and down Expert Ratings on the S&P500 that have been confirmed by an independent indicator, in this case the Phase (MACD based). For the 500 stocks analyzed, 24% have ratings to the upside and 76% to downside.

Interstingly the US shows a similar picture 18% have ratings to the upside and 82% to downside. The US is a raw picture of the percenatge of stocks in S&P500 with unconfirmed up vs down high Expert Ratings. Past analysis has shown this US balance is an early indication of a possible change when the balance reaches 15-85 or 85-15.

Emerging Chart Patterns 9-17-2012

Couple of chart patterns appeared in the Chart Pattern EDS report for 9-17-2012.

FEIC emerging pennant

FEIC had a sharp move up at the beginning of August and has since been forming a pennant pattern. The clarity, quality and initial trend for the pattern are very good. The length of the pennant part of the pattern is getting a little long in the tooth but still could resolve. Usually pennants are completed with a breakout to the upside through the upper trendline followed by an increase in volume.

TTMI merging ascending triangle

TTMI has a nice ascending triangle forming, the stock closed at 10.7 today and is still within the triangle. Diminishing volume is typical of this pattern. Breakout occurs usually to the upside through the horizontal trendline and needs to happen with good volume.

More information on Chart Pattern Recognition in TradingExpert Pro can be found at http://www.aiqsystems.com/chartpatterns.htm

Developing A Multilevel Strategy

The AIQ code for Vladimir Vladimirovich Voznjuk’s article in this issue, “Developing A Multilevel Strategy,” is provided at www.TradersEdgeSystems.com/traderstips.htm, and is shown below.

Although AIQ software can chart and test forex data, testing stocks is more interesting. Using the author’s concept of trading using multiple instruments to generate signals, I designed a system that uses both the group index for a stock and the SPX. The multi-instrument indicator that I designed uses the 20-day rate of change in price for the stock and its related group, which is then smoothed by a simple average over 20 days. I then take a ratio of the stock’s smoothed rate of change to its related group’s smoothed rate of change. Finally, I take a stochastic of this ratio (“StoMSG”). The system goes long when the stock, group, and SPX index are in uptrends as measured by the direction of their 50-day simple moving average (higher than it was 10 days ago) and in addition, for the stock and group, the 20-day rate of change is greater than zero. Buy when the trend is up (as defined here) and the StoMSG is less than or equal to 10. Exit longs when one of the following is met: the position has been held for 20 days, or the StoMSG is greater than or equal to 90, or the simple average of the SPX close is less than its value 10 days ago.

To test the multimarket group stock system using the Portfolio Manager for the period 1/1/1999 to 7/18/2012, a trading simulation was run with the following capitalization settings:

 – Maximum of 10 open positions
 – Size each position at 10% of mark-to-market total capital
  – Take no more than 10 new positions per day
  – Compute the mark-to-market capital each day
  – Choose signals based on a relative strength indicator for ranking in descending order for longs (long-only system)

In Figure 1, I show the resulting statistics and equity curve compared to the SPX. The test was run using the S&P 500 group/section structure that can be downloaded from the AIQ website for the period 1/1/1999 to 7/18/2012. AIQ allows for the creation of custom group and sector structures and also has two structures, the S&P 500 and the AIQALL. The S&P 500 groups contain just the stocks in the S&P 500, while the AIQALL groups have most of the stocks that can be traded.

FIGURE 1: AIQ, MULTI-INSTRUMENT TEST SYSTEM. Here is an equity curve for my test system that uses the multi-instrument concept for the period 1/1/1999 to 7/18/2012. The S&P 500 group/sector structure was used for the secondary instruments and the S&P 500 stocks were traded.
 
!DEVELOPING A MULTI-LEVEL STRATEGY
!Author: Vladimir Voznjuk, TASC Sept 2012
!Coded by: Richard Denning 7/16/2012
!www.TradersEdgeSystems.com

! ABBREVIATIONS:
C is [close].
Cx is valresult(C,20).
O is [open].
avgV is simpleavg([volume],50).
PEP is {position entry price}.
PD is {position days}.
Name is description().
Group is tickerUDF(rsTicker(),name).
GrpSym is tickerUDF(rsTicker(),symbol()).
GrpO is tickerUDF(rsTicker(),O).
GrpC is tickerUDF(rsTicker(),C).
GrpCx is valresult(GrpC,20).

!UDFs FOR INDICATOR & SYSTEM:
StkCOPct is simpleavg((C – Cx ) / Cx * 100,20).
GrpCOPct is simpleavg((GrpC – GrpCx) / GrpCx * 100,20).
MA50 is simpleavg(C,50).
GrpMA50  is simpleavg(GrpC,50).
SPXma50  is tickerUDF(“SPX”,MA50).
MSG is StkCOPct / GrpCOPct.

!PLOT THE FOLLOWING WITH 90 & 10 LINES:
StoMSG is (MSG – lowresult(MSG,60)) /
(highresult(MSG,60) – lowresult(MSG,60)) * 100.

!REPORT TO LIST VALUES FOR A SINGLE DAY:
ShowValues if StkCOPct > 0
and MA50 > valresult(MA50,10)
and GrpCOPct > 0
and GrpMA50 > valresult(GrpMA50,10)
and C > 10 and avgV > 3000.

!TRADING SYSTEM RULES:
Buy if StoMSG <= 10
and StkCOPct > 0
and MA50 > valresult(MA50,10)
and GrpCOPct > 0
and GrpMA50 > valresult(GrpMA50,10)
and C > 0 and avgV > 3000
and SPXma50 > valresult(SPXma50,10).
ExitBuy if StoMSG >= 90
or PD >= 20
or SPXma50 < valresult(SPXma50,10).

!FOR RANKING SIGNALS FOR TRADING SIMULATION
!  IN PORTFOLIO MANAGER:
!AIQ RELATIVE STRENGTH:
Price1 is C.
Price2 is O.
MTL is 30.
Q3m is MTL / 4.
Q2m is (MTL – Q3m) / 3.
Q1m is (MTL – Q2m – Q3m) / 2.
Q0m is MTL – Q1m – Q2m – Q3m.
ROCq3m is (valresult(price1,Q2m,(Q1m+Q0m)) /
valresult(price2,Q3m,(Q2m+Q1m+Q0m)) – 1) * 100.
ROCq2m is (valresult(price1,Q1m,Q0m) /
valresult(price2,Q2m,(Q1m+Q0m)) – 1) * 100.
ROCq1m is (valresult(price1,Q0m,0)  /
valresult(price2,Q1m,Q0m) -1 ) * 100.
ROCq0m is (price1 / valresult(price2,Q0m,0) – 1) * 100.
RS_AIQ is ROCq0m * 0.40 + ROCq1m * 0.20
+ ROCq2m * 0.20 + ROCq3m * 0.20. 

AIQ, SECTOR ROTATION MODEL (SRM) INDICATOR

The AIQ code based on Giorgos Siligardos’ article in this issue, “Applying The Sector Rotation Model,” in July 2012 Stocks & Commodities is provided at the following website: www.TradersEdgeSystems.com/traderstips.htm.

Siligardos’ approach relies on sector ETFs. Since sector ETFs have limited price history, I searched for similar sector representations that would have more history. I found that there are S&P 500 sector indexes that start on 9/11/1989 and thus have almost 23 years of history.

In the table in Figure 6, I show the symbols for the sector representations for the three data services DialData from Track Data, Yahoo! from yahoo.com, and PremiumData from Norgate. The first column of the table shows the ETF symbol. The second column shows the AIQALL (a group/sector list structure) sector symbols. You could code the sector rotation indicator using the program-computed sectors as shown, but the results will vary from user to user because the sector values depend on the stocks that are in the user’s database.

Image 6
FIGURE 6: AIQ, SECTORS. Here are the symbols for the sector representations for the three data services DialData, Yahoo, and PremiumData from Norgate.

Since I couldn’t find symbols for some of the sectors at DialData and Yahoo, I decided to use the sector indexes from Norgate (shown in bold in Figure 6). AIQ can use data from any source by using the data transfer utility to import the data from ASCII text files. In the code file I provide, there is an input that allows you to switch between the ETF data symbols and the indexes (useIDX=0 for ETFs and useIDX=1 for indexes).

Please note that I changed the Norgate symbols upon import to remove the “$” as I wasn’t sure this symbol would be allowed as a ticker symbol. So the symbol “$SPXA” from Norgate is changed to “SPXA,” and so on. I have also provided extra code for the other sectors that are not used by the author in case you want to try using different sector combinations in the bull-bear indicator.

Since Siligardos does not provide a mechanical trading system that uses the indicator, I devised one that uses two moving averages of the bull-bear indicator: one set at 50 bars and the other set at 200 bars. Entries to go long occur when the fast average crosses over the slower average. I exit on cross downs or whenever the SPX 50-bar average is lower than it was 10 bars ago.

Since this is mainly a market timing device, I then tried trading the NASDAQ 100 list of stocks using the Portfolio Manager for the period 1/1/1992 to 6/12/2012. The following capitalization settings were used:

  • Maximum of 10 open positions
  • Size each position at 10% of mark-to-market total capital
  • Take no more than 10 new positions per day
  • Compute the mark-to-market capital each day
  • Choose signals based on a relative strength indicator for ranking in descending order for longs (long-only system)

The resulting equity curve is shown in Figure 7, which is compared to the NASDAQ 100 index (NDX). With these settings, the internal rate of return averaged 7.9% with a maximum drawdown of 22.4% on 11/20/1995.

Image 7
FIGURE 7: AIQ, EQUITY CURVE. Here is a sample equity curve for a test system that uses the bull-bear indicator for market timing over the period 1/1/1992 to 6/12/2012. NASDAQ 100 stocks were traded on each buy signal.
The code is also shown below.
!APPLYING THE SECTOR ROTATION MODEL
!Author: Giorgos E. Siligardos, TASC August 2012
!Coded by: Richard Denning 6/6/2012
!www.TradersEdgeSystems.com

!For the US market, the S&P 500 sector exchange traded funds
!(ETFs) or SP500 indexes [IDX] used by author:
 !financial   (XLF) or [SPXF] or [BIX] 
 !consumer discretionary (XLY) or [SPXD] or
 !energy   (XLE) or [SPXE] or [OSX]
 !consumer staples  (XLP) or [SPXS] or 
 !utilities  (XLU) or [SPXU] or [UTY] 
!Other S&P 500 sectors:
 !health care  (XLV) or [SPXA] or [HCX]
 !materials  (XLB) or [SPXM]
 !industrials  (XLI) or [SPXI]
 !telcom   (XLT) or [SPXT]
 !technology  (XLK) or [SPXT]

!INPUTS:
RC_LEN is 95. !LENGTH FOR RATE OF CHANGE 
useIDX is 1. !SWITCHES BETWEEN ETF=0 AND IDX=1

!ABBREVIATIONS:
C is [close].

!CUSTOM FORMULAS:
FIN is iff(useIDX=1,TickerUDF("SPXF",C),TickerUDF("XLF",C)).
CDS is iff(useIDX=1,TickerUDF("SPXD",C),TickerUDF("XLY",C)).
ENE is iff(useIDX=1,TickerUDF("SPXE",C),TickerUDF("XLE",C)).
CSP is iff(useIDX=1,TickerUDF("SPXS",C),TickerUDF("XLP",C)).
UTL is iff(useIDX=1,TickerUDF("SPXU",C),TickerUDF("XLU",C)).
HLT is iff(useIDX=1,TickerUDF("SPXA",C),TickerUDF("XLV",C)).
MAT is iff(useIDX=1,TickerUDF("SPXM",C),TickerUDF("XLB",C)).
IND is iff(useIDX=1,TickerUDF("SPXI",C),TickerUDF("XLI",C)).
TEL is iff(useIDX=1,TickerUDF("SPXL",C),TickerUDF("XLI",C)).
TEK is iff(useIDX=1,TickerUDF("SPXT",C),TickerUDF("XLK",C)).
SPX is TickerUDF("SPX",C).

FINrc is (FIN/valresult(FIN,RC_LEN)-1)*100.
CDSrc is (CDS/valresult(CDS,RC_LEN)-1)*100.
ENErc is (ENE/valresult(ENE,RC_LEN)-1)*100.
CSPrc is (CSP/valresult(CSP,RC_LEN)-1)*100.
UTLrc is (UTL/valresult(UTL,RC_LEN)-1)*100.
HLTrc is (HLT/valresult(HLT,RC_LEN)-1)*100.
MATrc is (MAT/valresult(MAT,RC_LEN)-1)*100.
INDrc is (IND/valresult(IND,RC_LEN)-1)*100.
TELrc is (TEL/valresult(TEL,RC_LEN)-1)*100.
TEKrc is (TEK/valresult(TEK,RC_LEN)-1)*100.

BullSR is (FINrc + CDSrc) / 2.
BearSR is (ENErc + CSPrc + UTLrc) / 3.

!PLOT AS HISTORIGRAM:
BullBearOsc is BullSR - BearSR. 

!PLOT AS TWO LINE INDICATOR WITH ZERO LINE SUPPORT:
BBavgF is simpleavg(BullBearOsc,50).
BBavgS is simpleavg(BullBearOsc,200).

!REPORTS & TRADING SYSTEM USING THE INDICTOR:
List if 1.
FirstDate is firstdatadate().

HD if hasdatafor(200+10) >= 200.
HDsec if TickerRule("XLF",HD) and TickerRule("XLY",HD)
 and TickerRule("XLE",HD) and TickerRule("XLP",HD) 
 and TickerRule("XLU",HD) and TickerRule("SPX",HD).
HDidx if TickerRule("SPXF",HD) and TickerRule("SPXD",HD)
 and TickerRule("SPXE",HD) and TickerRule("SPXS",HD) 
 and TickerRule("SPXU",HD) and TickerRule("SPX",HD).
SPXma is simpleavg(SPX,50).
Buy if BBavgF > BBavgS and valrule(BBavgF < BBavgS,1)
 and ((useIDX=1 and HDidx) or (useIDX<>1 and HDsec)).
xBuy if BBavgF < BBavgS and valrule(BBavgF> BBavgS,1)
 or SPXma < valresult(SPXma,10).

!FOR RANKING STOCKS TO TRADE: 
StockRC is (C/valresult(TEK,RC_LEN)-1)*100.
—Richard Denning

info@TradersEdgeSystems.com

This email address is being protected from spambots. You need JavaScript enabled to view it.

for AIQ Systems