Announcement

Collapse
No announcement yet.

previous day high/low

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

  • previous day high/low

    I am new to Esignal (coming from a Tradestation background).

    I have noticed that those OHLC efs files are not accurate when plotted on the index futures. E.g. today, the "Todays Open.efs" will plot the open of the SP500 emini at 1452.5 whereas it opened at 1451.75. I wonder if it looks at the first open price on globex (midnight) rather than the Chicago opening.

    The same discrepancies occur with Previous days high and low indicators. I also assume that it uses data from after the Chicago closing .....

    Is there any way to rectify this? How can I plot the opening data from the 8:30 am CST bar?

    Also, how could I limit this indicator to only use data which occurs between 8:30 am CST and 3:15 CST?

    Thanks.

  • #2
    Beebers
    As far as I can see those are the correct values (see enclosed screenshot taken from the CME site).
    The ES symbol includes the complete session starting from 15:30 CT (or 17:00 on Sundays) to 15:15 CT of the following day.
    To plot the "pit session" data only add an =2 to the symbol ie ES H7=2 (or ES #F=2 for the continuous). Note that the =2 symbols are not available for all futures.
    Alex

    Comment


    • #3
      Very interesting. Thank you.

      Here a screenshot of a comparison of the opening price (in yellow).

      The lower chart uses your suggested ES H7=2 symbol and shows an opening price of 1451.50
      The upper chart uses a time template to display only 6:30 am till 1:15 pm (PST). It shows 1452.5 as its opening price, a price which doesn't show up on the bar.
      Attached Files

      Comment


      • #4
        Beebers
        The reason you are seeing 1452.50 even when the Time Template is set to display only the "pit session" times is because the efs you are using references the daily bar and not the data that is being charted. The Open on the daily bar for ES H7 is 1452.50
        Alex

        Comment


        • #5
          Thank you Alexis,

          I guess I will have to somehow come up with my own version for an opening line. I have browsed through some of Esignal's libraries which would let me define which intraday bar to access in order to plot an opening price, something like, the 6:30 PST bar, or the first bar on today's chart.

          So far I have not found anything yet. If you have any suggestions, I would greatly appreciate any pointers you might have.

          Thanks.

          Comment


          • #6
            Beebers
            There are several ways to accomplish that. Some examples are enclosed below
            Alex

            PHP Code:
            //Example 1- this example assumes you are using a Time Template based on "pit seession" only 
            //declare a global variable ie outside of main() or preMain() and set it initially to null
            var myOpen null;

            //then in main() you can use 
            if(getBarState()==BARSTATE_NEWBAR && day(0)!=day(-1)){//if this is the first tick of a new bar AND 
                                                                  //the bar date is different from previous bar's date
                
            myOpen open(0);//set the variable myOpen to the Open of this bar
            }

            //Example 2
            //declare a global variable ie outside of main() or preMain() and set it initially to null
            var myOpen null;

            //then in main() you can use 
            if(getBarState()==BARSTATE_NEWBAR && (hour(0)*100)+minute(0)==930){//if this is the first tick of a new bar AND 
                                                                               //the bar time is 930
                
            myOpen open(0);//set the variable myOpen to the Open of this bar

            Comment


            • #7
              Alexis,

              Thank you for your answer. I have tried both of your suggestion but always get an error which says

              "Parameter Number 0 of Function getSeries is invalid.

              Here the code

              ------------------------------------
              var myOpen = null

              function preMain() {
              setPriceStudy(true);
              setStudyTitle('Beebs Open');
              setCursorLabelName('O');

              setDefaultBarStyle(PS_DASH);
              setDefaultBarFgColor(Color.yellow);
              setDefaultBarThickness(2);
              setPlotType(PLOTTYPE_FLATLINES);
              }

              var bInit = false;

              function main () {

              if(isMonthly() ||isWeekly() || isDaily())
              return;

              if (bInit == false){
              if(getBarState()==BARSTATE_NEWBAR && (hour(0)*100)+minute(0)==930){
              myOpen = open(0 }
              bInit = true;

              var vOpen = getSeries(myOpen);

              return (vOpen);

              }}

              Comment


              • #8
                The code didn't paste correctly.

                Here again ....

                ---------------------

                var myOpen = null

                function preMain() {
                setPriceStudy(true);
                setStudyTitle('Beebs Open');
                setCursorLabelName('O');

                setDefaultBarStyle(PS_DASH);
                setDefaultBarFgColor(Color.yellow);
                setDefaultBarThickness(2);
                setPlotType(PLOTTYPE_FLATLINES);
                }

                var bInit = false;

                function main () {

                if(isMonthly() ||isWeekly() || isDaily())
                return;

                if (bInit == false){
                if(getBarState()==BARSTATE_NEWBAR && (hour(0)*100)+minute(0)==930){
                myOpen = open(0);
                }
                bInit = true;

                var vOpen = getSeries(myOpen);

                return (vOpen);

                }}

                Comment


                • #9
                  Beebers
                  That error is due to the fact that myOpen is not a series but a value.
                  Enclosed below is a corrected version of your script (with some comments) and a chart showing the plot
                  Alex

                  PHP Code:
                  var myOpen null

                  function preMain() {
                      
                  setPriceStudy(true);
                      
                  setStudyTitle('Beebs Open');
                      
                  setCursorLabelName('O');

                      
                  setDefaultBarStyle(PS_DASH);
                      
                  setDefaultBarFgColor(Color.yellow);
                      
                  setDefaultBarThickness(2);
                      
                  setPlotType(PLOTTYPE_FLATLINES);
                  }

                  //var bInit = false; ->not required

                  function main () {

                      if(
                  isMonthly() ||isWeekly() || isDaily())
                      return;

                      
                  //if (bInit == false){ ->this would prevent the following condition to execute more than once
                      
                  if(getBarState()==BARSTATE_NEWBAR && (hour(0)*100)+minute(0)==930){
                          
                  myOpen open(0);//open(0) is the value at the current bar of the open() series
                      
                  }
                      
                  //bInit = true; ->not required

                      //var vOpen = getSeries(myOpen);//myOpen is not a series but a value

                      
                  return myOpen;//(vOpen); -> vOpen is not valid
                  }//} ->redundant closing bracket 

                  Comment


                  • #10
                    Alex, you made my day. Thank you.

                    Comment


                    • #11
                      Beebers
                      You are most welcome.
                      Alex

                      Comment

                      Working...
                      X