Announcement

Collapse
No announcement yet.

Is it correct to use 'getValue(5)' ...

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is it correct to use 'getValue(5)' ...

    Is it correct to use 'getValue(5)' to plot the value for the current bar 5 bars in the past?

    Definition from efs Library Help:

    getValue = "Returns the value of the specified type at the specified bar index relative to the bar currently being processed."

    Attached is a simple code sample displaying 3 moving averages all the same...all are simple moving averages of 10 bars based on the close.

    What I am displaying are different index values (from each study...moving average) using 'getValue'.

    xStudy1.getValue(5) = green


    xStudy2.getValue(-5) = red


    xStudy1.getValue(0) = black


    While getValue(0) is returning the value of (the simple 10 bar moving average based on the close) for the current bar am I right in presuming that getValue(-5) gives the same value offset 5 bars into the future? I guess I find the -5 (as opposed to +5) to be confusing to indicate movement 'forward' in time.

    What I want to confirm is that - it's correct to use 'getValue(5)' to plot the value for the current bar 5 bars in the past?

    Thanks,

    g
    Attached Files

  • #2
    No. All series object (studies or indicators) are referenced in NEGATIVE terms.

    For example.

    xBBBasis.getValue(0); // returns the CURRENT BAR'S Bollinger Band Basis

    xLoDonch.getValue(-5); // returns the Lower Donchian of 5 BARS AGO.

    Passing a POSITIVE value to the getValue() function should result in a null (unless you are using something like an MA that can be offset into the future.
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      I understand...but here's the thing...using +5 does plot a value much earlier than than either of the other 2 methods...so as a signal line it (inadvertently) comes out to be much more valuable. Does that make sense?

      My question is how do I prgrammatically replicate the line I'm getting with +5?

      Thanks for getting back Doji,

      g

      Comment


      • #4
        If I'm understanding your needs, using +5 is essentially looking 5 bars into the future. Yes, it may provide a more valid trigger or level, but you're asking for "what is the level 5 bars into the future". That's not technically allowed unless you know what's going to happen IN THE FUTURE - get it?

        I can't offer any assistance because forward looking systems are TROUBLE - trust me. Anything that looks into the future for data/signals is not going to work LIVE.

        Good luck.
        Brad Matheny
        eSignal Solution Provider since 2000

        Comment


        • #5
          Thanks Doji...in the end I think I agree with your opinion about the trouble you're referring to.

          I will revise my strategy.

          Thanks again,

          g

          Comment

          Working...
          X