TradersEdgeSystems.com

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

July 2013 Stocks and Commodities Traders Tips


Balancing Your Indicators

AIQ Version:

Original article by Marsha Stokes
AIQ Code by Richard Denning

For this month’s issue, I did not do the selected article on the step candle pattern, but instead I provide code for an indicator discussed in the Bonus Issue 2013 article, “Balancing Your Indicators”, by Martha Stokes.

In the article, the author discusses several indicators but focuses on the price versus volume rate of change. She suggests that we use these two to find divergences in price versus volume changes. She does not give specific formulas or describe how the indicators should be constructed nor how the diverge could be mechanized. She only shows examples of the indicators and gives interpretations on one stock.

To code the indicators, I used linear regression (LR) of the price compared to linear regression of the volume. We need to get the rate of change of each in order to normalize so that we can compare and get the divergence. I get the LR rate of change of each indicator by using the end points of the LR line (end point divided by beginning point -1). I use the slope to be sure the sign is correct. In other words if the linear regression slope is positive, then the rate of change must be positive. If negative then it must be negative. Next I get the standard deviation (STD) of the difference (DIFF) between the LR percent rate of change of volume minus the LR percent rate of change of price. By then dividing the current DIFF by the STD, I get a measure of how much divergence is currently happening. When the divergence exceeds the input value, buy and sell signals can be generated.

In Figure 1, I show a chart of ADSK with the linear regression lines drawn in on the price and the volume. We see that price has a negative rate of change and volume has a positive rate of change. The divergence indicator exceeded the 2 STD positive level on 7/9/09 for a buy signal. Holding for 10 trading days the trade generated a profit of 23.69%.

In Figure 2, I show the divergence indicator on ADSK with the date shifted to the exit date. I picked this trade because it was a clear example of how the indicator can work, however there were many other trades that did not work as well as this one. The code provided is not meant to be a complete trading system as it lacks exits rules and position sizing. More testing should be done to determine the appropriate inputs, etc.

Captions:

Figure 1 – Chart of ADSK on date of positive divergence signal (7/9/09) with LR lines on price and volume.

Figure 2 – Chart of ADSK on date of trade exit (7/24/09) with divergence indicator and the 2 STD signal lines. When the indicator crossed above the upper signal line on 7/9/09, a buy signal is indicated. This trade was entered on 7/10/09 at the open and exited on 7/24/09 at the open.

EDS Code:
Quantity Time Indicators.EDS
(right click and choose Save As)


 

Traders Studio Version :

Original article by
Traders Studio Code by Richard Denning

For this month’s issue, I did not do the selected article on the step candle pattern, but instead I provide code for the an indicator discussed in the Bonus Issue 2013 article, “Balancing Your Indicators”, by Martha Stokes.

In the article, the author discusses several indicators but focuses on the price versus volume rate of change. She suggests that we use these two to find divergences in price versus volume changes. She does not give specific formulas or describe how the indicators should be constructed nor how the diverge could be mechanized. She only shows examples of the indicators and gives interpretations on one stock.

To code the indicators, I used linear regression (LR) of the price compared to linear regression of the volume. We need to get the rate of change of each in order to normalize so that we can compare and get the divergence. I get the LR rate of change of each indicator by using the end points of the LR line (end point divided by beginning point -1).

The following code files are contained in the download from the websites:

  • Function: “LR_SRV” a function that returns any value along a linear regression line plus other values related to linear regression.
  • Function: “LR_VAL” a function that gets a specific value on the linear regression line and uses the LR_SRV function to do so.
  • Function: “ROC_DIVERG” a function that returns the number of standard deviations of the difference between two indicator series. I use the volume and close price as the two series.
  • Indicator plot: a plotting function that allows the divergence of volume to price indicator to be displayed on a chart with the upper and lower signal lines which are set to four standard deviations.
  • System: “PV_DIVERG” a system that I devised to use for testing divergence indicator.

In Figure 1, I show a trade on Apple Inc. (AAPL) with the divergence indicator. When the indicator crosses over the upper 4 standard deviation line, a buy signal is given. I optimized just the long side on the NASDAQ 100 stocks and found that the 4 standard deviation was a relatively good setting. Exits were based on a 10 bar holding period. The system is by no means a finished product that could be traded but only a tool to test the effectiveness of the indicator. I did not do enough tests to draw any conclusions. More testing should be done before relying on this indicator for live trading.

Captions:
Figure 1 – Chart of AAPL with volume-price divergence indicator and a long trade indicated by the green up arrow.

Traders Studio Code:
PV_DIVERG.zip
(right click and choose Save As)

 

 

 

 

 

 

 

 

 

 

 

 

 

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