Announcement

Collapse
No announcement yet.

Rolling Pivots indicator Projected forward

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

  • Rolling Pivots indicator Projected forward

    I am working on the EFS named "rolling pivots" and was trying to project the Pivots forward but haven't been successful. Is there any way to have these pivots projected forward based on the most recent OHLC (i.e. current day's live prices)?

    Any suggestions are much appreciated and thank you in advance!

  • #2
    Just set the x co-ordinates below from the start point bar(0) to forward bar(12)
    with no negative. Insert your ohlc values as the y values.


    PHP Code:
    function preMain(){
    setPriceStudy(true);
    }
    function 
    main(){
    var 
    ohlc ohlc4();
    drawLineAbsolute(0ohlc12ohlcPS_SOLID2Color.purple"piv1"); 

    Last edited by red49er; 12-29-2012, 01:05 AM.

    Comment


    • #3
      Rolling Pivots indicator Projected forward

      Originally posted by red49er View Post
      Just set the x co-ordinates below from the start point bar(0) to forward bar(12)
      with no negative. Insert your ohlc values as the y values.


      PHP Code:
      function preMain(){
      setPriceStudy(true);
      }
      function 
      main(){
      var 
      ohlc ohlc4();
      drawLineAbsolute(0ohlc12ohlcPS_SOLID2Color.purple"piv1"); 

      Thank you red49er for your input and help! I should have probably posted the code of the indicator I was referring to in my original message. Pls see below. I believe Alexis Montenegro created the code. The code displays the Pivot Range from the the last x days. I was trying to project this range one day forward.

      function preMain() {
      setPriceStudy(true);
      setCursorLabelName("ACDPiv1", 0);
      setCursorLabelName("ACDPiv2", 1);
      setDefaultBarStyle(PS_SOLID, 0);
      setDefaultBarStyle(PS_SOLID, 1);
      setDefaultBarFgColor(Color.blue, 0);
      setDefaultBarFgColor(Color.red, 1);
      setDefaultBarThickness(2, 0);
      setDefaultBarThickness(2, 1);
      setPlotType(PLOTTYPE_FLATLINES, 0);
      setPlotType(PLOTTYPE_FLATLINES, 1);

      var fp1 = new FunctionParameter("nNumDays", FunctionParameter.NUMBER);
      fp1.setName("Days");
      fp1.setLowerLimit(1);
      fp1.setDefault(3);

      }

      var vReset = true;
      var vDay0 = null;
      var vDay1 = null;
      var HH = null;
      var LL = null;
      var CC = null;
      var vPiv = null;
      var vPiv2 = null;
      var diff = null
      var ACDPiv1 = null;
      var ACDPiv2 = null;

      function main(nNumDays) {

      if (isIntraday() != true)
      return null;
      if (isTick() == true)
      return null;

      if (vReset == true) {
      setStudyTitle("Prev " + nNumDays + " Days Pivots");
      vReset = false;
      }

      if (getBarState() == BARSTATE_NEWBAR) {
      if (vDay0 != null) {
      vDay1 = vDay0;
      } else {
      vDay1 = getDay();
      }
      }
      vDay0 = getDay();

      if (vDay0 != vDay1) {
      var aHighs = callFunction("/OHLC/getPrevDaysOHLC.efs", "main", "High", 0, nNumDays);
      if (aHighs == null)
      return;
      var aLows = callFunction("/OHLC/getPrevDaysOHLC.efs", "main", "Low", 0, nNumDays);
      if (aLows == null)
      return;
      var aClose = callFunction("/OHLC/getPrevDaysOHLC.efs", "main", "Close", 0, 1);
      if (aClose == null)
      return;

      var cntr = aHighs.length;
      HH = aHighs[0];
      LL = aLows[0];
      CC = aClose[0];
      for (i = 0; i < cntr; ++i) {
      HH = Math.max(HH, aHighs[i]);
      LL = Math.min(LL, aLows[i]);
      }
      }

      //Pivot section

      vPiv = (HH+LL+CC)/3;
      vPiv2= (HH+LL)/2;
      vDiff= vPiv-vPiv2;
      ACDPiv1 = vPiv+vDiff;
      ACDPiv2 = vPiv-vDiff;


      return new Array (ACDPiv1,ACDPiv2);
      }

      Thanks again!

      Comment


      • #4
        The code uses daily bars values to form the pivots, so if you are using it on a daily chart you only have to 'project' 1 bar forward, which you could visualise. If on the other hand you are using it on a 1min chart then they would have to be projected up to approx. 1400 bars into the future, which you would probably do in 1 hourly segments (ie 60 forward bars at a time, updated every hour), this would be quite a coding task.
        For now check out other pivot routines in your C:\Program Files\eSignal\Pivots folder

        Comment

        Working...
        X