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

Notification

Icon
Error

Options
Go to last post Go to first unread
kondratura  
#1 Posted : Wednesday, September 2, 2009 2:17:36 PM(UTC)
kondratura

Rank: Newbie

Groups: Registered, Registered Users
Joined: 9/2/2009(UTC)
Posts: 4

hi, all!

i have next string in the system tester:

few1:=hhvbars(H,OPT1);

and i want get hhv(H,OPT1) at bar few1.Any dynamical refs do not work;

ref(H, -few1) doesn't.

please, help me!

Data  
#2 Posted : Wednesday, September 2, 2009 4:00:27 PM(UTC)
Data

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 5/20/2008(UTC)
Posts: 53

You might want to try that :

ValueWhen( 2 , HHVBars(C,opt1) < Ref(HHVBars(C,opt1) ,-1) , HHV(C,opt1) )


A detailed explanation from metastock help :
Value When [valuewhen()]

SYNTAX valuewhen ( Nth, EXPRESSION, DATA ARRAY )

FUNCTION Returns the value of the DATA ARRAY when the EXPRESSION was true on the Nth most recent occurrence. This includes all data loaded in the chart.

EXAMPLE The formula "valuewhen( 2, cross(c,mov(c,10,s), rsi(20) )" returns the value of the RSI on the 2nd most recent occurrence of the closing price crossing above its 10-day moving average.


kondratura  
#3 Posted : Wednesday, September 2, 2009 5:03:12 PM(UTC)
kondratura

Rank: Newbie

Groups: Registered, Registered Users
Joined: 9/2/2009(UTC)
Posts: 4

Data, Thank You very much for your reply!

I don't understand exactly how function ValueWhen really works, but how about next variation:

ValueWhen(1 ,1=1, HHV(H,opt1) )

It's more clear for me.

Thank You once more.

Data  
#4 Posted : Wednesday, September 2, 2009 5:16:13 PM(UTC)
Data

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 5/20/2008(UTC)
Posts: 53

kondratura wrote:

Data, Thank You very much for your reply!

I don't understand exactly how function ValueWhen really works, but how about next variation:

ValueWhen(1 ,1=1, HHV(H,opt1) )

It's more clear for me.

Thank You once more.

ValueWhen(1 ,1=1, HHV(H,opt1) ) is the same as HHV(H,opt1).



Just try plotting the indicator and see which one suits you best. Create 2 indicators named :

"- test HHV 1" :

time:=Input("time",1,500,30);

ValueWhen( 2 , HHVBars(C,time) < Ref(HHVBars(C,time) ,-1) , HHV(C,time) )


"- test HHV 2"

time:=Input("time",1,500,30);
HHV(C,time)



And you'll find out which one is more useful than the other ;)

kondratura  
#5 Posted : Friday, September 4, 2009 10:59:10 AM(UTC)
kondratura

Rank: Newbie

Groups: Registered, Registered Users
Joined: 9/2/2009(UTC)
Posts: 4

Data, after plotting indicators, i understand nothing :)

UserPostedImage

can You look at this, please! I would like to see, that at bar 1(blue digits), value of upper indicator (just function hhvbars) must be not 2 as plotted on sample, but 3 - we have 3 bars after 3-period peak at bar 4. And at bar 0 we must have value 4 on upper indicator. Explain please, may be hhvbars function works not such way i think.

Thank You Very much for your atention!

kondratura  
#6 Posted : Sunday, September 13, 2009 9:47:38 AM(UTC)
kondratura

Rank: Newbie

Groups: Registered, Registered Users
Joined: 9/2/2009(UTC)
Posts: 4

nobody knows how hhvbars function works?
Data  
#7 Posted : Sunday, September 13, 2009 11:52:19 AM(UTC)
Data

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 5/20/2008(UTC)
Posts: 53

kondratura wrote:

Data, after plotting indicators, i understand nothing :)

UserPostedImage

can You look at this, please! I would like to see, that at bar 1(blue digits), value of upper indicator (just function hhvbars) must be not 2 as plotted on sample, but 3 - we have 3 bars after 3-period peak at bar 4. And at bar 0 we must have value 4 on upper indicator. Explain please, may be hhvbars function works not such way i think.

Thank You Very much for your atention!

i'm so sorry I didn't see your post !
Just change the 3 into something higher, like 6 or 7.
The HHVBars(X,Y) function will tell you when the highest value for X was reached on a Y bars sample. In your case, it was using a 3 bars sample : bar 0, bar 1 and bar 2. That's why its highest value was 2.


That being said, there's also a highest value 8 bars ago. The indicator you want might be too sensible for trading and might require too much micro-management. You might want to change your time frame to a lower one or to change your trading style into something that works on more than 8 bars.

It's entirely up to you but most of my trading involves at least 2000 bars on 3 different time frames.


Anyway, I wish you luck in your trading and I hope you'll learn how to use metastock : it's an extremely powerful tool !
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.