Announcement

Collapse
No announcement yet.

Nasdaq Volume efs

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Nasdaq Volume efs

    Since there is no volume associated with $COMPQ I made one.
    It derives a bar by bar indicator by subtracting the open from the close on $TVOLQ and plots as histogram. Seems to work well. I'm trying to add a moving average of this volume to plot on top of the volume histogram but can not get it to plot the MA. Could someone taek a look at this and tell me how to get the MA of volume to Plot? Right now all I get is a straight line for the Ma of the volume. Would be most appreciated.

    Here is the efs.


    function preMain() {
    setStudyTitle("Naz Vol");
    setCursorLabelName("Naz Vol", 0);
    setCursorLabelName("Ave Vol", 1);
    setPlotType(PLOTTYPE_HISTOGRAM,0);
    setDefaultBarThickness(3);
    setDefaultBarFgColor(Color.blue, 0);
    setPlotType(PLOTTYPE_LINE, 1);
    setDefaultBarFgColor(Color.purple, 1);
    addBand(0, PS_SOLID, 1, Color.black,2);

    }


    function main(nInputLength) {
    if (nInputLength == null)
    nLength = 50;

    var nLength = nInputLength;
    var i;
    var vSum;


    var vValue = close(0,1,"$TVOLQ")-open(0,1,"$TVOLQ");

    if(vValue == null) {
    return;
    }

    for(i = 0; i < nLength; i++) {
    vSum += vValue[i];
    }

    return new Array(vValue, vSum/nLength);

    }

  • #2
    Here's my try at it... Please note that it doesn't have an input parameter due to the need to create the size of the global array outside of main(). If anyone knows a work-around, please post.

    Thanks,
    Jay F.
    eSignal Community Support
    Attached Files
    Regards,
    Jay F.
    Product Manager
    _____________________________________
    Have a suggestion to improve our products?
    Click Support --> Request a Feature in eSignal 11

    Comment


    • #3
      Thanks JayF. It seems to work while the market is closed and looks good.. Will try Mon when the market opens.

      It would be nice to have an input, so any other wizard coders that might have an solution to make the moving average periods an input would be most appreciated to take a shot at it.

      JayF, is it too much to ask why the simple approach I was trying seems to work on some other things, but doesn't work on this one. Is it because I am calling data from a symbol instead of from the chart I'm on?

      Comment


      • #4
        You don't have to set the size of the array up front, push and such can add to the size as needed.

        You can also use array.length to both determine the siz eof an array or to set it.

        Garth
        Garth

        Comment


        • #5
          gspiker, thanks, but this neophyte doesn't understand your comments. Could you perhaps explain further or post an example?

          bigtee

          Comment


          • #6
            Originally posted by bigtee
            JayF, is it too much to ask why the simple approach I was trying seems to work on some other things, but doesn't work on this one. Is it because I am calling data from a symbol instead of from the chart I'm on?
            The reason your code wasn't working is because vValue's data needs to be stored in a Global Array in order to be accessed for later use. To do this, you can use...

            var vArray = new Array();

            and then store the data for each new bar by this code...

            if (nBarState == BARSTATE_NEWBAR && vValue != null) {
            vArray.pop(); //removes last array element
            vArray.unshift(vValue); //inserts array element to the front of the array
            }

            Once the data is stored, it can then be summed up for use in the Moving Average calculation as you had done previously.

            I'll have an updated version posted shortly that has an input parameter.
            Regards,
            Jay F.
            Product Manager
            _____________________________________
            Have a suggestion to improve our products?
            Click Support --> Request a Feature in eSignal 11

            Comment


            • #7
              Here's an updated version.

              PHP Code:
              function preMain() {
              setStudyTitle("Naz Vol");
              setCursorLabelName("Naz Vol"0);
              setCursorLabelName("Ave Vol"1);
              setPlotType(PLOTTYPE_HISTOGRAM,0);
              setDefaultBarThickness(3);
              setDefaultBarFgColor(Color.blue0);
              setPlotType(PLOTTYPE_LINE1);
              setDefaultBarFgColor(Color.purple1);
              addBand(0PS_SOLID1Color.black,2);

              }

              var 
              vArray = new Array();


              function 
              main(nLength) {

              if (
              nLength == null) {
                  
              nLength 50;
              } else {
                  
              nLength Math.round(nLength);
              }

              var 
              close(0,"$TVOLQ");
              var 
              open(0,"$TVOLQ");

              if (
              == null || == null) return;

              var 
              vValue o;

              // if (vValue == null) return;

              var nBarState getBarState();
                  
              if (
              nBarState == BARSTATE_NEWBAR) {
                  
              // vArray.pop();              //removes last array element
                  
              vArray.unshift(vValue);   //inserts array element to the front of the array 
              } else {
                  
              vArray[0] = vValue;
              }

              if (
              vArray[nLength-1] != null) { // check to make sure array is full
                  
              var vSum 0;
                  for(
              0nLengthi++) {
                      
              vSum += vArray[i];
                  }
                  var 
              vAvgVol vSum nLength;

              } else {
                  return;
              }

              // Clean-up code

              if (vArray.length nLengthvArray.pop();

              return new Array(
              vValuevAvgVol);


              Attached Files
              Regards,
              Jay F.
              Product Manager
              _____________________________________
              Have a suggestion to improve our products?
              Click Support --> Request a Feature in eSignal 11

              Comment


              • #8
                Wow! Thanks, JayF. This is exactly what I was looking for. Also thanks for the explanation of why my attempt did not work.

                I suggest you add a header (std eSig one that says what this does), change the file name to something like "COMPQ Vol Histogram.efs", and post it in the appropriate file location. There are probably others interested in this.

                You could make another one for the NYSE vol histogram by just changing the Symbol to $TVOL.

                For those that wonder what this does, there are no volume bars associated with the Nasdaq Composite symbol $COMPQ. The symbol $TVOLQ gives a CUMULATIVE volume of $COMPQ for each day. This efs derives the bar by bar volume of the $COMPQ and plots it as a standard volume histogram. It allows the user to enter a certain number of periods and calculate a moving average of the volume.

                So now we have the bar by bar volume of the Nasdaq Composite and can plot it just like the volume for any other security.

                Thanks again.

                Comment


                • #9
                  bigtee,

                  Thanks for the ideas. I have posted these new formulas to our EFS Library Discussion Board under the "Misc" forum. I also added some code, so that if a Daily, Weekly or Monthly chart is selected, then the study will still perform normally.
                  Regards,
                  Jay F.
                  Product Manager
                  _____________________________________
                  Have a suggestion to improve our products?
                  Click Support --> Request a Feature in eSignal 11

                  Comment


                  • #10
                    JayF, when I click on the link you provided it won't let me got there. Also I can't find a forum called "EFS Library Discussio Board". Where is it?

                    bigtee

                    Comment


                    • #11
                      My apologies. The Library board is currently not yet released for public viewing, but this should be available in the next day or two. In the meantime, please use the below links to grab these EFS files.

                      COMPQ Volume.efs
                      NYA Volume.efs
                      Regards,
                      Jay F.
                      Product Manager
                      _____________________________________
                      Have a suggestion to improve our products?
                      Click Support --> Request a Feature in eSignal 11

                      Comment


                      • #12
                        Hello,

                        The studies COMPQ_Volume.efs and NYA_Volume.efs show something close to $TVOLQ and $TVOL on daily and intraday charts. The volume is always slightly lower than $TVOLQ and $TVOL (it seems the difference is related to subtracting the open of the current bar from the close of the current bar rather than subtracting the prior bar's close from the current bar's close). Even though it is not exactly correct, for visual analysis of charts it is basically close enough.

                        But when I pull up a weekly chart, these two studies only show Friday's close as the volume for the entire week. I notice this is also true of $TVOLQ and $TVOL themselves -- on weekly charts they do not show the total volume for the week, just Friday's volume. Does a study exist which will accurately show the weekly total exchange volumes for both the NASDAQ and NYSE?

                        Thanks,
                        Jason

                        Comment


                        • #13
                          Hello Jason,

                          These studies are intended for intraday intervals only as they are based on the cumulative result during the day. If they are used on DWM intervals they simply plot the close of these symbols as you've indicated. I don't know of an existing formula that accomplishes what you've described. You may want to post this question in the New Study Suggestions forum to see if any other members have created one.
                          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