Announcement

Collapse
No announcement yet.

Reference to Indicator Value In Past Time Period

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Reference to Indicator Value In Past Time Period

    Is there an easy way to refer to a study's value in a past time period? For instance I want to compare the value of a 20 period EMA to the value of the same 20 period EMA 10 bars ago.

    It seems like that should be an easy thing to do, but I can't seem to find any information in the online tutorials about it. What I would like to do is determine if two moving averages have not only crossed, but are diverging before generating a signal.
    Last edited by gwoolum; 01-08-2003, 11:05 AM.

  • #2
    Hi,

    What you want is ref(x,y);

    where x = the number of bars to look bar
    and y = the number of bars to return.

    ref(-1) will return the value of the study one bar ago.
    ref(-3, 3) will look back three bars and return all three values between the current bar and the bar 3 bars ago
    You can even do:
    ref(-1, -3) for the same effect, but with the order of the bars returned from most recent to oldest.
    Garth

    Comment


    • #3
      Any Documentation on REF function?

      Thanks for your reply Garth.

      Is there any online reference for the Ref function syntax? Also I'd like to know if you know of any code snippets I might look at.

      I'm puzzled as to how the REF function knows which study I want to return the reference to. In other words, how do I point it to the study I want to get past values from?

      Glenn Woolum

      Comment


      • #4
        Hi,

        Well, you are changing the question about a bit now. Before you were talking the same formula, which is what ref() is used for. If you want to determine the results for other studies, you should look at the builtin formula reference, which can be found here

        If you want the results from other formulas, you can use the call or callFunction routines and place the results in an array for reference.

        As for where ref() might be documented - you could try the quickreference guide (located on the same page). Im not really sure if its there, it might not be documented yet - there still are functions that fall into that catagory.

        For code examples, look at EMAwithREF and OBVwithREF both are in formula->library
        Garth

        Comment


        • #5
          Oh, BTW, to clarify, since it wasn't obvious to me when I first read through the builtin reference guide, the syntax for access of past data is the same as using getValue for OHLC and V info. So when you call your builtin function you can specify number of bars back to look and number of bars to return.


          eg:

          MyStudy.getValue(MAStudy.MA, -3, 3)

          would return the last three bars of MA data.

          G
          Garth

          Comment


          • #6
            Garth,

            Much thanks for your posts. The call function as mentioned in your last post worked like a charm.

            Geeze, I hope they get this stuff completely documented soon. EFS is really powerful, and much more flexible than metastock, for instance.

            Happy Hunting,
            Glenn

            Comment


            • #7
              Glad it helped.

              Your not alone in wanting to see a complete set of doc's, and perferably all in one place rather than a bunch of doc's scattered about (file share, on your hard disk in the eSignal/doc's directory, in hard copy with the latest Getting Started with eSignal, etc).
              However, there are two reasons why, for now I doubt this will happen:

              1) They are adding features to efs at a rapid rate. It's very hard for doc's to keep up with this rate of development.

              2) They face a trade off between staffing for features or staffing for documentation. A nice feature list gets you more customers, and this BB is working as a place for people to share their knowledge, so that doc's are as important. I guess that makes me an enabler ;-)

              In any case, best of luck and feel free to ask more q's as you have them. There are now a number of people with solid efs background out there, and most are happy to help.
              Garth

              Comment


              • #8
                EFS Doc

                While it is a challenge to keep up with new information, we have made re-organizing and enhancing our EFS documentation a high priority in Technical Suport. We've now posted the two new EFS guides provided by Brad Metheny and we are expecting 3 more of those. We'll be re-organizing the EFS reference material as well and building a database of all the EFS files we've written thus far so customers can search and explore all the existing material.

                http://www.esignalcentral.com/traini...ng/default.asp

                Thanks.

                Comment

                Working...
                X