Announcement

Collapse
No announcement yet.

first close

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

  • first close

    i want to create an indicator to see the first bar close
    tank to help me

  • #2
    sante
    See Example 1 in this article on getFirstBarIndexOfDay() in the EFS KnowledgeBase.
    To retrieve the Close replace "Open" used in the example with "Close"
    Alex

    Comment


    • #3
      i want a formula like that


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

      function preMain() {
      setPriceStudy(true);
      setShowCursorLabel(false);
      }

      var vStartTime = null;
      var v30minHigh = null;
      var v30minLow = null;
      var v30minClose = null;
      var FirstBar = null;

      function main() {
      if (getDay() != getDay(-1)) {
      vStartTime = getValue("Time");
      FirstBar = getFirstBarIndexOfDay(vStartTime);
      v30minHigh = high();
      v30minLow = low();
      v30minClose = close();
      }
      var vTime = getValue("Time");

      //debugPrintln(getCurrentBarIndex() + " " + (vTime - vStartTime)/450000);
      // (vTime - vStartTime) = milliseconds / 450000 = hours
      if ((vTime - vStartTime)/450000 < 1.0) { // still in first hour of the day
      v30minHigh = Math.max(high(), v30minHigh);
      v30minLow = Math.min(low(), v30minLow);
      v30minClose = Math.c(close(), v30minClose);
      }

      if (FirstBar != null) {
      drawLineRelative( FirstBar, v30minHigh, 0, v30minHigh, PS_DASH, 1, Color.lime, 0) // First bar high
      drawTextRelative( 2, v30minHigh, v30minHigh.toFixed(4), Color.lime, null, Text.VCENTER|Text.BOLD, null, 10, 0.5);
      drawLineRelative( FirstBar, v30minClose, 0, v30minClose, PS_DASH, 1, Color.yellow, 1) // First bar low
      drawTextAbsolute( 2, v30minClose, v30minClose.toFixed(4), Color.yellow, null, Text.VCENTER|Text.BOLD, null, 10, 1.5);
      drawTextRelative(2,v30minClose,v30minClose+" - stop mm", Color.yellow,null,Text.VCENTER,"Arial",10,2);
      drawLineRelative( FirstBar, v30minLow, 0, v30minLow, PS_DASH, 1, Color.red, 2) // First bar close
      drawTextAbsolute( 2, v30minLow, v30minLow.toFixed(4), Color.red, null, Text.VCENTER|Text.BOLD, null, 10, 2.5);
      }

      return;
      }

      Comment


      • #4
        i can try to adapt this formula at my idea but the software sign me an error formula, i have deleta low and high indicator becouse i'm interested only at the close price
        tnx a lot

        Comment


        • #5
          sante
          The example in the EFS KnowledgeBase that I suggested to you in my prior reply will accomplish the same thing.
          If however you still want to modify the script you posted remove or comment out the following lines
          v30minHigh = Math.max(high(), v30minHigh);
          v30minLow = Math.min(low(), v30minLow);

          and then all instances of drawLineRelative() and drawTextRelative() that use v30minHigh or v30minLow in the parameters.
          Alex

          Comment

          Working...
          X