Announcement

Collapse
No announcement yet.

avg daily range indicator request

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

  • avg daily range indicator request

    Requesting an efs line plot indicator based on average of daily range for past X days.
    Thanks.
    Michael

  • #2
    Go get it...

    Michael,

    I have posted an Avg. Daily Range file on my esignal group (http://share.esignal.com/groupconten...er=&groupid=33). You will find this file there.

    If you need any help converting it, let me know. Otherwise, I will convert it and post it up to my group today for you..

    Brad
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      Brad,
      what is the name of the efs in your file share group? i don't see any entitled avg. daily range. Thanks.
      Michael

      Comment


      • #4
        MENT Bar Range

        The file name is MENT BAR RANGE...

        B
        Brad Matheny
        eSignal Solution Provider since 2000

        Comment


        • #5
          thanks...i see. not quite what i had in mind and i'm afraid i was unclear originally.
          I'd like an line indicator to show on an intra-day chart the average daily range for past X (like 7) trading days. It would be even nicer to have it weighted, similar to weighted moving average.
          Does this make sense?
          ps - I suck at programming...makes my temples ache and gives me a white hot poker in back of my neck. So, i appreciate all the help.
          Michael

          Comment


          • #6
            New File Posted

            Mike,

            I just posted a new file with the Avg.Daily Range function to my group.

            Go get it and let me know if it is what you want..

            Brad
            Brad Matheny
            eSignal Solution Provider since 2000

            Comment


            • #7
              Brad,
              Appreciate the effort.
              Here's what i'd like. E.g., on ES H3=2 (6:30-13:00pst).
              2-25 23.75 is it's day's range today
              2-24 14.25
              2-23 22.50
              2-22 13.75
              2-21 12.00
              _________
              = 86.25 / 5days = 17.25 for average last 5 days
              I'd like a line indicator which would display 17.25 for entire day tomorrow on my intraday chart, then after tomorrow's range is complete, the indicator would change to it's new average.
              Thanks.
              Michael

              Comment


              • #8
                Solution...

                As far as I know, this is not entirely possible at this time. There is a solution, but I have to re-write the code...

                The immediate solution is to load this indicator onto a Daily chart and change the User-Input to 5. This will give you the range from the daily chart and allow you to use this on your intraday chart..

                B
                Brad Matheny
                eSignal Solution Provider since 2000

                Comment


                • #9
                  i would also be satisfied if it were just an avg. daily range value that appears in my cursor window, and no line indicator, if that is any easier.
                  Michael

                  Comment


                  • #10
                    Brad,

                    Don't know if this would help, but this code is from Previous Day Daily Bar efs.

                    /************************************************** **************************************************
                    Copyright © eSignal, a division of Interactive Data Corporation. 2002. All rights reserved.
                    This sample eSignal Formula Script (EFS) may be modified and saved under a new
                    filename; however, eSignal is no longer responsible for the functionality once modified.
                    eSignal reserves the right to modify and overwrite this EFS file with each new release.
                    ************************************************** ************************************************** */
                    function preMain() {
                    setPriceStudy(true);
                    setStudyTitle("PDDB");
                    setCursorLabelName("PD-O", 0); // Open
                    setCursorLabelName("PD-H", 1); // High
                    setCursorLabelName("PD-L", 2); // Low
                    setCursorLabelName("PD-C", 3); // Close

                    /*
                    * Set the properties of the default bar. These will be the
                    * properties of any bar for which style, color, thickness is
                    * not specificed.
                    */
                    setDefaultBarStyle(PS_SOLID, 0); // Open
                    setDefaultBarStyle(PS_SOLID, 1); // High
                    setDefaultBarStyle(PS_SOLID, 2); // Low
                    setDefaultBarStyle(PS_SOLID, 3); // Close

                    setDefaultBarFgColor(Color.red, 0); // Open
                    setDefaultBarFgColor(Color.black, 1); // High
                    setDefaultBarFgColor(Color.black, 2); // Low
                    setDefaultBarFgColor(Color.blue, 3); // Close

                    setDefaultBarThickness(2, 0); // Open
                    setDefaultBarThickness(4, 1); // High
                    setDefaultBarThickness(4, 2); // Low
                    setDefaultBarThickness(2, 3); // Close

                    setPlotType(PLOTTYPE_FLATLINES, 0); // Open
                    setPlotType(PLOTTYPE_FLATLINES, 1); // High
                    setPlotType(PLOTTYPE_FLATLINES, 2); // Low
                    setPlotType(PLOTTYPE_FLATLINES, 3); // Close


                    }

                    var vSymbol = null;
                    var vInterval = null;
                    var vLastRawTime = null;
                    var vLastO = null;
                    var vLastH = null;
                    var vLastL = null;
                    var vLastC = null;


                    /*
                    * This is a neat formula because it is working on multiple intervals
                    * sBarItem will be "Open", "High", "Close", or "Low"
                    *
                    */
                    function main(bShowOpen, bShowHigh, bShowLow, bShowClose) {
                    if(bShowOpen == null)
                    bShowOpen = true;
                    if(bShowHigh == null)
                    bShowHigh = true;
                    if(bShowLow == null)
                    bShowLow = true;
                    if(bShowClose == null)
                    bShowClose = true;


                    var vBarTime;
                    var vAbsTime;
                    var vIndex;

                    var nState = getBarState();
                    if(nState == BARSTATE_ALLBARS) {
                    vLastRawTime = null;
                    vLastO = null;
                    vLastH = null;
                    vLastL = null;
                    vLastC = null;
                    vSymbol = getSymbol();
                    vInterval = getInterval();
                    vSymbol += ",D";

                    }

                    if(vInterval == null)
                    return;

                    /*
                    * No need to show the OHL or C on a daily chart.
                    * only interested in seeing OHLorC on intraday.
                    */
                    if(vInterval == "D" || vInterval == "W" || vInterval == "M")
                    return;


                    vRawTime = getValue("rawtime");
                    if(vRawTime == null)
                    return;

                    vRawTime = Math.floor(vRawTime / RawTime.DAY);

                    // Start of Performance addition
                    if(vLastRawTime != null) {
                    if(vRawTime == vLastRawTime) {
                    return new Array(vLastO, vLastH, vLastL, vLastC);
                    }
                    }

                    /*
                    * What time is the current bar?
                    */
                    vBarTime = getValue("time");

                    if(vBarTime != null) {
                    /*
                    * vTime is currently the time for the current intraday bar.
                    * Ask for the time of the previous trading day for "Symbol,D"
                    * Note: See that we are asking for a different time frame
                    * than the default by passing a symbol,interval
                    */
                    vAbsTime = getPreviousTradingDay(vBarTime, vSymbol);
                    if(vAbsTime == null)
                    return;

                    /*
                    * Get index to first bar of day. In this case the daily bar.
                    */
                    vIndex = getFirstBarIndexOfDay(vAbsTime, vSymbol);
                    if(vIndex != null) {
                    vO = getValueAbsolute("Open", vIndex, vSymbol);
                    vH = getValueAbsolute("High", vIndex, vSymbol);
                    vL = getValueAbsolute("Low", vIndex, vSymbol);
                    vC = getValueAbsolute("Close", vIndex, vSymbol);
                    vLastRawTime = vRawTime;
                    vLastO = vO;
                    vLastH = vH;
                    vLastL = vL;
                    vLastC = vC;
                    return new Array(vO, vH, vL, vC);
                    }
                    }
                    return null;

                    }
                    Michael

                    Comment


                    • #11
                      Brad (or anyone),

                      From previous post, was wondering if way to get range data from that code and incorporate into said indicator efs?
                      Michael

                      Comment


                      • #12
                        The attached efs will plot both the range of the prior day and a user defined average of the ranges (default is 5 days).
                        Note that the EFS requires getPrevDaysOHLC.efs in the OHLC subfolder of Formulas. If you do not have it you can find a copy here
                        Alex

                        Attached Files

                        Comment

                        Working...
                        X