Announcement

Collapse
No announcement yet.

How to count seconds in a bar

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

  • How to count seconds in a bar

    Hi

    I'd like to know if there's an EFS Study available that counts the seconds after a new bar opens.

    I'm currently coding an automated trading system and one of the triggers is that a specific signal has to occur in the first X seconds after a new bar opens. If it occurs after that X amount of seconds the trigger is invalid.

    Thanks for your help.

  • #2
    Hi laocoon,

    Here is an efs that will do what you want, I put it together quickly to use a part of a library I am compiling.

    PHP Code:
    /***********************************************
    Provided By : Steve Hare © April 2006                         
    EFS Formula : shTimer simple test efs                    

    Version 1.0
    4/5/2006 
    */
    // this will output to the formula output pane
    // try running with and without the debug steps
    // if timing using the performance monitor, time alone to ensure the data is representative.
    // does not work in tick playback
    // to be used with the shTimer.efsLib
    // install the library (not this efs) in this folder ==>> C:\\Program Files\\eSignal\\FunctionLibrary
    //***************************************************

    var timerLib addLibrary("shTimer.efsLib");
    var 
    sTest timerLib.timerTest(5);
    function 
    main() {
     var 
    oneTest sTest.check();

     if(
    sTest.flag)debugPrintln("21: barcount = "+getCurrentBarCount()+" sTest.flag = "+sTest.flag+" sTest.elapsed = "+sTest.elapsed+" seconds");
     if(
    oneTest)debugPrintln("22: oneTest = "+oneTest+" sTest.elapsed = "+sTest.elapsed+" seconds");

    The library is in my Functions fileshare. If you look at the example, I hope you will see how it runs. I will be off the forum until later tonight, and cannot answer any questions (should you have any) until then, please excuse me in advance.

    Comment


    • #3
      Thanks a lot for the quick reply Steve, I'm currently putting it all together...

      Comment


      • #4
        You are most welcome laocoon.

        Comment

        Working...
        X