Announcement

Collapse
No announcement yet.

market close status

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

  • market close status

    Hi

    How to program so that when the clock hits 2:30pm eastern, the efs sends an alert.addToList and alert.email, showing the last trade price and change?

    I tried the following as a part of another formula but It didn't do anything at all. I also tried the Hour() and Minute().

    if(getHour(0)== 14 && getMinute(0)== 30) {
    Alert.addToList(getSymbol()+" "+getInterval(), "Market Close", Color.black, Color.red);
    Alert.playSound("ding.wav");
    Alert.email(getInterval()+" Market Close"+" "+formatPriceNumber(close(-1)), " ");
    }

    -Rupe

  • #2
    rupe
    You need to consider that if the closing time of the market is 14:30 then the time stamp of the last bar of the day will not meet your time conditions which are based on bar times. This is because eSignal timestamps a bar with the starting time of the interval and not the ending time so [for example] when you are plotting a 1 minute chart the last bar of the day will be time stamped 14:29, when plotting a 5 minute chart it will be time stamped 14:25, etc. Because your conditions look for a bar time stamped 14:30 it never triggers the alerts.
    Consider also that an efs executes only on trades so you would not be able to set your conditions based on system time (ie your computer's time) since if there are no trades at 14:30 the efs will not execute regardless of the fact that the computer time is 14:30.
    To accomplish what you want you will need to rely on some other logic. For example you could start sending email alerts at every trade that occurrs in between 14:29:00 and 14:29:59 of your system time. This should allow you to grab the value of the last trade of the day.
    An alternative could be to check the time based on the bar time. A simple way to determine the time required in the conditions is to subtract the interval from the market's closing time. For example if the chart interval is 15 minutes then you would check for a bar time stamped 14:15 (ie 14:30 - 00:15)
    Following are a couple of code examples based on these suggestions
    Alex

    PHP Code:
    //using system time

    var myDateObject = new Date();
    var 
    myTime = (mDateObject.getHours()*100)+myDateObject.getMinutes();

    if((
    myTime>=1429 && myTime<1430){
        
    Alert.email(...);
        
    Alert.addToList(...);
        
    //etc

    PHP Code:
    //using bar time on a 1 minute chart

    var myTime = (hour(0)*100)+minute(0);

    if((
    myTime>=1429 && myTime<1430){//replace 1429 with earlier time if necessary
        
    Alert.email(...);
        
    Alert.addToList(...);
        
    //etc

    Comment

    Working...
    X