Announcement

Collapse
No announcement yet.

Help with series object

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

  • Help with series object

    I am modifying the script below but on studying it I am confused about the statement: vVol = volume();

    volume() as I understand it is a series object but the variable it is being assigned to was defined as a single value object. Is this line somehow equivalent to vVol = volume(0); ?

    Did the assign statement convert it?

    Mike


    /************************************************** ***************
    Provided By : eSignal. (c) Copyright 2004
    ************************************************** ***************/

    function preMain() {
    setStudyTitle("Cumulative Volume ");
    setCursorLabelName("CumVol");
    setPlotType(PLOTTYPE_HISTOGRAM);
    setDefaultBarThickness(3);
    }

    var vVol = 0;
    var vLastVol = 0;
    var TotVol = 0;

    function main() {
    if (getBarState() == BARSTATE_NEWBAR) {
    if (getDay(0) != getDay(-1)) TotVol = 0;
    vLastVol = 0;
    } else {
    vLastVol = vVol;
    }

    vVol = volume();
    TotVol += (vVol - vLastVol);

    return TotVol;
    }
    ....Mike

  • #2
    Hi mike_scott,

    If you look at the date on the efs, this was before the onset of efs2 and series objects in 2005. See this link and this link.

    Backwards compatibility had to be maintained as I remember and additional conditionals are used in the built in function/Series object.

    Use the bar index. Based on my testing, it bypasses the internal conditionals and is much more efficient.

    Comment


    • #3
      Originally posted by stevehare2003
      Hi mike_scott,

      If you look at the date on the efs, this was before the onset of efs2 and series objects in 2005. See this link and this link.

      Backwards compatibility had to be maintained as I remember and additional conditionals are used in the built in function/Series object.

      Use the bar index. Based on my testing, it bypasses the internal conditionals and is much more efficient.
      Thank you Steve. I have been writing scripts for just a few years and was unaware of some of the compatibility issues. Your comment helped a lot.

      Mike
      ....Mike

      Comment


      • #4
        Hi Mike,

        You are most welcome, good to hear this helped out.

        Steve

        Comment

        Working...
        X