Announcement

Collapse
No announcement yet.

Pivot line length

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

  • Pivot line length

    Hi, I am new to efs and trying to do something I think should be simple. I just want to have the pivot lines extend for only the last 3 or 4 bars instead of the whole chart. I know it can be done but can't seem to find an example of how to do it.

    Any help is much appreciated.
    Thanks

  • #2
    Check out drawLineAbsolute in the kb.
    Good luck to you . . .

    Comment


    • #3
      Thanks for your reply. I have spent a fair bit of time trying to get it to work with no luck. I keep getting errors. All I want to do is take the code below which draws the daily pivot, but modify it so the pivot line only displays a length of the last 5 bars. (Instead of across the entire chart)
      Thanks again for any help.


      function preMain() {
      setPriceStudy(true);
      setStudyTitle("Pivot Point");
      setCursorLabelName("Pivot Point");
      // Pivot Point
      setDefaultBarStyle(PS_SOLID);
      setDefaultBarFgColor(Color.RGB(0x00,0x94,0xFF), 0);
      setDefaultBarThickness(1);


      }

      var bInit = false;
      var xHigh = null;
      var xLow = null;
      var xClose = null;
      var vPP = null;

      function main() {

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

      if(bInit == false){
      xHigh = high(inv("D"));
      xLow = low(inv("D"));
      xClose = close(inv("D"));
      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;

      return (vPP);
      }

      Comment


      • #4
        Hi, substitute

        return (vPP);

        with:

        drawLineRelative(-5, vPP, 0, vPP, PS_SOLID, 2, Color.blue, "TagName");
        return ;

        Comment


        • #5
          Thanks Maxmax, The line displays exactly how I want. However it no longer displays the actual Pivot Point "value" in the Data window or right axis of the chart. Is there a way to fix that?

          Comment


          • #6
            Sorry, but I think you need again
            return (vPP);
            You could choose a
            setDefaultBarStyle(PS_DOT);
            setDefaultBarFgColor(Color.lightgrey, 0);
            Bye
            Massimo

            Comment

            Working...
            X