Perhaps another way to scan for divergences is to have a correlation indicator that shows the correlation for a certain lookback period between the Demand Index and closing price. If the correlation falls below 0.4, we have a divergence and if it falls below 0, we have a negative divergence. I could find a correlation indicator in NT that shows correlation between 2 instruments but not between an indicator and price. If someone could code such a correlation indicator, if could flag out divergences between price and any momentum indicators (e.g. Demand Index, RSI, MACD Histogram, CCI, etc).
The following user says Thank You to wccktrader for this post:
Managed to code the indie to show the correlation between Demand Index and price in the Thinkorswim platform. When the indie drops below 0.4, we have divergences between the Demand Index and price. A possible trading strategy would be trade in the direction of prevailing trend whenever the indie crosses back above 0.4. The Thinkscript code are given below:
#hint:<b>Demand Index</b>\nDeveloped by James Sibbet, the Demand Index is a market strength study that calculates a ratio of buying to selling pressure. It incorporates price and volume to indicate a change in price trend.
#hint length: The number of bars used to calculate the Demand Index. <b>(Default is 5)</b>
Platform: NinjaTrader (It's a love/hate relationship)
Favorite Futures: CL, TF, 6E
Posts: 176 since May 2010
Thanks: 60 given,
Better Momentum for NT7 from Emini-Watch has a divergence indicator built in. If you purchase it, you also get a version that allows you to apply the divergence function to any other indicator of your choosing. For example, you can apply the divergence dots to RSI or Stochastic if that suits you. Pretty reasonable at $170.
The following user says Thank You to Slipknot511 for this post:
Thanks monpere. I have just backtested the divergence indicator with another trend following indicator for entry, and exit using an ATR trailing stop indicator. The backtesting results looks good but walk forward analysis results is not good. This confirms that I will loose my shirt trading divergence in real time. Nonetheless, I think divergence may serve as a tool to alert me to have a second look at price actions.
I looked at these sites and did a Google search on James Sibbet and Demand Index. The best I could do was find some code developed by eSignal and some in Trader's Laboratory.
I was unable to find any in Ninja. More interesting, I could not find any of James' original work. I did, however, find this same quote in several places:
The Demand Index, developed by James Sibbet, combines price and volume in such a way that it is often a leading indicator of price change. The Demand Index calculations are too complex, however, for this text. The calculations require 21-column accounting paper to calculate manually.
There are six "rules" to the Demand Index:
A divergence between the Demand Index and the price trend suggests an approaching weakness in price.
One more rally to new highs usually follows an extreme peak in the Demand Index (the Index is performing as a leading indicator).
Higher prices with a lower Demand Index peak usually coincides with an important top (the Index is performing as a coincidental indicator).
The Demand Index penetrates the level of zero indicating a change in trend (the Index is performing as a lagging indicator).
When the Demand Index stays near the level of zero for any period of time, a weak price movement that will not last long is indicated.
A large long-term divergence between prices and the Demand Index indicates a major top or bottom.
The reason I think everyone is quoting each other is they use the same line:
The Demand Index calculations are too complex, however, for this text. The calculations require 21-column accounting paper to calculate manually.
I'm not sure, but can you even buy 21-column accounting paper anymore?
So although I have this code in Language 'X', I am not sure when I get done moving it to Ninja if I have the right logic. Code isn't worth much if the logic is wrong from the get go.
Anybody have any thoughts on where to find James Sibbet's original logic?