Announcement

Collapse
No announcement yet.

Accessing previous open, high, low

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

  • Accessing previous open, high, low

    I'm a real novice at this and am trying to write a formula that will place a couple of lines on an intraday chart.

    The lines are calculated with data from prior daily bar's high, low, and open. Getting to this data has me stumped.

    Is there an easy way to access this data? I used to use Stock Watch Pro and the way I did it there was with this kind of code: Bar[Close,D,2]
    This gave me the close of the daily bar, two days ago.
    Thanks in advance.

  • #2
    Check out the EFS Studies section for EFS files that do pivots that effectively do what you want . Pivoy studies do calculations based on the values of previous day's close , open etc. to plot lines on todays chart . An example to get you start should be available on this thread .

    Comment


    • #3
      Thank you for response. Frankly, I checked out the formula for plain pivot, and was hoping there was easier way. I have no idea what the coding is/does for the pivot line.

      I find this a bit disappointing that what used to take me one little command now takes a whole function of its own.

      Couldn't I just use getValue("High", -1, 1, "D") for instance?

      If not, does anyone know where to find some explanation in detail for a newbie as to what Rawtime and Bar time is all about and how to use it.

      Comment


      • #4
        Coolmoss:

        If all you want to do is to display bands for yesterday's close/open on today's intraday chart, the following logic should work for you.

        nClose = close(0, getSymbol()+",D");
        nOpen = open(0, getSymbol()+",D");
        addBand(nClose, PS_SOLID, 2, Color.red, 1);
        addBand(nOpen, PS_SOLID, 2, Color.blue, 2);

        You might want to enclose it within a conditional so that it only
        gets executed once.

        if (getCurrentBarIndex()==0) {
        nClose = close(0, getSymbol()+",D");
        nOpen = open(0, getSymbol()+",D");
        addBand(nClose, PS_SOLID, 2, Color.red, 1);
        addBand(nOpen, PS_SOLID, 2, Color.blue, 2);
        }

        Chris

        Comment


        • #5
          ckryza,

          That's what I thought too, but if I use your code as suggested, I should get a nice horizontal line, that jumps to a new level for each day. Instead I get a fluctuating line with values that make no sense.

          Comment


          • #6
            You need a method for synching the daily values with the intrday chart. Typically this is done by taking the time object returned by getPreviousTradingDay() and using it in getFirstBarIndexOfDay().

            Garth
            Garth

            Comment


            • #7
              This efs may do most of what you want
              Attached Files

              Comment

              Working...
              X