logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
davidf2  
#1 Posted : Monday, April 17, 2006 10:05:07 PM(UTC)
davidf2

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 4/17/2006(UTC)
Posts: 1

Does anybody know how the BuyP() and SellP() components of The Demand Index are calculated? I need this info for a custom indicator of my own.
DOC  
#2 Posted : Tuesday, April 18, 2006 6:04:19 PM(UTC)
DOC

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/9/2004(UTC)
Posts: 107
Location: Salt Lake City, UT

David Not sure what you are asking. Could you give more detail about what you are looking for? doc
wabbit  
#3 Posted : Wednesday, April 19, 2006 12:15:09 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
davidf2 wrote:
Does anybody know how the BuyP() and SellP() components of The Demand Index are calculated? I need this info for a custom indicator of my own.
The MS Bible wrote:
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. MetaStock uses a slight variation on the Sibbet's original Index so that the Index is displayed on a "normal" y-axis scale. The author's Index is plotted on a scale labeled +0 at the top, 1 in the middle, and -0 at the bottom. MetaStock uses a scale from +100 to -100. Other than the difference in y-axis labeling, the indicator is calculated exactly as designed by its author.
davidf2, I am not too sure how MS does its calculations. As the help says, its too complicated for the likes of us, but a very brief Google for: +sibbet +"demand index" +(formula OR code OR algorithm), yielded this: http://www.purebytes.com...omega/2002/msg04345.html [code:1:d150234e4c]{ James Sibbet's Demand Index Indicator } { Programmed by David Fenstemaker } { The Demand Index combines price and volume in } { such a way that it is often a leading indicator of } { price change. } Inputs: Length (NumericSeries); Vars : WtCRatio(1), VolRatio(1), VolAvg(Volume), BuyP(1), SellP(1), Sign(+1), Return(0), WghtClose(Close), AvgTR(High - Low), Constant(1), BuyPres(1), SellPres(1), TempDI(1), DMI(1); If CurrentBar = 1 then Begin VolAvg = Average(Volume, Length); End; Return = 0 ; WghtClose = (High + Low + Close + Close) * 0.25; AvgTR = Average (Highest (High, 2) - Lowest ( Low, 2), Length); VolAvg = ((VolAvg [1] * (Length - 1)) + Volume) / Length; If WghtClose <> 0 and WghtClose[1] <> 0 and AvgTR <> 0 and VolAvg <> 0 then Begin WtCRatio = (WghtClose - WghtClose[1]) / MinList(WghtClose,WghtClose[1]) ; VolRatio = Volume / VolAvg; Constant = ((WghtClose * 3) /AvgTR) * AbsValue (WtCRatio); If Constant > 88 then Constant = 88; Constant = VolRatio / ExpValue (Constant); If WtCRatio > 0 then Begin BuyP = VolRatio; SellP = Constant; End Else Begin BuyP = Constant; SellP = VolRatio; End; BuyPres = ((BuyPres [1] * (Length - 1)) + BuyP) / Length; SellPres = ((SellPres [1] * (Length - 1)) + SellP) / Length; TempDI = +1; If SellPres > BuyPres then Begin Sign = -1; If SellPres <> 0 then TempDI = BuyPres / SellPres; End Else Begin Sign = +1; If BuyPres <> 0 then TempDI = SellPres / BuyPres; End; TempDI = TempDI * Sign; If TempDI < 0 then DMI = -1 - TempDI else DMI = +1 - TempDI ; Return = DMI {* 100.0} ; End;[/code:1:d150234e4c] Convert that into MS and compare with the built in version. Have a crack at it. If your code doesn't work, then post your attempt as it stands back here and we will take a look at it. Hope this helps. wabbit :D P.S. For the Equis Team: Is this the same as the MS canned version?? This does not look too complicated? 21 columns! humpfh! :wink:
wabbit  
#4 Posted : Wednesday, April 19, 2006 1:02:21 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
Damn. Procrastination is fun! Homework can wait!! Here is what I came up with.... [code:1:110a590774]{James Sibbet's Demand Index Indicator} {Programmed by David Fenstemaker} {Omega Code downloaded from} {http://www.purebytes.com/archives/omega/2002/msg04345.html} {converted to MS by wabbit :D} {19 April 2006} len:=Input("Length: ",1,1000,11); VolAvg1:=Ref(Mov(V,len,S),-1); wCl:=(H+L+C+C)/4; AvgTR:=Mov(HHV(H,2)-LLV(L,2),len,S); VolAvg:=(VolAvg1*(len-1)+V)/len; WtCRatio:=(wCl-Ref(wCl,-1)) / Min(wCl,Ref(wCl,-1)) ; VolRatio:=V/VolAvg; Const:=((wCl*3)/AvgTR)*Abs(WtCRatio); Const:=VolRatio/Exp(Min(Const,88)); BuyPr:=If(WtCRatio>0,VolRatio,Const); SellPr:=If(WtCRatio>0,Const,VolRatio); BuyPres:=(PREV*(len-1)+BuyPr)/len; SellPres:=(PREV*(len-1)+SellPr)/len; Sign:=If(SellPres>BuyPres,-1,1); TempDI:=Sign*If(SellPres>BuyPres,BuyPres/Max(SellPres,0.00001),SellPres/Max(BuyPres,0.00001)); myDMI:=100*If(TempDI<0,-1-TempDI,1-TempDI); myDMI;[/code:1:110a590774] Its not EXACTLY the same as the MS canned version.. but its pretty close! Its not as fast as the canned indicator either - due to the two PREVs. See how you go with it. wabbit :D
kingsley29  
#5 Posted : Tuesday, May 30, 2006 12:22:05 AM(UTC)
kingsley29

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/30/2005(UTC)
Posts: 14

Correction for typo on Wabbit name. Thank you Wabbit for your code. I have two questions: 1) When I apply this indicator to stocks (RIMM) or futures (YM) with period = 3 ,for example, I got message "division by zero". 2) Could someone be able to improve the code by NOT using PREV? Thank you.
wabbit  
#6 Posted : Tuesday, June 13, 2006 12:02:37 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
To eliminate the divide by zero errors, all you have to do is go through the code and find a denominator that at any time has a zero value. Then you just have to decide whether to replace the value by substitution or use another algorithm if substitution is not an option. Anyway, I have done this for you, replace the line: VolRatio:=V/VolAvg; with VolRatio:=V/Max(VolAvg,0.0001); I stopped looking after this one as no more DBZ errors were found in the index I was looking at. If you find more DBZ, try to fix them yourself, and post back the corrected code for others following this thread. As for the PREV's.. There is no way around them, unless you change the definition of the code, slightly. Replace: BuyPres:=(PREV*(len-1)+BuyPr)/len; SellPres:=(PREV*(len-1)+SellPr)/len; with BuyPres:=Mov(BuyPr,len,E); SellPres:=Mov(SellPr,len,E); They are NOT the same, but the substitution is a suitable (faster) alternative. If you have hard numerical trading laws, they will need to be changed to match the new code. wabbit :D P.S. Please do not multiple post your questions. If you havent received a reply to a question after a 'reasonable' time, (this is the only time it is suitable to ) BUMP your post. Please don't create another thread. See the Forum Rules. Please delete your other post, http://forum.equis.com/viewtopic.php?t=4133 or I can do it for you.
wabbit  
#7 Posted : Tuesday, June 13, 2006 12:32:25 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
Oh, I forgot to mention.... When you change the PREVs out with the EMA, you need to double the length of the period to make the new code match (more closely) the old code. or implement this the easy way, replace: len:=Input("Length: ",1,1000,11); with len:=Input("Length: ",1,1000,11)*2; wabbit :D [code:1:2295104f94]{James Sibbet's Demand Index Indicator} {Programmed by David Fenstemaker} {Omega Code downloaded from} {http://www.purebytes.com/archives/omega/2002/msg04345.html} {converted to MS by wabbit :D} {19 April 2006} {edited 13 June 2006} len:=Input("Length: ",1,1000,11)*2; VolAvg1:=Ref(Mov(V,len,S),-1); wCl:=(H+L+C+C)/4; AvgTR:=Mov(HHV(H,2)-LLV(L,2),len,S); VolAvg:=(VolAvg1*(len-1)+V)/len; WtCRatio:=(wCl-Ref(wCl,-1)) / Min(wCl,Ref(wCl,-1)); VolRatio:=V/Max(VolAvg,0.0001); Const:=((wCl*3)/AvgTR)*Abs(WtCRatio); Const:=VolRatio/Exp(Min(Const,88)); BuyPr:=If(WtCRatio>0,VolRatio,Const); SellPr:=If(WtCRatio>0,Const,VolRatio); BuyPres:=Mov(BuyPr,len,E); SellPres:=Mov(SellPr,len,E); Sign:=If(SellPres>BuyPres,-1,1); TempDI:=Sign*If(SellPres>BuyPres,BuyPres/Max(SellPres,0.00001),SellPres/Max(BuyPres,0.00001)); myDMI:=100*If(TempDI<0,-1-TempDI,1-TempDI); myDMI;[/code:1:2295104f94]
kingsley29  
#8 Posted : Tuesday, June 13, 2006 7:28:07 AM(UTC)
kingsley29

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/30/2005(UTC)
Posts: 14

I delete the post in the advanced coding technique. My "trick" seems to be working with you. I did try to correct the "divide by zero" my way by adding +.000001 to the denominator for the affected code. I remember, the error message was only displayed on some intraday periods or on some stocks. In software, sometimes a bug only appear in a special case. I will try your new modified code. Thank you Wabbit for your response. You are "ahead" of Jose now!!! ('=D>')
wabbit  
#9 Posted : Tuesday, June 13, 2006 11:36:53 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
kingsley29 wrote:
I delete the post in the advanced coding technique. My "trick" seems to be working with you.
I know you are only joking... but on a serious note, for just a moment. <soapbox> For All Forum Members, The number of multiposting incidents has increased recently. DO NOT multiple post in an effort to get your posts answered. This is a breach of the Forum rules and will result in your account being suspended. Multiposting will not be tolerated by the Forum Administration or Moderators. Please refresh yourself with the Forum Rules if you are in any doubt. Please ask any one of the Team to advise you of the right thread for your post, if you have any concerns on how to best get your particular problem solved. </soapbox>
kingsley29 wrote:
I did try to correct the "divide by zero" my way by adding +.000001 to the denominator for the affected code. I remember, the error message was only displayed on some intraday periods or on some stocks. In software, sometimes a bug only appear in a special case.
You have to do more than just add a value such as 0.0001 By example, what if you just added 0.0001 to all the denominators, and one of those denominators happened to be -0.0001 You will have CREATED a divide by zero error. You need to TEST the denominator first, then decide on the most appropriate course of action. Believe me when I tell you, it does make a difference!
kingsley29 wrote:
I will try your new modified code.
Let us know how you go with it. Perhaps you might like to add a post on how you intend employing this indicator in your system.
kingsley29 wrote:
Thank you Wabbit for your response. You are "ahead" of Jose now!!! ('=D>')
Huh?? :?: Jose is two hours ahead of me (three hours in summer!) and lightyears ahead in the programming stakes! :wink: wabbit :D
aztrader  
#10 Posted : Sunday, September 24, 2006 12:45:51 AM(UTC)
aztrader

Rank: Newbie

Groups: Registered, Registered Users
Joined: 8/12/2005(UTC)
Posts: 2

Hi David and Wabbit,
This was really helpful and I thank you for the code. It provides another look at ways to calculate this index. Another code variant that may be helpful to some is below. It also does a good job of tracking the built in Metastock code. The original code was presented by Steve Wiser with Amibroker http://www.amibroker.com/library/detail.php?id=58. He must have spent many hours figuring it out. I've never met him but he must be quite brilliant! I did the menial task of simply converting it to Metastock code and adding in substitution variables. I have been very happy and it provides the ability to modify parameters and experiement:

{Demand Index}
{Original by Steve Wiser with Amibroker 7/5/2001}
{http://www.amibroker.com/library/detail.php?id=58}
{Converted to Metastock Code by Todd Griggs 11/25/2005}

len1:=19;
len2:=30;
len3:=19;
A:=(H+L+2*C);
B:=Mov((HHV(H,2)-LLV(L,2)),len1,E);
BP:=V/Mov(V,len1,E) * ((A>=Ref(A,-1)) +(A<Ref(A,-1)) / Exp((0.375 * (A+Ref(A,-1)) /B ) *(Ref(A,-1)-A) / A));

SP := V/Mov(V,len1,E) * ((A<=Ref(A,-1)) + (A>Ref(A,-1)) / Exp((0.375 * (A+Ref(A,-1)) / B ) * (A-Ref(A,-1)) / Ref(A,-1)));

mabp:=Mov(BP,len3,E);
masp:=Mov(SP,len3,E);
divsor:=If(mabp>masp,mabp,masp);
divend:=If(mabp<masp,mabp,masp);
var2:=1-(divend/divsor);
var3:=If((masp>mabp),-var2,var2) ;
var4:=var3*100;
var5:=Mov(var4,len2,E);
var4

Hopefully this helps someone!
Take care,
Todd
wabbit  
#11 Posted : Sunday, September 24, 2006 9:47:50 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
Todd,

The reason both codes match the built-in formula so closely is because they are essentially the same code!

Hopefully the explanation will be clear enough to prove this, and show where the minor differences occur.

Lets look at this code first.
Code:

len1:=19;
len2:=30;
len3:=19;

A:=(H+L+2*C);
B:=Mov((HHV(H,2)-LLV(L,2)),len1,E);

BP:=V/Mov(V,len1,E) * ((A>=Ref(A,-1)) +(A<Ref(A,-1)) / Exp((0.375 * (A+Ref(A,-1)) /B ) *(Ref(A,-1)-A) / A));
SP := V/Mov(V,len1,E) * ((A<=Ref(A,-1)) + (A>Ref(A,-1)) / Exp((0.375 * (A+Ref(A,-1)) / B ) * (A-Ref(A,-1)) / Ref(A,-1)));

mabp:=Mov(BP,len3,E); 
masp:=Mov(SP,len3,E); 

divsor:=If(mabp>masp,mabp,masp); 
divend:=If(mabp<masp,mabp,masp); 
var2:=1-(divend/divsor); 
var3:=If((masp>mabp),-var2,var2) ; 
var4:=var3*100; 
var5:=Mov(var4,len2,E);
var4


If we dont use the smoothing MA at the end, we can get rid of var5. We also notice that len1 and len3 are the same, so we will align these into len1. Notice in the BP and SP code, ((A>=Ref(A,-1)) +(A<Ref(A,-1)) which is essentially an If() statement. With whats left of the BP and SP code sections we will introduce two new variables to perform the common computations.

So what we are left with is:
Code:

len1:=19;

A:=(H+L+2*C);
B:=Mov((HHV(H,2)-LLV(L,2)),len1,E);

newVar1:=V/Mov(V,len1,E);
newVar2:=(A+Ref(A,-1))/B;

BP:=If(A>=Ref(A,-1),newVar1,1/Exp((newVar2)*(Ref(A,-1)-A)/A));
SP:=If(A<=Ref(A,-1),newVar1,1/Exp((newVar2)*(A-Ref(A,-1))/Ref(A,-1)));

mabp:=Mov(BP,len1,E); 
masp:=Mov(SP,len1,E); 

divsor:=If(mabp>masp,mabp,masp); 
divend:=If(mabp<masp,mabp,masp); 
var2:=1-(divend/divsor); 
var3:=If((masp>mabp),-var2,var2) ; 
var4:=var3*100; 
var4;



Turning our attention now to:
Code:

len:=Input("Length: ",1,1000,11)*2;

VolAvg1:=Ref(Mov(V,len,S),-1);


wCl:=(H+L+C+C)/4;


AvgTR:=Mov(HHV(H,2)-LLV(L,2),len,S);

VolAvg:=(VolAvg1*(len-1)+V)/len;


WtCRatio:=(wCl-Ref(wCl,-1)) / Min(wCl,Ref(wCl,-1));


VolRatio:=V/Max(VolAvg,0.0001);


Const:=((wCl*3)/AvgTR)*Abs(WtCRatio);

Const:=VolRatio/Exp(Min(Const,88));


BuyPr:=If(WtCRatio>0,VolRatio,Const);

SellPr:=If(WtCRatio>0,Const,VolRatio);

 
BuyPres:=Mov(BuyPr,len,E);

SellPres:=Mov(SellPr,len,E);


Sign:=If(SellPres>BuyPres,-1,1);

TempDI:=Sign*If(SellPres>BuyPres,BuyPres/Max(SellPres,0.00001),SellPres/Max(BuyPres,0.00001));
myDMI:=100*If(TempDI<0,-1-TempDI,1-TempDI);


myDMI;


Notice: VolAvg:=(Ref(Mov(V,len,S),-1)*(len-1)+V)/len; is VERY similar to Mov(V,len,S) so lets call it as the same. Const:=VolRatio/Exp(Min(Const,88)); Const will VERY rarely ever be greater than 88, so just use Const.

So becomes:
Code:

len:=Input("Length: ",1,1000,11)*2;
wCl:=(H+L+C+C)/4;
AvgTR:=Mov(HHV(H,2)-LLV(L,2),len,S);
VolRatio:=V/Mov(V,len,S);
WtCRatio:=(wCl-Ref(wCl,-1)) / Min(wCl,Ref(wCl,-1));
Const:=((wCl*3)/AvgTR)*Abs(WtCRatio);
Const:=VolRatio/Exp(Const);
BuyPr:=If(WtCRatio>0,VolRatio,Const);
SellPr:=If(WtCRatio<0,VolRatio,Const);
BuyPres:=Mov(BuyPr,len,E);
SellPres:=Mov(SellPr,len,E);
Sign:=If(SellPres>BuyPres,-1,1);
TempDI:=Sign*If(SellPres>BuyPres,BuyPres/Max(SellPres,0.00001),SellPres/Max(BuyPres,0.00001));
myDMI:=100*If(TempDI<0,-1-TempDI,1-TempDI);
myDMI;


So if we interleave these:
Code:

len1:=19;
len:=Input("Length: ",1,1000,19); {make the lengths the same}

A:=(H+L+2*C);
wCl:=(H+L+C+C)/4;

B:=Mov((HHV(H,2)-LLV(L,2)),len1,E);
AvgTR:=Mov(HHV(H,2)-LLV(L,2),len,S); {a small difference here!}

newVar1:=V/Mov(V,len1,E);
VolRatio:=V/Mov(V,len,S); {a small difference here!}

newVar2:=(A+Ref(A,-1))/B;
WtCRatio:=(wCl-Ref(wCl,-1)) / Min(wCl,Ref(wCl,-1));
Const:=VolRatio/(Exp((wCl*3)/AvgTR)*Abs(WtCRatio));

BP:=If(A>=Ref(A,-1),newVar1,1/Exp((newVar2)*(Ref(A,-1)-A)/A));
BuyPr:=If(WtCRatio>=0,VolRatio,Const); {a small difference here!}

SP:=If(A<=Ref(A,-1),newVar1,1/Exp((newVar2)*(A-Ref(A,-1))/Ref(A,-1)));
SellPr:=If(WtCRatio<=0,VolRatio,Const); {a small difference here!}

mabp:=Mov(BP,len1,E); 
BuyPres:=Mov(BuyPr,len,E);

masp:=Mov(SP,len1,E); 
SellPres:=Mov(SellPr,len,E);

{format each plot}
divsor:=If(mabp>masp,mabp,masp); 
divend:=If(mabp<masp,mabp,masp); 
var2:=1-(divend/divsor); 
var3:=If((masp>mabp),-var2,var2) ; 
var4:=var3*100;
var4;

Sign:=If(SellPres>BuyPres,-1,1);
TempDI:=Sign*If(SellPres>BuyPres,BuyPres/Max(SellPres,0.00001),SellPres/Max(BuyPres,0.00001));
myDMI:=100*If(TempDI<0,-1-TempDI,1-TempDI);
myDMI;
So other than deciding to EMA vice SMA, the only real difference is between: VolRatio/(Exp((wCl*3)/AvgTR)*Abs(WtCRatio)); and 1/Exp((newVar2)*(Ref(A,-1)-A)/A)); and if we notice (Ref(A,-1)-A)/A) is the same as Abs(WtCRatio) in the different scenarios, we can see the difference is further isolated, specifically to the difference between:
VolRatio/(Exp((wCl*3)/AvgTR));
and
1/Exp(newVar2);

So essentially, they are the same codes with one minor differernce in their computation, however, James Sibbet's Demand Index Indicator programmed by David Fenstemaker still tracks the MS builtin function more closely with a period set at 19 periods, that is:

Code:

{James Sibbet's Demand Index Indicator}

{Programmed by David Fenstemaker}



{Omega Code downloaded from}

{http://www.purebytes.com/archives/omega/2002/msg04345.html}



{converted to MS by wabbit :D}

{19 April 2006}

{edited 25 September 2006}



len:=19;
wCl:=(H+L+C+C)/4;
AvgTR:=Mov(HHV(H,2)-LLV(L,2),len,S);
VolRatio:=V/Mov(V,len,S);
WtCRatio:=(wCl-Ref(wCl,-1)) / Min(wCl,Ref(wCl,-1));
Const:=((wCl*3)/AvgTR)*Abs(WtCRatio);
BuyPr:=If(WtCRatio>=0,VolRatio,VolRatio/Exp(Const));
SellPr:=If(WtCRatio<=0,VolRatio,VolRatio/Exp(Const));
BuyPres:=Mov(BuyPr,len,E);
SellPres:=Mov(SellPr,len,E);
Sign:=If(SellPres>BuyPres,-1,1);
TempDI:=Sign*If(SellPres>BuyPres,BuyPres/Max(SellPres,0.00001),SellPres/Max(BuyPres,0.00001));
myDMI:=100*If(TempDI<0,-1-TempDI,1-TempDI);
myDMI;




wabbit [:D]
wabbit  
#12 Posted : Monday, September 25, 2006 8:40:35 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
I used one of Jose's ideas to neaten up the finish....

Code:

{James Sibbet's Demand Index Indicator}

{Programmed by David Fenstemaker}



{Omega Code downloaded from}

{http://www.purebytes.com/archives/omega/2002/msg04345.html}



{converted to MS by wabbit :D}

{19 April 2006}

{edited 25 September 2006}


len:=19;
wCl:=(H+L+C+C)/4;
AvgTR:=Mov(HHV(H,2)-LLV(L,2),len,S);
VolRatio:=V/Mov(V,len,S);
WtCRatio:=(wCl-Ref(wCl,-1)) / Min(wCl,Ref(wCl,-1));
Const:=((wCl*3)/AvgTR)*Abs(WtCRatio);
BuyPr:=If(WtCRatio>=0,VolRatio,VolRatio/Exp(Const));
SellPr:=If(WtCRatio<=0,VolRatio,VolRatio/Exp(Const));
BuyPres:=Mov(BuyPr,len,E);
SellPres:=Mov(SellPr,len,E);
{thanx to Jose Silva for this concept, its much neater}
ratio:=Min(BuyPres,SellPres)/Max(BuyPres,SellPres);
myDI:=(If(BuyPres>SellPres,2-ratio,ratio)-1)*100;

{plot}
myDI;





wabbit [:D]


uasish  
#13 Posted : Monday, September 25, 2006 9:04:10 PM(UTC)
uasish

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 8/13/2005(UTC)
Posts: 170

Thanks: 7 times

Wabbit,

What was the actual period Mr James Sibbet used in his original code.

Asish

wabbit  
#14 Posted : Monday, September 25, 2006 9:12:03 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
I don't know....

All I have ever found is other people's interpretations of his ideas.


wabbit [:D]


Guinness  
#15 Posted : Monday, January 28, 2008 8:26:21 PM(UTC)
Guinness

Rank: Newbie

Groups: Registered, Registered Users
Joined: 5/4/2007(UTC)
Posts: 1

I am new to this forum. I have read the threads on this topic and it is not clear to me whether any of the formulas provided plot the Buying Pressure and the Selling Pressure (in addition to the Demand Index). Does anyone know how to plot these?

Also, I recently read the following article from Stocks and Commodities:

Stocks & Commodities V. 4:4 (141-143): Fine-tuning the demand index by Thomas E. Aspray

In the atricle, the author describes his approach to using the Demand Index. He plots 4 indicators: The Demand Index, Buying Pressure (BP), Selling Pressure (SP) and the Demand Oscillator. He says the Demand Oscillator is based on BP/SP. Is anyone familiar with the Demand Oscillator and how to plot it?

Thanks for any help,

rdiefes

Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.