Announcement

Collapse
No announcement yet.

Time trigger

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

  • Time trigger

    Hi,

    Is there a time trigger that I could set to force the efs to be computed at a specific time?

    W

  • #2
    sure, you just have to use the date/time functions..

    PHP Code:


    //  System Variables..
    var LastClose null;
    var 
    nRTTime;
    var 
    nRTTimeMin null;
    var 
    vRTTimeMin;
    var 
    vRTHour;
    var 
    vRTMin;
    var 
    vRTSec;
    var 
    vHour;
    var 
    vMin;
    var 
    vSec;
    var 
    vDay;
    var 
    vMonth;
    var 
    vDOW;
    var 
    nTime;
    var 
    vtDate "";


    function 
    main() {

          var 
    vTime = new Date();
      
    vRTHour vTime.getHours();
      
    vRTMin vTime.getMinutes();
      
    vRTSec vTime.getSeconds();
    //  vDOW = vTime.getDay();
    //---------------------------------------------------
    //  Get Time Variables 
      
    vTime getValue("Time"0);
      
    vHour vTime.getHours();
      
    vMin vTime.getMinutes();
      
    vSec vTime.getSeconds();
      
    vDay vTime.getDate();
      
    vMonth vTime.getMonth() +1
      
    vDOW vTime.getDay();
      var 
    vYear vTime.getYear();
      var 
    nTimeMin = (vHour*60)+vMin;
      
    nTime = (vHour*100)+vMin;
      
    vRTTimeMin = (vRTHour*60)+vRTMin;
      
    nRTTimeMin = (vRTHour*100)+vRTMin;
      
    nRTTime = (vRTHour*3600)+(vRTMin*60)+vRTSec;


      if ( (
    nRTTimeMin  == 1030) ||
           (
    nRTTimeMin  == 1130) ||
           (
    nRTTimeMin  == 1230) ||
           (
    nRTTimeMin  == 1430) ) {

          ..
    run or update your efs logic here.
       }

      return;

    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      My efs (my main() function) is run at the end of each bar, i.e. at regular time intervals. I wonder how it is possible to force the main() to be executed at a time other than the regular time interval.

      I understand that I could use getBarState()==BARSTATE_CURRENTBAR and check for a specific time to execute certain code, however this has a huge overhead when the market is very active like in the indices.

      Therefore, I was wondering if there's a way to trigger the efs at a specific trigger time.

      Comment


      • #4
        nope - not really. if you set everything based on "conditionals" then your code really does not do much unless it's time to run some calculations.. Like this..

        PHP Code:

        //  System Variables..
        var LastClose null;
        var 
        nRTTime;
        var 
        nRTTimeMin null;
        var 
        vRTTimeMin;
        var 
        vRTHour;
        var 
        vRTMin;
        var 
        vRTSec;
        var 
        vHour;
        var 
        vMin;
        var 
        vSec;
        var 
        vDay;
        var 
        vMonth;
        var 
        vDOW;
        var 
        nTime;
        var 
        vtDate "";


        function 
        main() {

              var 
        vTime = new Date();
          
        vRTHour vTime.getHours();
          
        vRTMin vTime.getMinutes();
          
        vRTSec vTime.getSeconds();
        //  vDOW = vTime.getDay();
        //---------------------------------------------------
        //  Get Time Variables 
          
        vTime getValue("Time"0);
          
        vHour vTime.getHours();
          
        vMin vTime.getMinutes();
          
        vSec vTime.getSeconds();
          
        vDay vTime.getDate();
          
        vMonth vTime.getMonth() +1
          
        vDOW vTime.getDay();
          
        nTime = (vHour*100)+vMin;
          
        nRTTimeMin = (vRTHour*100)+vRTMin;


          var 
        Time2RunSomething =  ( (nRTTimeMin  == 1030) ||
               (
        nRTTimeMin  == 1130) ||
               (
        nRTTimeMin  == 1230) ||
               (
        nRTTimeMin  == 1430) );


           if (
        Time2RunSomething) {
              .. 
        all of your analysis code here
           
        }

          return;

        Brad Matheny
        eSignal Solution Provider since 2000

        Comment

        Working...
        X