Announcement

Collapse
No announcement yet.

time it takes to draw a tick bar

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

  • time it takes to draw a tick bar

    Hi again,

    Here goes with another silly question.

    Does anyone know of an efs that will display the time (duration) that it takes to draw a tick bar.

    Say I am running a 35 tick bar on the NQ. Early in the day the bars draw very quickly. As the day progresses, the bars slow down.

    It would be nice at a glance to see how long it took to draw the previous bars.

    EZ

  • #2
    Easy,

    try this

    function preMain() {
    setStudyTitle("");
    setCursorLabelName("TTime", 0);
    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarFgColor(Color.red, 0);
    setDefaultBarThickness(1, 0);
    setPlotType(PLOTTYPE_HISTOGRAM, 0);
    }

    function main(){
    tickTime=(getMinute()-getMinute(-1))*60+getSecond()-getSecond(-1);
    return tickTime;
    //if he bar takes more than one hour this logic will be wrong, but who cares
    }

    Enjoy!

    Comment


    • #3
      Hello EZ,

      Another thing you could do is record the rawtime at the instance of each new bar. The difference between two bars would be the number of seconds.

      PHP Code:
      var time null;
      var 
      time1 null;

      function 
      main() {
          if (
      getBarState() == BARSTATE_NEWBAR) {
              
      time1 time;
              
      time getValue("rawtime");
          }
          if (
      time1 == null) return;
          
          var 
      vSeconds time time1;
          return 
      vSeconds;

      Jason K.
      Project Manager
      eSignal - an Interactive Data company

      EFS KnowledgeBase
      JavaScript for EFS Video Series
      EFS Beginner Tutorial Series
      EFS Glossary
      Custom EFS Development Policy

      New User Orientation

      Comment

      Working...
      X