Announcement

Collapse
No announcement yet.

Time Marker

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

  • Time Marker

    Good Morning,

    The attached EFS is a modified version of the Time Marker developed by Alex. Seconds have been added to the time. Am I correct in assuming the time is from eSignal and not from my computer?

    If yes, is it possible to read into EFS the current time from my computer?

    If yes, how would I compare the two times to detect time lags like the ones experienced this morning on YM?

    Best Regards,

    Alan


    /************************************************** *******
    Draw time lines at specified time intervals
    ************************************************** ********/

    function preMain() {
    setPriceStudy(false);
    setStudyTitle("Time Marker 10");
    setCursorLabelName("Time");
    setShowTitleParameters(false);
    checkVersion(7.9,"http://share.esignal.com/ContentRoot/ACM%20Test/Formulas/Time Marker.efs","Time Marker.efs");

    var fp1 = new FunctionParameter("Interval", FunctionParameter.NUMBER);
    fp1.setLowerLimit(0);
    fp1.setDefault(10);

    var fp2 = new FunctionParameter("Offset", FunctionParameter.NUMBER);
    fp2.setDefault(0);

    var fp3 = new FunctionParameter("Lines", FunctionParameter.STRING);
    fp3.addOption("On");
    fp3.addOption("Off");
    fp3.setDefault("On");

    var fp3a = new FunctionParameter("Time", FunctionParameter.STRING);
    fp3a.addOption("On");
    fp3a.addOption("Off");
    fp3a.setDefault("On");

    var fp4 = new FunctionParameter("Cursor", FunctionParameter.STRING);
    fp4.addOption("false");
    fp4.addOption("true");
    fp4.setDefault("true");

    }

    var Cntr = 0;
    var x;
    var y;
    var z;

    function main(Interval,Offset,Lines,Time,Cursor){

    setShowCursorLabel(eval(Cursor));

    if(isDWM()==true){
    setShowCursorLabel(false);
    return;
    }

    if(getBarState()==BARSTATE_NEWBAR){
    Cntr += 1;
    }

    x = (getHour()*1)+Offset;
    y = getMinute()*1;
    dd = getSecond()*1;

    if(x>=24) x = x-24;
    if(x<0) x = 24+x;
    if(x<10) x = "0"+x;
    if(y<10) y = "0"+y;
    if(dd,10) dd = "0"+dd;

    z = x+":"+y+":"+dd;

    if((getMinute()/Interval) == Math.floor(getMinute()/Interval)){
    if(Time=="On"){
    drawTextRelative(0,0,z,Color.grey,null,Text.RELATI VETOBOTTOM,"Arial",10,"Time2"+Cntr);
    }
    if(Lines=="On"){
    drawLineRelative(0,-30,0,99999,PS_SOLID, 1, Color.lightgrey,"Time"+Cntr);
    }
    }


    return z+"";
    }

  • #2
    Alan

    Am I correct in assuming the time is from eSignal and not from my computer?
    The times you are retrieving using getHour(), getMinute(), etc are bar times and represent the start times of a bar.

    is it possible to read into EFS the current time from my computer?
    You can access the system time (ie your computer's time) using the Date Object

    how would I compare the two times to detect time lags like the ones experienced this morning on YM?
    I am not sure but I don't think this is possible
    Alex

    Comment


    • #3
      Alex,

      Thank you for the assistance.

      Best Regards,

      Alan

      Comment

      Working...
      X