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

Notification

Icon
Error

Options
Go to last post Go to first unread
rajeev  
#1 Posted : Saturday, January 2, 2010 7:24:45 PM(UTC)
rajeev

Rank: Newbie

Groups: Registered, Registered Users
Joined: 7/2/2007(UTC)
Posts: 6

For every lookback period of 13 days inclusive of the present day, i want to identify the fourth highest high and fourth lowest low and add them. How can i write this in metastock ?
johnl  
#2 Posted : Saturday, January 2, 2010 8:15:06 PM(UTC)
johnl

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/7/2005(UTC)
Posts: 602


I haven't seen anything like that done in the formula language so my guess is it would have
to be done through the developer's kit. Hopefully someone can prove me wrong.
rajeev  
#3 Posted : Sunday, January 3, 2010 10:51:40 AM(UTC)
rajeev

Rank: Newbie

Groups: Registered, Registered Users
Joined: 7/2/2007(UTC)
Posts: 6

Johnl thanx for looking.I hope there is an answer. What is the developers kit? Is it purchaseable?
rajeev  
#4 Posted : Sunday, January 3, 2010 12:56:39 PM(UTC)
rajeev

Rank: Newbie

Groups: Registered, Registered Users
Joined: 7/2/2007(UTC)
Posts: 6

Aaaaaahh well i checked out what the developers kit was.Its not for me.I dont know any of those programming languages.
vienna  
#5 Posted : Monday, January 4, 2010 1:38:06 AM(UTC)
vienna

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 12/14/2009(UTC)
Posts: 140
Location: Austria

for 2nd highesthigh there is a solution by Roy Larsen on the web:
http://trader.online.pl/MSZ/e-w-Second-Highest_High.html


rajeev  
#6 Posted : Tuesday, January 5, 2010 9:10:05 AM(UTC)
rajeev

Rank: Newbie

Groups: Registered, Registered Users
Joined: 7/2/2007(UTC)
Posts: 6

Vienna, thanx 4 referring me to that formula. Appreciate it a lot
vienna  
#7 Posted : Thursday, January 7, 2010 4:27:21 AM(UTC)
vienna

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 12/14/2009(UTC)
Posts: 140
Location: Austria

