TradersEdgeSystems.com

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

June 2012 Stocks and Commodities Traders Tips


Trading High-Yield Bonds Using ETFs :

AIQ Version:

Original article by Brooke Gardner
AIQ Code by Richard Denning

The AIQ code for Brooke Gardner’s monthly moving average and the related system from the article, “Trading High-Yield Bonds Using ETFs” is provided below.

Although this is a simple moving average system, the use of the monthly data series presented a challenge since the EDS module of the AIQ software does not access to a monthly bar. The charting module does support the monthly chart but in the EDS code the monthly bar cannot be accessed directly. I tried two different approaches, both seemed to work. The first one involved creating a monthly data series by downloading a monthly csv file from Yahoo! Finance and then importing the data file into a newly created ticker using the DTU import utility. This worked but proved to be too much effort if one wanted to get several bond funds. Also the update would have to be done manually. To use this data file we set the input “UseMoDataFile” to 1. Then I tried coding up a monthly close using a daily data files. This took a bit of code but any daily data file will work, without modification, with this approach. To use a daily data file, set the “UseMoDataFile” to 0.

The other input parameter has to do with the fact that to find the end of the month using a daily data file, we have to be one the first day of the next month. So you can either just use the first day of the new month as the signal day by setting “UseEndOfMonthC” to 0. For backtesting and to match the author, I set the “UseEndOfMonthC” to 1 so that we get the signals from the last bar of the month. In the EDS file for the back-test, I then enter on the open of the first bar of the month.

Figure 1 shows a daily chart of VVR with an eight month moving average.

Captions:
Figure 1 – Chart of VVR, a high yield bond fund with an eight month moving average.

EDS Code for Trading High-Yield Bonds Using ETFs:
Trading HY Bonds.EDS
(right click and choose Save As)


 

Traders Studio Version :

Original article by Brooke Gardner
Traders Studio Code by Richard Denning

The TradersStudio code for Brooke Gardner’s article , “Trading High-Yield Bonds Using ETFs”, is provided below. The following code files are provided in the download section below:

  • Indicator Plot: “HY_BONDS_IND” for displaying the monthly SMA indicator.
  • System: “HY_BONDS” for back-testing the author’s system.

In TradersStudio there is a rather unique feature that allows not only tracking the raw price series as well as the split adjusted price series but the contribution from dividends can also be tracked in testing a strategy. This is an extremely important feature to get an accurate picture of this type of strategy and for that matter any dividend yield strategy.

In Figure 1, I show the indicator on a chart of COY. Also the chart shows the buy arrows along with the exits for several trades from the system.

Captions:
Figure 1 – chart of COY with the monthly SMA indicator.

Traders Studio Code for Trading High-Yield Bonds Using ETFs:
HY_BONDS.zip
(right click and choose Save As)

 

 

 

 

 

 

 

 

 

 

 

 

 

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