Announcement

Collapse
No announcement yet.

Identifying the time template

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

  • Identifying the time template

    Is there a way to identify the time template being applied to the chart from with in the efs ?

    I am trying to determine if the time template is not 24 hours so that if there is a break between end time and start time of the next day I can restart my formula at the beginning of the next day...

    I thought if I had the Time Template information that might help, but now I am further wondering how I am going to tell that I am on a new day...

    Any suggestions would be greatly appreciated.

    Thanks-
    Jennifer

  • #2
    Hello Jennifer,

    We do not have a method for accessing time template properties. However, there are a couple things you can do to detect a new day or session.

    The simplest method is to compare the day of the current bar being processed to the prior bar as follows.

    PHP Code:
    if (getDay(0) != getDay(-1)) {
        
    // This is the first bar of the day.
        
    debugPrintln("First bar of day " getDay(0) + " is " getCurrentBarIndex());

    Or you can look at the time stamp of the current bar being processed and check for a certain time. The code example below prints a message to the output window on the first bar at or after 15:00.

    PHP Code:
    var vFlag false;

    function 
    main() {
        if (
    getDay(0) != getDay(-1)) vFlag false;
        
        var 
    time0 = (getHour(0)*100 getMinute());
        var 
    time1 1500;
        
        if (
    time0 >= time1 && vFlag == false) {
            
    // This is the first bar of the day.
            
    debugPrintln("First bar at 15:00 " getCurrentBarIndex());
            
    vFlag true;
        }

        return;

    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