Announcement

Collapse
No announcement yet.

EFS Help Request

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

  • EFS Help Request

    The second to last line of the following code returns vEOS = true at 1300 hours even if the root symbol is ES or NQ. If the root symbol is ES or NQ, that 1300 line is supposed to return false, and at 1330 hours the following 1330 line is supposed to return true. What am I missing here?

    Thanks.


    var vEndOfDayFound = false;

    function main() {

    // initialize upon first loading formula
    if(getBarState() == BARSTATE_ALLBARS) {
    vInterval = getInterval();
    vSymbol = getSymbol().toUpperCase();
    // for RTH, eg, to convert, ES Z3 to ES Z3=2
    var rootSymbol = vSymbol.substring(0,3);
    if (rootSymbol == "ES " || rootSymbol == "NQ ")
    if ( vSymbol.indexOf("=2") == -1 ) vSymbol += "=2";
    vSymbol += ",D";
    return null;
    }

    // return null if not an intraday chart
    if(vInterval == null || vInterval == "D" || vInterval == "W" || vInterval == "M" || vInterval == "T")
    return null;

    // if first bar in new day, get and save yesterday's data
    var vThisday = null;

    if (getDay(-1) != getDay()) vEndOfDayFound = false;

    //check for end of session.
    var vEOS = false;
    if (vEndOfDayFound == false) {
    var vBarHour = getHour()*100;
    var vBarMin = getMinute();
    var vBarTime = vBarHour + vBarMin;
    if ((vBarTime >= 1300) && (rootSymbol != "ES " || rootSymbol != "NQ ")) vEOS = true; //Change Time here; e.g. "1600" for 4:00 (Eastern Time).
    if ((vBarTime >= 1330) && (rootSymbol == "ES " || rootSymbol == "NQ ")) vEOS = true; //Change Time here; e.g. "1630" for 4:30 (Eastern Time).
    }

  • #2
    Hello Lancer,

    Change the "||" to "&&" in that 1300 line.

    PHP Code:
    if ((vBarTime >= 1300) && (rootSymbol != "ES " && rootSymbol != "NQ ")) 
    if (rootSymbol != "ES " || rootSymbol != "NQ ") will always return true because rootSymbol can't be equal to two different values. Let me know if this helps.
    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


    • #3
      Jason, thanks, I tried it and unfortunately this formula is still not working the way it should. For these lines:

      if ((vBarTime >= 1300) && (rootSymbol != "ES " && rootSymbol != "NQ ")) vEOS = true; //Change Time here; e.g. "1600" for 4:00 (Eastern Time).
      if ((vBarTime >= 1330) && (rootSymbol == "ES " || rootSymbol == "NQ ")) vEOS = true; //Change Time here; e.g. "1630" for 4:30 (Eastern Time).
      }

      with root symbols ES or NQ, both lines are still returning true because the change is occurring at 1300 instead of 1330, and then it changes again at 1330. The desired result is that equities change at 1300 and index futures with symbol root ES or NQ change at 1330.

      Also, the old problem of all values returning zero (with all lines flatlining) at the 1300 or 1330 change still exists. This behavior occurs for symbols loaded prior to the open, and left unchanged all day; (try ES #F or NQ #F). Also, after loading a symbol prior to the open, and then reloading the formula during the regular session, the Prior Day Close line will erroneously relocate itself to the current price in the current bar.

      This is one frustrating formula to fix. Any assistance is really appreciated. Thanks in advance.
      Attached Files
      Last edited by Lancer; 10-24-2003, 03:34 PM.

      Comment


      • #4
        Lancer

        Did you try Jason's suggestion re || and &&

        Doesnt look like you make the edit according to Jason

        Comment


        • #5
          I did in the formula David, I just copied that text from my original post into the post below. (now edited so no confusion). thanks.

          Comment


          • #6
            ok, good.

            Now you have to put in some

            debugPrintln(vBarTime +" "+rootSymbol );

            to see what these values are in the if stmt.

            I bet rootSymbol == "ES" not "ES "

            probably the space got dropped, but that's just a guess.

            Comment


            • #7
              Hello Lancer,

              The problem is that rootSymbol is undefined when you get to your if statements. I should have noticed that earlier. Anyway, make rootSymbol global and remove the "var" in front of rootSymbol in your BARSTATE_ALLBARS code block. It'll work now.
              Attached Files
              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