Rank: Newbie
Groups: Registered, Registered Users Joined: 9/6/2010(UTC) Posts: 6
|
Hi,
I need help for this code:
If(H>Ref(HHV(H, 3*250),-1),3,0)
It is simply plotting a line at '3' when the current high is higher than the last 3 years bar.
The problem with this is that if the stock data is less than 3 years, or new warrants, then metastock will popup an error.
Is there any function similar like 'barsince' that I can use for doing the if statement to check the number of bars loaded in that chart?
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 12/14/2009(UTC) Posts: 140 Location: Austria
|
I think this should work: Code:
n:=If(LastValue(Cum(1))<3*250,5,3*250);
If(Cum(1)<3*250,0,
If(H>Ref(HHV(H, LastValue(n)),-1),3,0));
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 9/6/2010(UTC) Posts: 6
|
Thanks, it worked.
for this if statement:
n:=If(LastValue(Cum(1))<3*250,5,3*250);
if the value less than 3*250, then 5 else 3*250.
is there any reason for using number 5?
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 12/14/2009(UTC) Posts: 140 Location: Austria
|
Not really you can also use any number of days even if it is small. However in the final result it would not be used because of the second if statement.
|
|
|
|
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.