Announcement

Collapse
No announcement yet.

Putting a time constraint on alerts in an efs

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

  • Putting a time constraint on alerts in an efs

    Hi,

    I have (at last!) managed to get an efs to fire alerts once only per bar when my conditions are all satisfied at once. Thanks to the contributors here for leading the way without me having to post a question.

    I would like to put a constraint on the alerts, so that they are not generated during the first 'x' minutes of market open. I can't seem to find an answer to this.

    I'd be grateful if someone would point me in the right direction. I'm using eSignal V10, my time template is auto 0930/1600; if that is relevant.

    Regards

    RR

  • #2
    Try something like this:

    var msPerHour = 1*60*60*1000; //number of miliseconds in an hour
    var vTime = new Date();
    var vBarTime = getVAlue("time");
    var vOffset = 9.5; //opening time of market on east coast, change for your own time zone
    var vThreshold = 10; //Set to number of minutes to enable alarm

    var vElapsedTime = (vTime.getTime() - vBarTime.getTime() - vOffset) / msPerHour; //should tell you number of hours elapsed since market open

    if(vElapsedTime > vThreshold/60) {
    set alarm; //Set alarm is your code for sounding the alarm.
    }

    You might have to play around with an offset as I can't remember if vTime.getTime() starts at midnight or when. If midnight you would subtract 9.5 hours for vTime to be zero at market open on East Coast.
    ....Mike

    Comment


    • #3
      Thanks a lot Mike,
      I've written that in and will try it out tomorrow.
      Cheers
      RR

      Comment

      Working...
      X