Announcement

Collapse
No announcement yet.

Pivot Help

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

  • Pivot Help

    I realize pivot questions get asked often, but I haven't found this specific one yet.

    What I would like to know is how do I specify a time period other than weekly/monthly? For example, I would like Highest High Value (HHV), Lowest Low Value (LLV) and the close of a specific three year period. So, for example, for the 3 year period ending 31 Dec 2007, I'd like the above.

    I'd also like the same idea for the last three quarters, i.e. stop on the quarter ending 30 Sep 2008, and find the HHV, LLV for the previous three quarters inclusive.

    Bottom line, I'd like to put in any time period range and get pivots out of that, i.e. last 3 weeks, last 3 months, last 3 days.

    I can code it all myself, I just don't know the API/Reference well enough to know how to obtain the HHV/LLV for a specified period.

    Here is the old standby completed by another esignal user (thanks by the way).

    function main() {

    if(isMonthly() || isWeekly())
    return;

    if(bInit == false){
    xHigh = high(inv("H"));
    xLow = low(inv("H"));
    xClose = close(inv("H"));
    bInit = true;
    }

    var vHigh = xHigh.getValue(-1);
    var vLow = xLow.getValue(-1);
    var vClose = xClose.getValue(-1);
    if(vHigh == null || vLow == null || vClose == null)
    return;

    vPP = (vHigh+vLow+vClose)/3;
    vR1 = 2*vPP-vLow;
    vS1 = 2*vPP-vHigh;
    vR2 = (vPP-vS1)+vR1;
    vS2 = vPP-(vR1-vS1);

    return new Array(vR2, vR1, vPP, vS1, vS2);
    }
    Last edited by takacsj; 10-14-2008, 08:56 PM.

  • #2
    Scans

    A side question is once I get the above done, does esignal have the ability to scan all stocks/futures based on the above, i.e. list all stocks trading above their 3 year pivot but below their quarterly pivot, etc etc?

    Comment


    • #3
      Re: Complex Pivot Calculations

      takacsj
      There isn't a direct way to specify time periods such as those you indicate that is similar to how you would call daily, weekly or monthly intervals.
      You need to create your own logic that defines these periods and retrieves the necessary data contained within them that you then use to calculate the values you want.
      As an example of this you may want to see this thread on a similar topic
      Alex


      Originally posted by takacsj
      I realize pivot questions get asked often, but I haven't found this specific one yet.

      What I would like to know is how do I specify a time period other than weekly/monthly? For example, I would like Highest High Value (HHV), Lowest Low Value (LLV) and the close of a specific three year period. So, for example, for the 3 year period ending 31 Dec 2007, I'd like the above.

      I'd also like the same idea for the last three quarters, i.e. stop on the quarter ending 30 Sep 2008, and find the HHV, LLV for the previous three quarters inclusive.

      Bottom line, I'd like to put in any time period range and get pivots out of that, i.e. last 3 weeks, last 3 months, last 3 days.

      I can code it all myself, I just don't know the API/Reference well enough to know how to obtain the HHV/LLV for a specified period.

      Here is the old standby completed by another esignal user (thanks by the way).

      function main() {

      if(isMonthly() || isWeekly())
      return;

      if(bInit == false){
      xHigh = high(inv("H"));
      xLow = low(inv("H"));
      xClose = close(inv("H"));
      bInit = true;
      }

      var vHigh = xHigh.getValue(-1);
      var vLow = xLow.getValue(-1);
      var vClose = xClose.getValue(-1);
      if(vHigh == null || vLow == null || vClose == null)
      return;

      vPP = (vHigh+vLow+vClose)/3;
      vR1 = 2*vPP-vLow;
      vS1 = 2*vPP-vHigh;
      vR2 = (vPP-vS1)+vR1;
      vS2 = vPP-(vR1-vS1);

      return new Array(vR2, vR1, vPP, vS1, vS2);
      }

      Comment


      • #4
        Re: Re: Complex Pivot Calculations

        Alex,

        Thanks for the info. I'll look at it and I'll post my code when I'm done.

        I'm a Java and Python programmer and I forget how spoiled I am with the Java API. Nothing comes close, in my opinion. Note I'm not arguing language, just the simple fact of a published API that explains everything.

        Regards,

        John

        Originally posted by Alexis C. Montenegro
        takacsj
        There isn't a direct way to specify time periods such as those you indicate that is similar to how you would call daily, weekly or monthly intervals.
        You need to create your own logic that defines these periods and retrieves the necessary data contained within them that you then use to calculate the values you want.
        As an example of this you may want to see this thread on a similar topic
        Alex

        Comment


        • #5
          Re: Scans

          takacsj
          You are welcome
          With regards to EFS scanning this functionality is not available at this time. You may want to submit a suggestion using the link provided in the main menu of the eSignal application under Support-> Make A Suggestion
          Alex


          Originally posted by takacsj
          A side question is once I get the above done, does esignal have the ability to scan all stocks/futures based on the above, i.e. list all stocks trading above their 3 year pivot but below their quarterly pivot, etc etc?

          Comment

          Working...
          X