TradersEdgeSystems.com

Consulting | Custom Trading Systems
Built-In Indicators | Custom Indicators

September 2010 Stocks and Commodities Traders Tips


Getting Clear With Short-Term Swings

Original article by Ron Black, CTA
AIQ Code by Richard Denning
Traders Studio Code by Richard Denning

AIQ Version:

The AIQ code for this article differs somewhat from the author’s approach. The AIQ code is used to generate EDS reports that show the current status of the short term swings as either “UP” or “DN”. Note that the code is not meant to plot any line or indicators. The reports are set up on the EDS file that is posted at our website as shown below. I highly recommend that the EDS file be downloaded from our web site rather than typing or pasting the code onto a new EDS file because the reports have been set up on the EDS file that I created for this article.

The author’s code is fixed on one bar pivots but I have added an input parameter for the pivot strength. The length of the swings can be varied by increasing the pivot strength higher than the current setting of 2. In Figure 1, I show a portion of one of the EDS reports. In Figure 2, I show a portion of the summary report which has counts of how many stocks on 7/7/2010 were in up or down swings.

The “SwingReport” shows all stocks that passed the minimum price and volume settings of $10 and 1,000,000 average daily volume. Of the 1033 stocks that passed the price and volume filter, 256 were in up-swings and 777 were in down-swings. Using the breath builder we could create a breadth indicator that would show the daily count and daily percentages of stocks in up swings or down swings and this could be plotted on a chart as a market breadth indicator. Due to time constraints, I did not generate this indicator.

Captions:

Figure 1: Portion of the “SwingReport” for 7/14/2010.

Figure 2: Portion of the “Summary” Report for 7/14/2010.

AIQ EDS Code for Getting Clear with Short-Term Swings:
ClearSTS.EDS
(RIGHT CLICK AND CHOOSE "SAVE AS." DO NOT LEFT CLICK OR YOUR BROWSER WILL TRY TO OPEN THE FILE.)


Traders Studio Version:

The Tradestation code in the article can be converted easily to TradersStudio code via the Migration Tool which is located in the tools menu.

Once the basic code was converted by the Migration Tool, I created a function: “CLEAR_ST” that returns a 1 if the market is in an up-swing and a 0 if the market is in a down-swing. Using the function, I then created an indicator: “CLEAR_ST_IND” that can be plotted on the chart to see the swing direction. Up-swing bars are colored green and down-swing bars are colored red. In addition, as shown in Figure 1, the bars are not only colored but there is an indicator in the lower panel that oscillates from 0 (down-swing) to 1 (up-swing).

Using the CLEAR_ST swing function, I also created two systems that are always in the market. One trades counter to the swing (CLEAR_CT) and the other trades with the swing (CLEAR_TF). Upon testing the two systems on a portfolio of 38 futures markets, I noted that mainly the index futures such as the SP contract using the counter swing system were able to produce consistent profits. I used a total of $100 per trade for slippage and commission round turn. This turned out to be too much for most of the futures markets to overcome as both systems showed down-sloping equity curves when run on the portfolio of futures markets without the indexes. For the most part, only the index futures showed positive results trading counter-trend to the swing indicator. In Figure 2, I show the equity curve trading a portfolio of index futures (Pinacle data) for the following markets: DJ, MD, ND, RL and SP. All index markets showed a positive net profit for the test period, see Table 1. Only two of the 35 non-index markets showed a net profit when trading counter-trend and only one of the 35 non-index markets showed a net profit when trading in a trend-following mode.

Captions:

Figure 1: Chart of SP contract with swing indicator.

Figure 2: Equity curve for count-trend trading for a portfolio of five futures indexes.

Table 1: Market by market results for the counter-trend trading system.

Traders Studio Code for Clear With Short-Term Swings :
CLEAR_ST.zip
(RIGHT CLICK AND CHOOSE "SAVE AS.")

 

 

 

 

 

 

 

 

 

 

 

 

 

Disclaimer | Privacy Policy | Contact Us | Spam Blocker | ©2009 Traders Edge Systems