Announcement

Collapse
No announcement yet.

Opening Range Time Parameters

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

  • Opening Range Time Parameters

    I tried copying this formula from this http://forum.esignal.com/showthread....5&pagenumber=1 thread, and adding the function that Alexis recommended in the main function. My script now looks like this, but I get an error message in line 58 which states that efsInternal is not defined. Does anybody know what that means?

    Thanks,
    Whinston


    var fpArray = new Array();

    function preMain() {

    setPriceStudy(true);
    setStudyTitle("Opening Range AM");
    setCursorLabelName("Range High", 0);
    setCursorLabelName("Range Low", 1);
    setPlotType(PLOTTYPE_FLATLINES,0);
    setPlotType(PLOTTYPE_FLATLINES,1);
    setDefaultBarFgColor(Color.black,0);
    setDefaultBarFgColor(Color.black,1);
    setDefaultBarThickness(4,0);
    setDefaultBarThickness(4,1);
    setShowTitleParameters(false)

    var x=0;
    fpArray[x] = new FunctionParameter("xStart", FunctionParameter.NUMBER);
    with(fpArray[x++]){
    setName("Start Time");
    setLowerLimit(0);
    setDefault(930);
    }
    fpArray[x] = new FunctionParameter("xEnd", FunctionParameter.NUMBER);
    with(fpArray[x++]){
    setName("End Time");
    setLowerLimit(0);
    setDefault(945);
    }
    fpArray[x] = new FunctionParameter("xInterval", FunctionParameter.NUMBER);
    with(fpArray[x++]){
    setName("Ext Interval Used");
    setLowerLimit(1);
    setDefault(3);
    }
    fpArray[x] = new FunctionParameter("xDisplay", FunctionParameter.STRING);
    with(fpArray[x++]){
    setName("Display");
    addOption("Show");
    addOption("Hide");
    setDefault("Show");
    }
    }

    var bInit = false;
    var xRange = null;
    var vReturn=0;

    function main(xStart,xEnd,xInterval,xDisplay) {

    if ( getBarState() == BARSTATE_ALLBARS ) return; // Exit Script if we are loading still

    if((hour(0)*100)+minute(0)>1300) return;

    vReturn=0;

    if(bInit==false){
    xRange = efsInternal("calcOR",xStart,xEnd,xDisplay,inv(xInt erval));
    bInit=true;
    }

    //setBarBgColor(Color.RGB(241,255,241), 0, getSeries(xRange,1), getSeries(xRange,0) )

    //if ( getBarState() == BARSTATE_NEWBAR && close() > getSeries(xRange,0) ) debugPrintln("We are over opening range");
    //if ( getBarState() == BARSTATE_NEWBAR && close() < getSeries(xRange,1) ) debugPrintln("We are BELOW opening range");

    return new Array(getSeries(xRange,0),getSeries(xRange,1));
    }


    var vFlag = true;
    var vFlag2 = true
    var vHigh = null;
    var vLow = null;
    var vClose = null;
    var vDay1 = null;
    var vDay2 = null;

    function calcOR(start,end,display,source){

    if (getBarState() == BARSTATE_NEWBAR) {
    if (vDay1 == null) {
    vDay2 = getDay(0);
    } else {
    vDay2 = vDay1;
    }
    vDay1 = getDay(0);
    if (vDay1 != vDay2) {
    vHigh = null;
    vLow = null;
    vFlag = true;
    vFlag2 = false;
    }
    var vHour1 = (getHour()*100)+getMinute();
    if(vHour1 >= start){
    vFlag2=true;
    }
    var vHour = (getHour()*100)+getMinute();
    if (vHour >= end) {
    vFlag = false;
    vFlag2=false;
    }
    }

    if (vFlag == true&&vFlag2==true) {
    if (vHigh == null) {
    vHigh = high(0);
    }
    if (vLow == null) {
    vLow = low(0);
    }
    vHigh = Math.max(high(0), vHigh);
    vLow = Math.min(low(0), vLow);
    }

    if(display=="Hide"){
    if(vFlag==false&&vHigh!=null&&vLow!=null){
    var vHigh2 = vHigh;
    var vLow2 = vLow;
    }
    }else if(display=="Show"){
    var vHigh2 = vHigh;
    var vLow2 = vLow;
    }



    return new Array(vHigh2,vLow2);
    }

  • #2
    Re: How to plot the opening range?

    Whinston
    FWIW the formula you posted is working fine as you can see in the enclosed screenshot
    Alex




    Originally posted by whinston
    I tried copying this formula from this thread, and adding the function that Alexis recommended in the main function. My script now looks like this, but I get an error message in line 58 which states that efsInternal is not defined. Does anybody know what that means?

    Thanks,
    Whinston


    var fpArray = new Array();

    function preMain() {

    setPriceStudy(true);
    setStudyTitle("Opening Range AM");
    setCursorLabelName("Range High", 0);
    setCursorLabelName("Range Low", 1);
    setPlotType(PLOTTYPE_FLATLINES,0);
    setPlotType(PLOTTYPE_FLATLINES,1);
    setDefaultBarFgColor(Color.black,0);
    setDefaultBarFgColor(Color.black,1);
    setDefaultBarThickness(4,0);
    setDefaultBarThickness(4,1);
    setShowTitleParameters(false)

    var x=0;
    fpArray[x] = new FunctionParameter("xStart", FunctionParameter.NUMBER);
    with(fpArray[x++]){
    setName("Start Time");
    setLowerLimit(0);
    setDefault(930);
    }
    fpArray[x] = new FunctionParameter("xEnd", FunctionParameter.NUMBER);
    with(fpArray[x++]){
    setName("End Time");
    setLowerLimit(0);
    setDefault(945);
    }
    fpArray[x] = new FunctionParameter("xInterval", FunctionParameter.NUMBER);
    with(fpArray[x++]){
    setName("Ext Interval Used");
    setLowerLimit(1);
    setDefault(3);
    }
    fpArray[x] = new FunctionParameter("xDisplay", FunctionParameter.STRING);
    with(fpArray[x++]){
    setName("Display");
    addOption("Show");
    addOption("Hide");
    setDefault("Show");
    }
    }

    var bInit = false;
    var xRange = null;
    var vReturn=0;

    function main(xStart,xEnd,xInterval,xDisplay) {

    if ( getBarState() == BARSTATE_ALLBARS ) return; // Exit Script if we are loading still

    if((hour(0)*100)+minute(0)>1300) return;

    vReturn=0;

    if(bInit==false){
    xRange = efsInternal("calcOR",xStart,xEnd,xDisplay,inv(xInt erval));
    bInit=true;
    }

    //setBarBgColor(Color.RGB(241,255,241), 0, getSeries(xRange,1), getSeries(xRange,0) )

    //if ( getBarState() == BARSTATE_NEWBAR && close() > getSeries(xRange,0) ) debugPrintln("We are over opening range");
    //if ( getBarState() == BARSTATE_NEWBAR && close() < getSeries(xRange,1) ) debugPrintln("We are BELOW opening range");

    return new Array(getSeries(xRange,0),getSeries(xRange,1));
    }


    var vFlag = true;
    var vFlag2 = true
    var vHigh = null;
    var vLow = null;
    var vClose = null;
    var vDay1 = null;
    var vDay2 = null;

    function calcOR(start,end,display,source){

    if (getBarState() == BARSTATE_NEWBAR) {
    if (vDay1 == null) {
    vDay2 = getDay(0);
    } else {
    vDay2 = vDay1;
    }
    vDay1 = getDay(0);
    if (vDay1 != vDay2) {
    vHigh = null;
    vLow = null;
    vFlag = true;
    vFlag2 = false;
    }
    var vHour1 = (getHour()*100)+getMinute();
    if(vHour1 >= start){
    vFlag2=true;
    }
    var vHour = (getHour()*100)+getMinute();
    if (vHour >= end) {
    vFlag = false;
    vFlag2=false;
    }
    }

    if (vFlag == true&&vFlag2==true) {
    if (vHigh == null) {
    vHigh = high(0);
    }
    if (vLow == null) {
    vLow = low(0);
    }
    vHigh = Math.max(high(0), vHigh);
    vLow = Math.min(low(0), vLow);
    }

    if(display=="Hide"){
    if(vFlag==false&&vHigh!=null&&vLow!=null){
    var vHigh2 = vHigh;
    var vLow2 = vLow;
    }
    }else if(display=="Show"){
    var vHigh2 = vHigh;
    var vLow2 = vLow;
    }



    return new Array(vHigh2,vLow2);
    }

    Comment


    • #3
      Re: Re: How to plot the opening range?

      Thanks for trying it out. Unfortunately, it seems to give an error on my machine. I quoted it exactly (in fact, I simply copied and pasted it here). So why am I getting this error message? It says:

      Wizard\WhinstonsEFS.efs, line 58: Reference Error: efsInternal is not defined.

      Thanks for any further insight,
      Whinston

      Comment


      • #4
        Re: Re: Re: How to plot the opening range?

        Whinston
        What version [and build] of eSignal are you running (see under Help->About)?
        Alex


        Originally posted by whinston
        Thanks for trying it out. Unfortunately, it seems to give an error on my machine. I quoted it exactly (in fact, I simply copied and pasted it here). So why am I getting this error message? It says:

        Wizard\WhinstonsEFS.efs, line 58: Reference Error: efsInternal is not defined.

        Thanks for any further insight,
        Whinston

        Comment


        • #5
          I'm using build 7.6, build 636A.

          Sorry it's not the newest one, but I love this version and I don't want to upgrade. Hopefully you can figure out for this version.

          Thanks,
          Whinston

          Comment


          • #6
            Whinston
            The formula uses several EFS2 functions amongst which efsInternal() which were introduced with version 7.9 [build 719] and are not available on earlier versions so if you want to run it you will need to upgrade
            Alex


            Originally posted by whinston
            I'm using build 7.6, build 636A.

            Sorry it's not the newest one, but I love this version and I don't want to upgrade. Hopefully you can figure out for this version.

            Thanks,
            Whinston

            Comment


            • #7
              Ok thanks. I'm considering upgrading, but before I go to that trouble, could you possibly show me a screenshot of a 3-minute chart with this EFS? Previously you had showed me a 15-minute chart, but what I would really like to see is a 3-minute chart.

              I do realize that the EFS is calculated on the first 15 minutes of trading.

              Thanks so much,
              Whinston

              Comment


              • #8
                Whinston
                Enclosed below is a screenshot of the script running on a 3 minute chart
                Alex




                Originally posted by whinston
                Ok thanks. I'm considering upgrading, but before I go to that trouble, could you possibly show me a screenshot of a 3-minute chart with this EFS? Previously you had showed me a 15-minute chart, but what I would really like to see is a 3-minute chart.

                I do realize that the EFS is calculated on the first 15 minutes of trading.

                Thanks so much,
                Whinston

                Comment


                • #9
                  Wow, thanks alot Alexis,

                  Whinston

                  Comment


                  • #10
                    Whinston
                    My pleasure
                    Alex


                    Originally posted by whinston
                    Wow, thanks alot Alexis,

                    Whinston

                    Comment


                    • #11
                      Line 11 and Line 12 of this EFS state the following:

                      setDefaultBarFgColor(Color.black,0);
                      setDefaultBarFgColor(Color.black,1);

                      I'd like to change the color to an RGB color, such as 71,94,79.

                      How would I go about doing this?

                      Thanks for any info,
                      whinston

                      Comment


                      • #12
                        Forget it, I just figured it out... Thanks!

                        whinston

                        Comment


                        • #13
                          If anyone is interested, the two lines would look like this:


                          setDefaultBarFgColor(Color.RGB(71,94,79),0);
                          setDefaultBarFgColor(Color.RGB(71,94,79),1);

                          whinston

                          Comment

                          Working...
                          X