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

Notification

Icon
Error

2 Pages<12
Options
Go to last post Go to first unread
StorkBite  
#21 Posted : Friday, September 9, 2005 7:17:51 AM(UTC)
StorkBite

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/19/2005(UTC)
Posts: 2,995

Was thanked: 14 time(s) in 10 post(s)
Quote:
IF BarIndex<20 then VolatNK = Undefined else MB=Average(20)(TypicalPrice) I=19 D2=0 While I>=0 Do D2=D2+Square((TypicalPrice(i)-MB)/MB) I=I-1 Wend VolatNK=LOG(SQRT(D2/20))
Ok, not to beat a dead horse here, but there's no way that this code is a derivative of the given equation (reattached below). At best, it is also someone's (mis)interpretation. If this code is what's supposed to be interpreted, then that is a different question. Equation interpretation will require a source... is it posted in context on the internet somewhere? Per the forum guidelines, in the 'asking for help' section, post as much information as possible to ensure the best possible answer. Otherwise, this is all an exercise in futility. Really... As you can plainly see, it is 0235 and I am still tring to think this one through. Ever not been able to let something go? LOL! Geesh... Anyway, still unable to test this new thought of mine until Saturday, but what about this? Not flexible, but examines 20 periods. I know ya'll will let me down gently... MB:=mov(typical(),20,s); BarC0:=power((typical()-MB)/MB,2); BarC1:=power((ref(typical(),-1)-MB)/MB,2); BarC2:=power((ref(typical(),-2)-MB)/MB,2); BarC3:=power((ref(typical(),-3)-MB)/MB,2); BarC4:=power((ref(typical(),-4)-MB)/MB,2); BarC5:=power((ref(typical(),-5)-MB)/MB,2); BarC6:=power((ref(typical(),-6)-MB)/MB,2); BarC7:=power((ref(typical(),-7)-MB)/MB,2); BarC8:=power((ref(typical(),-8)-MB)/MB,2); BarC9:=power((ref(typical(),-9)-MB)/MB,2); BarC10:=power((ref(typical(),-10)-MB)/MB,2); BarC11:=power((ref(typical(),-11)-MB)/MB,2); BarC12:=power((ref(typical(),-12)-MB)/MB,2); BarC13:=power((ref(typical(),-13)-MB)/MB,2); BarC14:=power((ref(typical(),-14)-MB)/MB,2); BarC15:=power((ref(typical(),-15)-MB)/MB,2); BarC16:=power((ref(typical(),-16)-MB)/MB,2); BarC17:=power((ref(typical(),-17)-MB)/MB,2); BarC18:=power((ref(typical(),-18)-MB)/MB,2); BarC19:=power((ref(typical(),-19)-MB)/MB,2); Sigma:= BarC0+BarC1+BarC2+BarC3+BarC4+ BarC5+BarC6+BarC7+BarC8+BarC9+ BarC10+BarC11+BarC12+BarC13+BarC14+ BarC15+BarC16+BarC17+BarC18+BarC19; Solution:=sqrt(Sigma/20);
Patrick  
#22 Posted : Friday, September 9, 2005 1:45:07 PM(UTC)
Patrick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
:boire: Wow good job and what a perseverance ... Well in theory your formula is right, now we will need to test it and see if it crashes metastock just like mine :D I'm impressed at how fast you pick on the Metastock formula language :P Patrick :mrgreen: Edit : It was close but here is the right version D21:=Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D22:=D21+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D23:=D22+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D24:=D23+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D25:=D24+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D26:=D25+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D27:=D26+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D28:=D27+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D29:=D28+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D30:=D29+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D31:=D30+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D32:=D31+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D33:=D32+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D34:=D33+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D35:=D34+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D36:=D35+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D37:=D36+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D38:=D37+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D39:=D38+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D40:=D39+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); Log(Sqrt(D40/20)) And it seems to work ...
crwinnr5  
#23 Posted : Friday, September 9, 2005 2:04:48 PM(UTC)
crwinnr5

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 7/21/2005(UTC)
Posts: 74
Location: Oklahoma USA

