Low Frequency Trading

The AIQ code based on Ron McEwan’s article in the March issue of Stocks & Commodities, “Low-Frequency Trading,” is provided at the following website: www.TradersEdgeSystems.com/traderstips.htm.

The cumulative indicators on the advances and declines for the NYSE are provided in the first section of code that follows. However, I have never liked cumulative indicators because results can vary depending on where the accumulation is started. I do not recommend using the first code set below that replicates the author’s indicator because it runs so slowly that you will think your computer is frozen. Thus, I coded an alternative that uses the built-in advance-decline (A/D) line and then takes a moving average of the built-in A/D line. This version runs quickly and probably gives similar results.

I did not test the first coded version. I tested my second code set as a timing system on the S&P 500 ETF (SPY) from 1981 to 2/12/2013 (Figure 7). As with most timing systems, the risk was reduced based on a lower sigma than that of the markets and the return was also less than just buying and holding the SPY for the test period.

FIGURE 7: AIQ. Here is a sample equity curve for the alternative system trading the SPY from 1/5/1981 to 2/12/2013 compared to the S&P 500 (SPX).

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

!LOW-FREQUENCY TRADING
!Author: Ron McEwan, TASC April 2013
!Coded by: Richard Denning
!www.TradersEdgeSystems.com
!INPUT:
advMAlen is 252.
!ABBREVIATIONS:
C is [close].
OSD is offSetToDate(month(),day(),year()).
!AUTHORS INDICATOR AND SYSTEM (processes very slowly-see alternate below):
DaysToStart is min(advMAlen,scanany(month()=02 and day()=05
and year()=1980,252*50) then OSD).
NYadv is TickerUDF(“DJIA”,[Adv Issues]).
NYdec is TickerUDF(“DJIA”,[Dec Issues]).
ADVpctTot is (NYadv-NYdec) / (NYadv+NYdec) * 1000.
ADVcumPct is sum(ADVpctTot,^DaysToStart).
ADVcumPctMA is simpleavg(ADVcumPct,252).
HD if hasdatafor(advMAlen +10) > advMAlen.
Buy if ADVcumPct > ADVcumPctMA and HD.
Sell if ADVcumPct < ADVcumPctMA.
!ALTERNATE TO ABOVE (due to processing speed recommend that this one is used):
ADline is tickerUDF(“DJIA”,[AD Line]).
ADlineMA is simpleavg(ADline,252).
BuyAlt if ADline > ADlineMA and HD.
SellAlt if ADline < ADlineMA.

—Richard Denning
info@TradersEdgeSystems.com
for AIQ Systems

Leave a Reply