Announcement

Collapse
No announcement yet.

TRIN value of an specific (date & time) bar

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

  • TRIN value of an specific (date & time) bar

    I need to retrieve the value of an specific bar for a different symbol that the one displayed in the Advanced Chart

    For example, in an ES #F Adv. Chart, I want the value of the TRIN for January 16 at 11:35 am

    Can anybody lend a hand

  • #2
    figure out what time it is now,

    figure out how much time has elapsed from the date of interest

    retreive the data from -ElapsedBars

    is the way I would tackle the problem

    Comment


    • #3
      For example,

      there are 65 bars per day

      there have been 13 days

      plus 41 bars on the 16th

      so look back 65*13+41 bars or so to find the trin.

      trin651341=close(trin,-65*13+41)

      Comment


      • #4
        David's suggestion isn't bad, unless you want something that will work on any timeframe, though I guess you could have the efs do the calculation of how many bars per-day etc. Even then you will run into problems with short days.

        You could use getvalue("rawtime") to get a more flexible answer, but that would be more complex to code and would take more processor time.
        Garth

        Comment


        • #5
          I have a similar question.

          What is the correct way to overlay TRIN on the top of ES #F=2 (please note that data end times are different for the two streams ...).

          Could somebody provide sample code please?

          Thanks

          Comment


          • #6
            Thank you David and Garth for your answer

            Unfortunately I can't use a reference for nn bars ago with TRIN because always there are missing bars in between and this causes an out of sync if we refer to bar numbers.

            I have been looking RawTime approach.

            Garth, would you please tell me : if I have the RawTime for the bar I want ( for example 1.044.437.400 ). How can I access the $TRIN,1 close value of this RawTime number ?

            Comment


            • #7
              juano,

              I think if you use ratio of bars (ie: number of bars for NQ in a day as it relates to number of bars of TRIN), then David's method will work.

              If you want to use rawtime, you would have to do a loop and check the values of rawtime of from a getValueAbsolute("rawtime",0,-nFirstBar, "$TRIN,1");

              where nFirstbar is set from getOldestBarIndex("$TRIN,1");

              Alternatey - you could use the heavier weight getValue("Time") like this:

              var vTime = getValue("Time",0,nIndexIWant);

              if(vTime != null) {

              var vFirstIndex = getFirstBarIndexOfDay(vTime,"$TRIN,1");

              and as long as vFirstIndex != null loop from there til you find it.



              Since rawtime is lighter weight, but the loop will be much longer I'm nit sure which way will invoke more overhead. In part it will depend on how many bars of history you have.
              Garth

              Comment


              • #8
                same problem

                I'm having the same exact problem, I want to create an indicator with $TRIN closing prices, but the date/time is not lining up correctly with any symbol, due to the fact that the start/end times for $TRIN are different and its also missing data is some places.

                Has anyone come up with a valid solution, would appreciate any help, thanks

                Comment

                Working...
                X