Here is a rash try by me - for getting the 4th highest value of the close for the last 5(6) day's ...
but I'm not really sure if metastock can correctly work with such algorithm. Visualy it looks like it works. The next problem is the limitation of code in a metastock functions...
----
{nth's highest close value by ts-vienna}
x1:=C;
x2:=Ref(C,-1);
x3:=Ref(C,-2);
x4:=Ref(C,-3);
x5:=Ref(C,-4);
x6:=Ref(C,-5);

y1:=If(x1=Max(x1,x2),x1,x2);
y2:=If(x1=Max(x1,x2),x2,x1);
x1:=y1;x2:=y2;
y2:=If(x2=Max(x2,x3),x2,x3);
y3:=If(x2=Max(x2,x3),x3,x2);
x2:=y2;x3:=y3;
y3:=If(x3=Max(x3,x4),x3,x4);
y4:=If(x3=Max(x3,x4),x4,x3);
x3:=y3;x4:=y4;
y4:=If(x4=Max(x4,x5),x4,x5);
y5:=If(x4=Max(x4,x5),x5,x4);
x4:=y4;x5:=y5;
y5:=If(x5=Max(x5,x6),x5,x6);
y6:=If(x5=Max(x5,x6),x6,x5);
x5:=y5;x6:=y6;

y1:=If(x1=Max(x1,x2),x1,x2);
y2:=If(x1=Max(x1,x2),x2,x1);
x1:=y1;x2:=y2;
y2:=If(x2=Max(x2,x3),x2,x3);
y3:=If(x2=Max(x2,x3),x3,x2);
x2:=y2;x3:=y3;
y3:=If(x3=Max(x3,x4),x3,x4);
y4:=If(x3=Max(x3,x4),x4,x3);
x3:=y3;x4:=y4;
y4:=If(x4=Max(x4,x5),x4,x5);
y5:=If(x4=Max(x4,x5),x5,x4);
x4:=y4;x5:=y5;
y5:=If(x5=Max(x5,x6),x5,x6);
y6:=If(x5=Max(x5,x6),x6,x5);
x5:=y5;x6:=y6;

y1:=If(x1=Max(x1,x2),x1,x2);
y2:=If(x1=Max(x1,x2),x2,x1);
x1:=y1;x2:=y2;
y2:=If(x2=Max(x2,x3),x2,x3);
y3:=If(x2=Max(x2,x3),x3,x2);
x2:=y2;x3:=y3;
y3:=If(x3=Max(x3,x4),x3,x4);
y4:=If(x3=Max(x3,x4),x4,x3);
x3:=y3;x4:=y4;
y4:=If(x4=Max(x4,x5),x4,x5);
y5:=If(x4=Max(x4,x5),x5,x4);
x4:=y4;x5:=y5;
y5:=If(x5=Max(x5,x6),x5,x6);
y6:=If(x5=Max(x5,x6),x6,x5);
x5:=y5;x6:=y6;

y1:=If(x1=Max(x1,x2),x1,x2);
y2:=If(x1=Max(x1,x2),x2,x1);
x1:=y1;x2:=y2;
y2:=If(x2=Max(x2,x3),x2,x3);
y3:=If(x2=Max(x2,x3),x3,x2);
x2:=y2;x3:=y3;
y3:=If(x3=Max(x3,x4),x3,x4);
y4:=If(x3=Max(x3,x4),x4,x3);
x3:=y3;x4:=y4;
y4:=If(x4=Max(x4,x5),x4,x5);
y5:=If(x4=Max(x4,x5),x5,x4);
x4:=y4;x5:=y5;
y5:=If(x5=Max(x5,x6),x5,x6);
y6:=If(x5=Max(x5,x6),x6,x5);
x5:=y5;x6:=y6;

y1:=If(x1=Max(x1,x2),x1,x2);
y2:=If(x1=Max(x1,x2),x2,x1);
x1:=y1;x2:=y2;
y2:=If(x2=Max(x2,x3),x2,x3);
y3:=If(x2=Max(x2,x3),x3,x2);
x2:=y2;x3:=y3;
y3:=If(x3=Max(x3,x4),x3,x4);
y4:=If(x3=Max(x3,x4),x4,x3);
x3:=y3;x4:=y4;
y4:=If(x4=Max(x4,x5),x4,x5);
y5:=If(x4=Max(x4,x5),x5,x4);
x4:=y4;x5:=y5;
y5:=If(x5=Max(x5,x6),x5,x6);
y6:=If(x5=Max(x5,x6),x6,x5);
x5:=y5;x6:=y6;


y1:=If(x1=Max(x1,x2),x1,x2);
y2:=If(x1=Max(x1,x2),x2,x1);
x1:=y1;x2:=y2;
y2:=If(x2=Max(x2,x3),x2,x3);
y3:=If(x2=Max(x2,x3),x3,x2);
x2:=y2;x3:=y3;
y3:=If(x3=Max(x3,x4),x3,x4);
y4:=If(x3=Max(x3,x4),x4,x3);
x3:=y3;x4:=y4;
y4:=If(x4=Max(x4,x5),x4,x5);
y5:=If(x4=Max(x4,x5),x5,x4);
x4:=y4;x5:=y5;
y5:=If(x5=Max(x5,x6),x5,x6);
y6:=If(x5=Max(x5,x6),x6,x5);
x5:=y5;x6:=y6;

x1;x2;x3;x4;C;

{x4 should be the 4th highest value)
----

maybe you can simplify it a little bit.. (I have only copy-pasted the "middle"-block- part.. because of the lack of a loop in ms)

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.