Announcement

Collapse
No announcement yet.

Undocumented Commands

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

  • Undocumented Commands

    I have been trying to adapt the "getPrevOHLC.efs" forumla, which is found in the "OHLC" formula folder. I want it to show the Weekly High/Low.

    Problem #1: The formula seems to work fine as long as I use the time template for "Equity RTH - West Coast." However, if I use the time template for "24 Hour," I get a value for two days/weeks previous to the current day, rather than one day/week previous to the current day. I trade index futures (ES, NQ) and like to look at the night session too (24 Hour), so this is a problem. Does anybody know how to fix the formula to get the correct result (previous day/week high/low using the 24 Hour time template)?

    Problem #2: In trying to figure out the logic of the formula, I have run across several undocumented commands. Can anybody explain the following:

    Line 34: getBarState()
    Line 35: BARSTATE_ALLBARS
    Line 56: "rawtime"
    Line 60: RawTime.DAY

    A line by line English language translation of the whole forumla would be ideal, but I would settle for an explanation of the above undocumented commands. Can anybody lend a hand?
    Be the diner, not the dinner.

  • #2
    Hi,

    I have a write up on getBarState()Here

    It will include ALLBARS, as that is one possible return.

    Also, there was a good description of rawtime Here

    Hope this helps. If not ask further q's and I'll do my best to answer.
    Garth

    Comment


    • #3
      esignal yahoo group

      garth,

      it looks like the yahoo esignal forum has been folded into the eSignal central group...

      where would we find that info on rawtime you referred to?

      thanks,

      peter
      /\/\/\/\/\/\/\/\

      Comment


      • #4
        Hi,

        The link works fine for me (yahoo groups hasn't been closed down yet), but here is part of the posting that is of interest:
        ---------------------
        Dion Loy Wote:
        ----------------------
        Another alternative is to replace:

        getValue("time").getMinutes()

        with:

        getValue("rawtime")

        which returns the number of minutes since Jan 1, 1970. Since you are
        just interested in the mod of that value, it should work. (rawtime
        does not involve as much computation power as "time").

        =================

        You might also check out:


        This
        Garth

        Comment


        • #5
          getValue("rawtime") returns the number of SECONDS since 1/1/1970

          Note: In build 510, there is also

          getYear(...)
          getMonth(...)
          getDay(...)
          getHour(...)
          getMinute(...)
          getSecond(...)

          where "..." are the same arguments that you would pass to open(...), high(...), low(...), or close(...)

          m.
          Matt Gundersen

          Comment


          • #6
            Re: Reply to post 'Undocumented Commands'

            getValue("rawtime") returns the number of SECONDS since 1/1/1970

            Note: In build 510, there is also

            getYear(...)
            getMonth(...)
            getDay(...)
            getHour(...)
            getMinute(...)
            getSecond(...)

            where "..." are the same arguments that you would pass to open(...), high(...),
            low(...), or close(...)

            m.

            --- eSignal Bulletin Board Mailer <[email protected]> wrote:
            > Hello mattgundersen,
            >
            > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            >
            Matt Gundersen

            Comment


            • #7
              Are these lightweight?

              Are these lightweight calls, like getValue(rawtime"), or heavyweight calls, like getValue("time")? Can i use getDay() with no additional processing penalty as compared to
              Math.floor(getValue("RawTime") / RawTime.DAY)
              ?

              Waht is this RawTime object? It looks like RawTime.DAY is just the constant 86400, the number of seconds in a day. What are the other accessors to this object?

              Comment


              • #8
                the newly added getDay(), getYear(), etc are all lightweight, they use rawtime themselves so that no date object is created.
                Garth

                Comment


                • #9
                  Watch how getBarState wroks in action..

                  debugClear();
                  setPriceStudy(true);
                  function main()
                  {
                  var gbs=getBarState();

                  if(gbs==2)
                  {
                  curtime();
                  debugPrint(" BARSTATE_ALLBARS ");
                  }

                  if(gbs==0)
                  {
                  curtime();
                  debugPrint(" BARSTATE_NEWBAR ");
                  }

                  if(gbs==1)
                  {
                  curtime();
                  debugPrint(" BARSTATE_CURRENTBAR ");
                  }
                  return;
                  }

                  function curtime()
                  {
                  today =new Date;
                  var CurHours =today.getHours() ;
                  var CurMinutes=today.getMinutes();
                  var CurSeconds=today.getSeconds();
                  if(CurHours <10){CurHours ="0"+CurHours ;}
                  if(CurMinutes<10){CurMinutes="0"+CurMinutes;}
                  if(CurSeconds<10){CurSeconds="0"+CurSeconds;}
                  debugPrint(CurHours+"."+CurMinutes+"."+CurSeconds+ " ");
                  }

                  Comment


                  • #10
                    See the difference between Clock time and BarTime

                    var start=0;
                    debugClear();
                    setPriceStudy(true);

                    function main()
                    {
                    if(getCurrentBarIndex()==0)
                    {
                    today =new Date;
                    CurYear =today.getYear() +1900;
                    CurMonth =today.getMonth()+1;

                    CurDate =today.getDate() *1;
                    if(CurDate<10){CurDate="0"+CurDate;}

                    CurHours =today.getHours() * 1;
                    if(CurHours <10)
                    {CurHours ="0"+CurHours ;}

                    CurMinutes=today.getMinutes() * 1;
                    if(CurMinutes<10)
                    {CurMinutes="0"+CurMinutes;}

                    CurSeconds=today.getSeconds();
                    if(CurSeconds<10)
                    {CurSeconds="0"+CurSeconds;}

                    debugPrint (" CurDate="+CurMonth+"/"+CurDate+"/"+CurYear);
                    debugPrintln("CurTime="+CurHours+"."+CurMinutes+". "+CurSeconds);

                    getMM =getValue("Month");

                    getDD =getValue("Day");
                    if(getDD <10)
                    {getDD ="0"+getDD;}

                    getY =getValue("Year");

                    getH =getValue("Hour");
                    if(getH <10)
                    {getH ="0"+getH;}

                    getMin=getValue("Minute");
                    if(getMin<10)
                    {getMin="0"+getMin;}

                    getS=getValue("Second");
                    if(getS<10)
                    {getS="0"+getS;}

                    debugPrint (" BarDate="+getMM+"/"+getDD+"/"+getY);
                    debugPrintln("BarTime="+getH+":"+getMin+"."+getS);

                    }
                    start=1;
                    return;
                    }

                    Comment


                    • #11
                      Here is a way to send out put to a text file

                      http://share.esignal.com/download.js...=&file=log.efs

                      Comment


                      • #12
                        I tried to integrate the previous file into my other file and get the following error

                        TypeError: f1 has no properties

                        Any ideas what that means?

                        Comment


                        • #13
                          You probably have var f1; twice in your file, doh!

                          Comment


                          • #14
                            I have sen that before when you try to do things like open a file for appending, but the file doesn't exist. Make sure the filename being created is valid (if you are opeing it with a "+").
                            Garth

                            Comment


                            • #15
                              I just ran it with no problem. Although I had to comment out the line with "sym = callFunction(...)" Simply replaced it with sym = "bla";

                              I'd verify that sym is not null.
                              - verify the filename.
                              - Verify the formula output path exists
                              - verify f1 is not null (also init f1 = null)

                              ,m.
                              Matt Gundersen

                              Comment

                              Working...
                              X