Delving deep into Demand Index

howto
Tags: #<Tag:0x00007fb3e004bcf8>

#1

Thanks Paul Ho, for posting Mr. James Sibbett's Demand Index code in Amibroker AFL library (link).

I am writing this to extend my gratitude and to seek bit of more information regarding this indicator. Apart from page # 463 from John Murphy's book and handful of websites showing the same six rules suggested by the creator, I did not find much of literature in this regard.

Please share your 2 cents on this topic.....

Thank you very much!


#2

@Lennon, I'm not familiar with it, but a bit longer explanation is found on this Italian website:

http://www.traderpedia.it/wiki/index.php/Demand_Index

If you are not familiar with my native idiom :slight_smile: you can use Google translate to see it in English (not bad at all IMHO) or many other languages of your choice.

I don't know if the article is an original one or is taken from some other source, but I find this site's content very useful to learn rules for many trading indicators/formulas.

There is also a brief reference to it in Chapter 12 of "Trading Systems and Methods" 5th Edition - Perry J. Kaufman, where the topic is "Volume, Open Interest, and Breadth" and the author compares it to some other more commonly used breath indicators.


#3

Thanks @beppe for that,

There is some sort of mysticism with Mr. Sibbett's original formulation of Demand Index. I did not find much of authentic research or study based literature in this regard. What intrigues the most is the relationship that is drawn between price and volume!

Mr. Kaufman refered to Wilders RSI.

In continuation to what Mr. Ho coded as DMI, in order to further smooth the noise and draw a close relationship with StochasticRSI I have taken help of Stochastic as below:

arg = ParamList( "Weighted Close", "Close|Avg|WtClose|Median", 2 );
Const = Param( "Constant", 5, .50, 10.5, 0.01 );
periods = Param( "DMI Periods", 19, 10, 40, 1 );
Lb = Param( "lb", 2, 2, 10, 1 );

Stochperiods = Param( "Stochperiods", 14, 1, 100, 1 );

Kperiods = Param( "Kperiods", 14, 1, 50, 1 );
Dperiods = Param( "Dperiods", 3, 1, 50, 1 );
OBthreshold = Param( "OBthreshold", 80, 55, 100, 5 );
OSthreshold = Param( "OSthreshold", 20, 0, 50, 5 );

if( arg == "Close" ) WtClose = C;
if( arg == "Avg" )	WtClose = Avg;
if( arg == "WtClose" ) WtClose = (H + L + C + C)/4;
if( arg == "Median" ) 	WtClose = (H + L)/2;
AvgTr = MA( HHV( H, Lb ) - LLV( L, Lb ), periods );
WtCratio = ( WtClose - Ref( WtClose, -1 ) ) / Min( WtClose, Ref( WtClose, -1 ) );
VolRatio = Volume / MA( Volume, periods );

Constant = ( ( WtClose * 3 ) / AvgTr ) * abs( WtCRatio );
Constant = IIf( Constant > Const, Const, Constant );
Constant = VolRatio / exp( Constant );
BuyP = IIf( WtCRatio > 0, VolRatio, Constant );
SellP = IIf( WtCRatio > 0, Constant, VolRatio );
BuyPressure = EMA( BuyP, periods );
SellPressure = EMA( SellP, periods );
tmpDI = IIf( SellPressure > BuyPressure, -BuyPressure / SellPressure, SellPressure / BuyPressure );
DMI = IIf( tmpDi < 0, -1 - tmpDI, 1 - tmpDI ) * 100;

llDMI = LLV( DMI, Stochperiods );
hhDMI = HHV( DMI, Stochperiods );

StochasticDMI = 100 * ( ( DMI - llDMI ) / ( hhDMI - llDMI + 0.00001 ) );
StocK_DMI = MA( StochasticDMI, Kperiods );
StocD_DMI = MA( StocK_DMI, Dperiods );

Plot( StocK_DMI, "DMIStochK(" + Kperiods + ")", ParamColor( "StochK", colorWhite ), styleLine | styleThick );
Plot( StocD_DMI, "DMIStochD(" + Dperiods + ")", ParamColor( "StochD", colorDarkBlue ), styleLine | styleThick );
PlotGrid( OBthreshold, colorRed, 1 );
PlotGrid( OSthreshold, colorGreen, 1 );

*This method of calculating Stochastics was dipicted from @portfoliobuilder's code as shown in this post - Stochastic RSI AFL

Modifications are most welcome.....

Thank again!


#4

@Lennon I saw my username so thought I could join your discussion. I am unfamiliar with Sibbett's Demand Index so you have piqued my curiosity. Certainly not easy to find the exact calculations initially used by Mr. Sibbett but there are a couple of very old issues of Technical Analysis of Stocks and Commodities (TASC) with some info.

June 1986 "Fine-Tuning the Demand Index" appears to have the formula and Sept 1989 "Demand Oscillator momentum" does some derivations of that. I assume for copyright reasons I can't just post the stuff here on the forum.

As for a Stochastic and the DMI, try Barbara Star's TASC article Jan 2013, and here is the afl code for it (similar to your calculations of course as a stochastic is a stochastic)
http://www.amibroker.com/members/traders/01-2013.html

Let me know if you find anything interesting or want to work on some afl's. @beppe and I keep track of old TASC tips together but they do not go anywhere nearly that far back.


#5

Thank you very much @portfoliobuilder!

Great!