Announcement

Collapse
No announcement yet.

drawTextRelative barIndex maximum?

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

  • drawTextRelative barIndex maximum?

    I have the attached EFS script that reads a simple text file and then marks the "buy" and "sell" signals on the chart.

    An example of the format of the text file is this:
    "1D BUY @ 12715 1/15/2008 9:32:01 AM"
    "1D SELL @ 12720 1/15/2008 9:33:02 AM"

    It is intended to be run on a 1minute chart of YM #F, using a 7:15-16:15 time template.

    The bug/problem I am running into is that it does not print any of the buy or sell markers whenever the barIndex parameter for drawTextRelative (see line 65 in the code) is larger than -400 (given by the parameter called "shift").

    Is there some inherent limit for the barIndex parameter for drawTextRelative, that it cannot be greater than -400 ?
    Attached Files

  • #2
    do yourself a favor and change your file to a comma delimited file with all dates and times fixed to a proper value.

    I use this to format all my date/time variables for comparison.

    PHP Code:
    //  Get Time Variables 
    //------------------------------------------------------------------------------------------
      
    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;
      
    vtDate ""+vmonth+""+vDay+""+(vYear+1900); 
    Notice that all the date and time variables are stored as follows.

    6AM = 600
    11:59AM = 1159
    12:01PM = 1201
    1500PM = 1500

    04/10/07 = 4102007
    05/15/08 = 5152008

    Now, making comparisons on values like these will greatly improve your ability to write cleaner code because you make one or two comparisons instead of more.

    For example.
    // as strings
    if ((filedate == vtDate) && (filetime == (""+nTime )) {

    }


    // as numbers
    if ((parseFloat(filedate) == (vtDate*1)) && (parseFloat(filetime) == nTime) {

    }

    What I'm trying to teach you is a better way of handling all the date/time functions in your code.

    B
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      Re: drawTextRelative barIndex maximum?

      John

      Is there some inherent limit for the barIndex parameter for drawTextRelative, that it cannot be greater than -400 ?
      Not that I am aware of (see enclosed screenshot)
      Alex




      Originally posted by f1sh7
      I have the attached EFS script that reads a simple text file and then marks the "buy" and "sell" signals on the chart.

      An example of the format of the text file is this:
      "1D BUY @ 12715 1/15/2008 9:32:01 AM"
      "1D SELL @ 12720 1/15/2008 9:33:02 AM"

      It is intended to be run on a 1minute chart of YM #F, using a 7:15-16:15 time template.

      The bug/problem I am running into is that it does not print any of the buy or sell markers whenever the barIndex parameter for drawTextRelative (see line 65 in the code) is larger than -400 (given by the parameter called "shift").

      Is there some inherent limit for the barIndex parameter for drawTextRelative, that it cannot be greater than -400 ?

      Comment


      • #4
        Thanks, fellas, both of you.

        It appears it was a quirk of YM (being translated exchanges) and eSignal now has it fixed.

        I don't know what eSignal did, but the same code that did not work right since Monday (when YM moved exchanges), now works correctly.

        Thanks, anyway, for your time and suggestions.

        JOHN

        Comment

        Working...
        X