Announcement

Collapse
No announcement yet.

Daily range 1/4's extentions

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

  • Daily range 1/4's extentions

    Hi all, i changed a pivot point EFS to plot me the 1/4's of the yesterday daily bar range above the High/Low of the day. but i need to know if there is possible to do the folowing.

    1. plot only today extentions, that is, erase all lines in the past of the chart except today extentions.
    2. being able to show/hide the extentions using some buttom in the chart, like some i saw in a murray math script.
    3. if possible, this is just a luxuriouse issue, a way to show the extentions until 100% and only if buttom clicked show the full extentions until 200%.

    I have two scrips, one for up extentions and another to down extentions, if button works with hide/show, it is possible to merge both efs and do a up/down buttoms?

    Will apreciate all help.

    Best Regards

    Gil Araújo

    Below the code


    function preMain() {
    setPriceStudy(true);
    setStudyTitle("Range Expantions DONW");
    setCursorLabelName("0.125", 0);
    setCursorLabelName("0.250", 1);
    setCursorLabelName("0.330", 2);
    setCursorLabelName("0.375", 3);
    setCursorLabelName("0.500", 4);
    setCursorLabelName("0.625", 5);
    setCursorLabelName("0.660", 6);
    setCursorLabelName("0.750", 7);
    setCursorLabelName("0.875", 8);
    setCursorLabelName("1.000", 9);
    setCursorLabelName("1.125", 10);
    setCursorLabelName("1.250", 11);
    setCursorLabelName("1.330", 12);
    setCursorLabelName("1.375", 13);
    setCursorLabelName("1.500", 14);
    setCursorLabelName("1.625", 15);
    setCursorLabelName("1.660", 16);
    setCursorLabelName("1.750", 17);
    setCursorLabelName("1.875", 18);
    setCursorLabelName("2.000", 19);
    setCursorLabelName("PrevL", 20);
    //setComputeOnClose(true);

    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarFgColor(Color.RGB(30,144,255), 0);
    setDefaultBarThickness(1, 0);

    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarFgColor(Color.RGB(30,144,255), 0);
    setDefaultBarThickness(1, 1);

    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarFgColor(Color.RGB(30,144,255), 0);
    setDefaultBarThickness(1, 2);

    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarFgColor(Color.RGB(30,144,255), 0);
    setDefaultBarThickness(1, 3);

    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarFgColor(Color.RGB(30,144,255), 0);
    setDefaultBarThickness(1, 4);

    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarFgColor(Color.RGB(30,144,255), 0);
    setDefaultBarThickness(1, 5);

    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarFgColor(Color.RGB(30,144,255), 0);
    setDefaultBarThickness(1, 6);

    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarFgColor(Color.RGB(30,144,255), 0);
    setDefaultBarThickness(1, 7);

    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarFgColor(Color.RGB(30,144,255), 0);
    setDefaultBarThickness(1, 8);

    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarFgColor(Color.RGB(30,144,255), 0);
    setDefaultBarThickness(1, 9);

    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarFgColor(Color.RGB(30,144,255), 0);
    setDefaultBarThickness(1, 10);

    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarFgColor(Color.RGB(30,144,255), 0);
    setDefaultBarThickness(1, 11);

    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarFgColor(Color.RGB(30,144,255), 0);
    setDefaultBarThickness(1, 12);

    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarFgColor(Color.RGB(30,144,255), 0);
    setDefaultBarThickness(1, 13);

    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarFgColor(Color.RGB(30,144,255), 0);
    setDefaultBarThickness(1, 14);

    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarFgColor(Color.RGB(30,144,255), 0);
    setDefaultBarThickness(1, 15);

    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarFgColor(Color.RGB(30,144,255), 0);
    setDefaultBarThickness(1, 16);

    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarFgColor(Color.RGB(30,144,255), 0);
    setDefaultBarThickness(1, 17);

    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarFgColor(Color.RGB(30,144,255), 0);
    setDefaultBarThickness(1, 18);

    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarFgColor(Color.RGB(30,144,255), 0);
    setDefaultBarThickness(1, 19);

    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarFgColor(Color.RGB(30,144,255), 0);
    setDefaultBarThickness(1, 20);
    }

    // globals
    var vOutputArray = null;
    var vLastSeenDay = null;
    var vInterval = null;
    var vSymbol = null;

    function main() {

    // initialize upon first loading formula
    if(getBarState() == BARSTATE_ALLBARS) {

    vInterval = getInterval();
    vSymbol = getSymbol().toUpperCase();

    // for RTH, eg, to convert, ES Z2 to ES Z2=2
    var rootSymbol = vSymbol.substring(0,3);
    if (rootSymbol == "ES " || rootSymbol == "NQ ")
    if ( vSymbol.indexOf("=2") == -1 )
    vSymbol += "=2";

    vSymbol += ",D";
    return null;
    }

    // return null if not an intraday chart
    if(vInterval == null || vInterval == "D" ||
    vInterval == "W" || vInterval == "M" || vInterval == "T")
    return null;

    // if first bar in new day, get and save yesterday's data
    var vThisday = null;
    if (vLastSeenDay != (vThisDay = getDay()) ) {

    var vTime = getValue("Time");
    if(vTime != null) {
    var vYDay = getPreviousTradingDay(vTime,vSymbol);
    if(vYDay != null) {
    var vIndex = getFirstBarIndexOfDay(vYDay,vSymbol);
    if(vIndex != null) {
    var ydayH = getValueAbsolute("High", vIndex,
    vSymbol);
    var ydayL = getValueAbsolute("Low", vIndex,
    vSymbol);
    var ydayC = getValueAbsolute("Close", vIndex,
    vSymbol);
    var yday8th = (ydayH - ydayL) / 8;
    var yday3th = (ydayH - ydayL) / 3;
    var yday0125 = ydayL - yday8th;
    var yday025 = yday0125 - yday8th;
    var yday033 = ydayL - yday3th;
    var yday0375 = yday025 - yday8th;
    var yday050 = yday0375 - yday8th;
    var yday0625 = yday050 - yday8th;
    var yday066 = yday033 - yday3th;
    var yday075 = yday0625 - yday8th;
    var yday0875 = yday075 - yday8th;
    var yday100 = yday0875 - yday8th;
    var yday125 = yday100 - yday8th;
    var yday133 = yday100 - yday3th;
    var yday1375 = yday125 - yday8th;
    var yday150 = yday1375 - yday8th;
    var yday1625 = yday150 - yday8th;
    var yday175 = yday1625 - yday8th;
    var yday166 = yday133 - yday3th;
    var yday175 = yday1625 - yday8th;
    var yday1875 = yday175 - yday8th;
    var yday200 = yday1875 - yday8th;
    var PrevL = ydayL


    vOutputArray = new Array
    (yday0125,yday025,yday033,yday0375,yday050,yday062 5,yday066,yday075,yday0875,
    yday100,yday125,yday133,yday1375,yday150,yday1625, yday166,yday175,yday1875,
    yday200,PrevL);

    vLastSeenDay = vThisDay;
    return vOutputArray;
    }
    }
    return null;
    }
    }
    // else just return the saved data
    else
    return vOutputArray;

    }

  • #2
    update

    ok... i put some colors to it and foud another issue... the decimals.

    There is any way to roud the formulas to give only 2 decimals?

    3.71 instead of 3.7075 like in JDSU picture below.

    Best Regards
    Attached Files

    Comment


    • #3
      Hello Gil,

      Please post your latest version. Use the attachment feature when posting your reply on-line. I have some ideas for your code.

      1 & 2. Yes, we can add a function parameter to turn the display on or off while leaving the historical days numbers visible in the cursor window.

      3. Yes, it's possible also.

      As for the two scripts, why not combine them into one?

      To round your decimal numbers use .toFixed(2)*1. toFixed() rounds to the specified decimal place but converts the number to a string. Multiply by 1 to convert back to a number.

      var yday200 = (yday1875 - yday8th).toFixed(2)*1;
      Jason K.
      Project Manager
      eSignal - an Interactive Data company

      EFS KnowledgeBase
      JavaScript for EFS Video Series
      EFS Beginner Tutorial Series
      EFS Glossary
      Custom EFS Development Policy

      New User Orientation

      Comment


      • #4
        hi... sorry my rookie level

        My ideia is to add 3 or more buttons to do the following.

        add the divisions of yesterday bar, in basic is to place a automatic and more complete fib, if TODAY sessions keeps inside yesterday range.

        if that doen't happen, the ideia is to add the same range divisions above or below the yesterday range. i realy don't want to have my chart full of lines. i only wanted where the price is printing

        if possible, i would like to add 2 levels on eash extention.. 0% to 100% and 100% to 200% above and below

        i posted last version of the script... in this case is only the up version.

        best regards
        Attached Files

        Comment


        • #5
          last version with 2 decimals

          if you see an intraday chart you can see what i mean ... it keeps fulllll

          if i add... yestarday fib plus up and down extentions... it will be unreadable.

          I think it can be done with some kind of buttoms... i can't do it... it you can help me i will realy apreciate that.



          Best Regards
          Attached Files

          Comment


          • #6
            Hello Gil,

            Try the formula below. It will only draw the current day's expansions up to 100% by default. If you click the button in the lower left, you'll see the Edit Studies options. Simply turn on or off the Historical display or 200% option and click OK. The logic in the formula is fairly straightforward. You should be able to easily incorporate these features into your other formula. Let me know if you have any questions.

            garaujo_RangeExpansions.efs

            Jason K.
            Project Manager
            eSignal - an Interactive Data company

            EFS KnowledgeBase
            JavaScript for EFS Video Series
            EFS Beginner Tutorial Series
            EFS Glossary
            Custom EFS Development Policy

            New User Orientation

            Comment


            • #7
              hi again... yes it is exactly that what i was looking for.

              I don't whant to push my luck but, it is possible then to mergue the up, down and fib inside a single efs?

              If so, it is possible to create more buttoms to select what extention or fibonacci i want to see? That is, if the price keeps inside yesterday range, i would like to have the fipanacci retracements of yesterday bar and not the up or down extentions. By other side, if you price moves above/below the high/low of yesterday bar i would like to see only one of the extentions and no fibs.

              Do you think you can help me build that... i have the fib ret and now the up and down EFS... do you thin you can help me mergue them all toguether and build 4 buttoms. One to fibs, one to up one to down and one to that parameters you add to the UP EFS.

              Best Regards

              GIl

              Comment


              • #8
                Hello Gil,

                It would be simple to merge the Up and Down formulas. Not sure about your fib formula. Post your current versions of the Down and fib formulas and I'll at least provide some guidance.
                Jason K.
                Project Manager
                eSignal - an Interactive Data company

                EFS KnowledgeBase
                JavaScript for EFS Video Series
                EFS Beginner Tutorial Series
                EFS Glossary
                Custom EFS Development Policy

                New User Orientation

                Comment


                • #9
                  Down EFS

                  Ok this is basicly yours changed to do the down extention.
                  Attached Files

                  Comment


                  • #10
                    Fib

                    This is the same divisions of the range but inside the yesterday range.

                    I don't know if its also possible put the premain lables acting by the parameters. Like the lines. It is getting huge.....

                    In resume, if possible my idea was having only one EFS where by buttoms we can choose what kind of range divisions we want. Up, Down, Inside or none. I think, if possible to put a buttom to auto extend the range divisions until 200% instead of opening the parameters windows whould be perfect. In that window we the can select the back history ranges or not, but that will be less frequent.

                    If that all that is possible, including removing the labels when extentions are not in use, i think it can be a powerfull tool to analise intraday actions.

                    Many tx for the time you are giving to help me.

                    If you have any doubt please post i will be arrownd.

                    Best Regards

                    Gil Araújo
                    Attached Files

                    Comment


                    • #11
                      Don't know why, but that gannret.efs is not ploting lines in the chart like the other efs... it only gives values on the cursor window. but the ideia is that it should plot the lines like the other two efs...

                      Comment


                      • #12
                        Hello Gil,

                        Ok, here they are combined into one. I didn't set up buttons for each as the Edit Studies method only requires a couple extra mouse clicks by the user and saves a ton of coding. It's much more efficient to do it this way as well.

                        The reason your gannret.efs was not plotting on the price window was because you didn't have the setPriceStudy(true) option included in preMain().

                        For the cursor label window, we only have the option for displaying all or none. If you want to turn off the cursor label names, add setShowCursorLabel(false) to preMain().

                        Interesting formula, have fun.

                        garaujo_RangeExpansions.efs


                        Jason K.
                        Project Manager
                        eSignal - an Interactive Data company

                        EFS KnowledgeBase
                        JavaScript for EFS Video Series
                        EFS Beginner Tutorial Series
                        EFS Glossary
                        Custom EFS Development Policy

                        New User Orientation

                        Comment


                        • #13
                          many many tx....


                          there is any way to label the lines in the chart instead of in the cursor label? that way we can turn them off in the cursor windown and know what ate the lkevels.

                          Comment


                          • #14
                            ok... i have two questions. In the gann part, the scrips is not getting the Daily H and L to make the calculations, it is getting each bar h and l.... and it is not plotting lines like the UP and Down parts, can you help me solve this.

                            I tried to use

                            var h = getValueAbsolute("High", vIndex, vSymbol);
                            var l = getValueAbsolute("Low", vIndex, vSymbol);

                            like in the other ones but it doesnt solve the problem.

                            Best Regards

                            Comment


                            • #15
                              Hello Gil,

                              I was kind of curious about that gann stuff. It didn't seem right. Do you want the Gann daily High and Low to be the current day's or previous day's values?

                              If you add setShowCursorLabel(false) to preMain() the values of the lines still appear on the y-axis labels. Is that sufficient?
                              Jason K.
                              Project Manager
                              eSignal - an Interactive Data company

                              EFS KnowledgeBase
                              JavaScript for EFS Video Series
                              EFS Beginner Tutorial Series
                              EFS Glossary
                              Custom EFS Development Policy

                              New User Orientation

                              Comment

                              Working...
                              X