Hey Guys, Bollinger bands are really price plus (minus) the standard deviation of price. This formula looks like standard deviation. Therefore would it not be c +- stdev(c,20)? Also the log should give you a measure of volatility (see Fishbacks ODDS Expert) So how about log(stdev(c,20))?
Patrick  
#24 Posted : Friday, September 9, 2005 2:45:32 PM(UTC)
Patrick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
Imothep please try this : D21:=Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D22:=D21+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D23:=D22+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D24:=D23+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D25:=D24+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D26:=D25+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D27:=D26+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D28:=D27+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D29:=D28+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D30:=D29+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D31:=D30+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D32:=D31+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D33:=D32+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D34:=D33+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D35:=D34+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D36:=D35+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D37:=D36+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D38:=D37+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D39:=D38+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D40:=D39+Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); Log(Sqrt(D40/20)) Does it seem right? What kinda of scale should this be on? Patrick :mrgreen:
StorkBite  
#25 Posted : Friday, September 9, 2005 3:32:59 PM(UTC)
StorkBite

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/19/2005(UTC)
Posts: 2,995

Was thanked: 14 time(s) in 10 post(s)
Cool... I appreciate you being my crash tester (dummy omitted). I don't really understand your revision... :oops: Only because C represents a moving point in a bound range. It looks like your formula keeps a fixed reference point, essentially adding it over and over. I might be wrong. I just don't see it. [quote=Power((Typical()" be something like "Power((((Ref(Typical(),-xx)"? The rest of it is pretty straight forward. I'm assuming that the way I strung all of the pluses together was the wrong syntax. I wish I could have tested it first. Anyway, this is a super learning experience for me. It would be great if there was some sort of a way to declare a variable to be used for looping, but I know that this has already been discussed, so I'm not on a soapbox. (There's not enough room up there with M anyway!
Patrick  
#26 Posted : Friday, September 9, 2005 3:36:57 PM(UTC)
Patrick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
Yes you are right ... There should be a ref somewhere, alright I will look at it again later ... :D
StorkBite  
#27 Posted : Friday, September 9, 2005 3:44:34 PM(UTC)
StorkBite

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/19/2005(UTC)
Posts: 2,995

Was thanked: 14 time(s) in 10 post(s)
Alpha version 2 or 3 or something: :D D21:=Power((Typical()-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D22:=D21+Power((ref(typical(),-1)-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D23:=D22+Power((ref(typical(),-2)-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D24:=D23+Power((ref(typical(),-3)-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D25:=D24+Power((ref(typical(),-4)-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D26:=D25+Power((ref(typical(),-5)-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D27:=D26+Power((ref(typical(),-6)-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D28:=D27+Power((ref(typical(),-7)-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D29:=D28+Power((ref(typical(),-8)-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D30:=D29+Power((ref(typical(),-9)-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D31:=D30+Power((ref(typical(),-10)-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D32:=D31+Power((ref(typical(),-11)-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D33:=D32+Power((ref(typical(),-12)-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D34:=D33+Power((ref(typical(),-13)-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D35:=D34+Power((ref(typical(),-14)-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D36:=D35+Power((ref(typical(),-15)-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D37:=D36+Power((ref(typical(),-16)-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D38:=D37+Power((ref(typical(),-17)-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D39:=D38+Power((ref(typical(),-18)-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); D40:=D39+Power((ref(typical(),-19)-Mov(Typical(),20,S))/Mov(Typical(),20,S),2); Log(Sqrt(D40/20));
StorkBite  
#28 Posted : Friday, September 9, 2005 3:48:25 PM(UTC)
StorkBite

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/19/2005(UTC)
Posts: 2,995

Was thanked: 14 time(s) in 10 post(s)
Quote:
Therefore would it not be c +- stdev(c,20)? Also the log should give you a measure of volatility (see Fishbacks ODDS Expert) So how about log(stdev(c,20))?
Hey Crw- I'm sure you are right... I figured that once the formula was correct it could be adapted as needed... log, stdev, etc... Thanks for shedding some light on this for us! :D Do you use something like this in your own trading?
crwinnr5  
#29 Posted : Friday, September 9, 2005 4:15:30 PM(UTC)
crwinnr5

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 7/21/2005(UTC)
Posts: 74
Location: Oklahoma USA

Hi g, I do not know if I am correct or not (I don't have the actual formula in front of me) but the formula sure looks like standard deviation except stdev is norm x bar - x, this formula is x - x bar but it becomes abs when you square it. I do use Bollinger Bands as a visual reference but do not use them for actual trading. There is a lot of history with Bollinger Bands, which are simular to the Process Statistical Control techniques used in manufacturing. There is also an oscillator created from the Bollinger Bands called %B which I like to use. This might be what Imothep was after but %B does not use the log function. Without having some more information it is hard to say what the formula does. Charley Here is the Width computation for BBands since Imothep mentioned it was a formula for width: (BBandTop(C,20,S,2)-BBandBot(C,20,S,2))/(Mov(BBandTop(C,20,S,2),20,S)+(Mov(BBandBot(C,20,S,2),20,S)))/2
Imothep  
#30 Posted : Sunday, September 11, 2005 10:49:14 AM(UTC)
Imothep

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 8/28/2005(UTC)
Posts: 25

Hi, Firstly I would like to thank you all for your help. It is very kind of you :wink:. I have had problems with my computer and I was not able to reply earlier. I can't tell you who posted the right MSFL code because I only have that equation (the image posted in my first message). A friend of mine sent it to me. All I know that it is the proper way to calculate the Bollinger bands bandwidth (John Bollinger's original calculation is "skewed" due to the fact he did not include price levels). I'll try to find further information on this equation and I will keep you informed. Thanks again MSFL gurus !!! :wink:
wabbit  
#31 Posted : Sunday, September 11, 2005 12:25:36 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)
There has been some good work done here - but I question some of the logic??? If we had: (x-y)/y we could re-write this as: (x/y)-(y/y) or: (x/y)-1 then: Power((x/y)-1,2) = (x^2 / y^2) - 2(x/y) + 1 What do we get id we sum these amounts continuously over time? How does continuously adding one to the result help? Do we really need it? Adding one just adds distortion. Then: why did we need to take the logarithm? If its just for scaling, that's alright, but we need to understand why each computation is made like it is! Surely the formula: x:=Typical(); y:=Mov(x,20,S); Log(Sqrt(( Power((Ref(x,-0)-y)/y,2)+ Power((Ref(x,-1)-y)/y,2)+ Power((Ref(x,-2)-y)/y,2)+ Power((Ref(x,-3)-y)/y,2)+ Power((Ref(x,-4)-y)/y,2)+ Power((Ref(x,-5)-y)/y,2)+ Power((Ref(x,-6)-y)/y,2)+ Power((Ref(x,-7)-y)/y,2)+ Power((Ref(x,-8)-y)/y,2)+ Power((Ref(x,-9)-y)/y,2)+ Power((Ref(x,-10)-y)/y,2)+ Power((Ref(x,-11)-y)/y,2)+ Power((Ref(x,-12)-y)/y,2)+ Power((Ref(x,-13)-y)/y,2)+ Power((Ref(x,-14)-y)/y,2)+ Power((Ref(x,-15)-y)/y,2)+ Power((Ref(x,-16)-y)/y,2)+ Power((Ref(x,-17)-y)/y,2)+ Power((Ref(x,-18)-y)/y,2)+ Power((Ref(x,-19)-y)/y,2)) /20)); could be re-written thus, for similar results: x:=Typical(); y:=Mov(x,20,S); Sqrt(( Power(Ref(x,-0)/y,2)+ Power(Ref(x,-1)/y,2)+ Power(Ref(x,-2)/y,2)+ Power(Ref(x,-3)/y,2)+ Power(Ref(x,-4)/y,2)+ Power(Ref(x,-5)/y,2)+ Power(Ref(x,-6)/y,2)+ Power(Ref(x,-7)/y,2)+ Power(Ref(x,-8)/y,2)+ Power(Ref(x,-9)/y,2)+ Power(Ref(x,-10)/y,2)+ Power(Ref(x,-11)/y,2)+ Power(Ref(x,-12)/y,2)+ Power(Ref(x,-13)/y,2)+ Power(Ref(x,-14)/y,2)+ Power(Ref(x,-15)/y,2)+ Power(Ref(x,-16)/y,2)+ Power(Ref(x,-17)/y,2)+ Power(Ref(x,-18)/y,2)+ Power(Ref(x,-19)/y,2)) /20); Both of these formula are similar, in that each peaks at the same time, troughs at the same time etc.... just the scaling is a little different. We notice how similar this function is to another formula.... Both of these again are similar to, the simpler: x:=Typical(); Stdev(x,20); Plot each of them and see. Do the more complicated versions reveal more than the simpler version? wabbit :D
Imothep  
#32 Posted : Thursday, September 15, 2005 7:40:10 AM(UTC)
Imothep

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 8/28/2005(UTC)
Posts: 25

That's it :wink: You can compare it to the original bandwidth, it is a little bit different. Thanks again ! :wink:
Users browsing this topic
Guest (Hidden)
2 Pages<12
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.