Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 8/28/2005(UTC) Posts: 25
|
Hi,
Could anyone translate into MSFL the following formula ?
Where :
C = typical()
MB = mov(typical(),20,s)
Thanks in advance ! :wink:
PS : unfortunately, I am not good at maths :oops: :oops: :oops:
|
|
|
|
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)
|
Sqrt(Power(Mov(Typical()-Mov(Typical(),20,S),20,S),2))
Patrick :mrgreen:
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 3/19/2005(UTC) Posts: 2,995
Was thanked: 14 time(s) in 10 post(s)
|
Hey Imothep-
Where did the formula come from? It seems to me that 't' will set the boundary of the summation. Do you know what it is? I'm thinking it has to be at least 20.
Quote:Sqrt(Power(Mov(Typical()-Mov(Typical(),20,S),20,S),2))
Gong! :roll:
|
|
|
|
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)
|
What do you mean g ... Do you think it's wrong :?:
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 3/19/2005(UTC) Posts: 2,995
Was thanked: 14 time(s) in 10 post(s)
|
Well... I'm halfway playing, but if it's like any math that I ever learned, I think that there is more involved.
|
|
|
|
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)
|
I don't know now .. Do you think it should be like this :
Sqrt(Power(sum(typical()-Ref(Mov(typical(),20,s),-19),20),2)/20)
Either I don't think it is much more complex than that ...
Patruick :mrgreen:
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 10/29/2004(UTC) Posts: 1,394 Location: Glastonbury, CT
Was thanked: 2 time(s) in 2 post(s)
|
There are two books that really go into detail on how to apply square roots into your trading
New Blueprints for gains in Stocks and grains by William Dunnigan
Chart reading for professional traders by Michael S. Jenkins
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 3/19/2005(UTC) Posts: 2,995
Was thanked: 14 time(s) in 10 post(s)
|
Well... I don't know either. I'm thinking about something along these lines:
t1:=Input(“upper boundary”,5,50,20);
j:=t1;
BarC:=ref(typical(),-j);
MB:=mov(typical(),20,s);
a1:=power((BarC-MB)/MB,2);
a2:=sum(a1,t1);
a3:=sqrt(a2/20);
a3;
Of course, I have no idea about what this is supposed to do, so there is no way to see if I'm even in the ballpark.
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 3/19/2005(UTC) Posts: 2,995
Was thanked: 14 time(s) in 10 post(s)
|
IR's an engineer... he knows about sigma and point segments and such... huh? Of course, any 10th grader taking calculus could probably solve this in about 5 minutes! :D
|
|
|
|
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)
|
All,
I am a little confused by the original assumptions that C=Typical() and MB=Mov(Typical(),20,S)
For such a "complicated" formula such as that given in the original post by Imothep, I believe that C and MB relate to something completely different? Perhaps some more light could be shed on the source of the formula. (See also: http://forum.equis.com/viewtopic.php?t=933 )
I believe the bar above the C indicates an average (remember x, x(bar) etc from high school stats?). C(subscript)j could indicate the moving average of C at point j. If this is the case, I doubt MB(subscript)t would be a moving average too?
wabbit :D
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 3/19/2005(UTC) Posts: 2,995
Was thanked: 14 time(s) in 10 post(s)
|
Wabbit <<<<< I'm with him! :smt003
|
|
|
|
Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 8/28/2005(UTC) Posts: 25
|
Patrick wrote:Sqrt(Power(Mov(Typical()-Mov(Typical(),20,S),20,S),2))
Patrick :mrgreen:
Hi Patrick :wink:,
Thanks for your reply but unfortunately the result is wrong.
Actually, this formula is another way to calculate Bollinger's bandwidth.
Here is the the original code (which is the transcription of the mathematical formula posted in my first message) :
IF BarIndex<20 then
VolatNK = Undefined
else
MB=Average[20](TypicalPrice)
I=19
D2=0
While I>=0 Do
D2=D2+Square((TypicalPrice-MB)/MB)
I=I-1
Wend
VolatNK=LOG(SQRT(D2/20))
Hope someone will find out how to translate it into MSFL.
Regards,
Imothep
PS : Wabbit, I am sure for the following assumptions :
C = typical()
MB = mov(typical(),20,s)
|
|
|
|
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=log(a3);". Do you have something to reference your results to to know if it produces the desired results?
I think the confusion in your original request came from having no definition of the symbols used in the mathematical equation.
|
|
|
|
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)
|
G sorry to bust your chops but this is wrong as well, you have a prev value in there ... D2=D2+Square((TypicalPrice-MB)/MB) ... And because it is a loop of 20 period you have to sum D2 for 20 periods ... And that's where it crashes :D
My guess is it can't be done with msfl .... Maybe a dll or maybe I'm wrong and someone else will post the answer ...
Here is what I would have wrote :
MB:=Mov(Typical(),20,S);
D2:=Sum(PREV+Sqrt((Typical()-MB)/MB),20);
Log(Sqrt(D2/20))
Patrick :mrgreen:
|
|
|
|
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=prev+" to the mix. Let's get this straight... I have too much time in now to let it go. Unfortunately, I am not in front of my computer to check it out further. :D
|
|
|
|
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)
|
Quote: I am not in front of my computer
#-o Ok ... So who is posting messages on the forum then :lol: :oops:
I don't think the sum takes care of it ...
Patrick :mrgreen:
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 3/19/2005(UTC) Posts: 2,995
Was thanked: 14 time(s) in 10 post(s)
|
I'm in front of someone else's computer... but, you never said that you needed unique ISP's! :-w)
|
|
|
|
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)
|
:lol: Nice!!! Keep up the good work :D
|
|
|
|
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:MB:=Mov(Typical(),20,S);
D2:=Sum(PREV+Sqrt((Typical()-MB)/MB),20);
Log(Sqrt(D2/20))
Actually, I hope you're right. If I had gotten it, that would have been like a blind man hitting a bulls eye! I got tangled up in that funky nondescript notation.
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 8/2/2005(UTC) Posts: 7 Location: Aix-en-Provence - France
|
It also seems to me that this kind of formula can't be done with MSFL... but it wouldn't be a problem to create a DLL for it. Let me know if you need that
Patrick (aka Nag)
metastock.thenexttools.com (please don't laugh, site construction has just begun)
|
|
|
|
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.