in Search

dynamical ref

Last post 09-13-2009, 11:52 by Data. 6 replies.
Sort Posts: Previous Next
  •  09-02-2009, 14:17 30599

    dynamical ref

    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!

  •  09-02-2009, 16:00 30601 in reply to 30599

    Re: dynamical ref

    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.


  •  09-02-2009, 17:03 30602 in reply to 30601

    Re: dynamical ref

    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.

  •  09-02-2009, 17:16 30603 in reply to 30602

    Re: dynamical ref

    kondratura:

    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 ;)

  •  09-04-2009, 10:59 30610 in reply to 30603

    Re: dynamical ref

    Data, after plotting indicators, i understand nothing :)

     

    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!

     

  •  09-13-2009, 9:47 30712 in reply to 30610

    Re: dynamical ref

    nobody knows how hhvbars function works?
  •  09-13-2009, 11:52 30713 in reply to 30610

    Re: dynamical ref

    kondratura:

    Data, after plotting indicators, i understand nothing :)

     

    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 !
View as RSS news feed in XML