Announcement

Collapse
No announcement yet.

Tick Bar Time Counter

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

  • Tick Bar Time Counter

    I would like to track how long each bar of a tick chart is required to complete. How can I change the code below so that the time shown is the total time of the last completed bar, not the elapsed time of the current bar? This code calcs the ET for the current bar. Thanks in advance for a prompt response.
    ======================

    /************************************************** ***************
    Provided By : eSignal. (c) Copyright 2004
    modified by Alexis C. Montenegro
    ************************************************** ****************/

    function preMain() {
    setPriceStudy(true);
    setStudyTitle("ET");
    setShowCursorLabel(false);
    }

    var vTimeStamp = null;

    function main() {
    if (getCurrentBarIndex() < -1) return;
    var nState = getBarState();
    var vClockTime = new Date()*1;

    if (nState == BARSTATE_NEWBAR) {
    vTimeStamp = getValue("Time")*1 ;
    }

    var vTimeElapse = (vClockTime-vTimeStamp);
    if (vTimeElapse < 0) return;

    var vMin = 0;
    var vSec = 0;

    vMin = Math.floor(vTimeElapse/60000);
    vTimeElapse -= (vMin*60000);

    vSec = Math.floor(vTimeElapse/1000);

    vMin<10?vMin=("0"+vMin):vMin=(vMin+"");
    vSec<10?vSec=("0"+vSec):vSec=(vSec+"");

    vTimeElapse = (" " + vMin + ":" + vSec + " ");

    if(vMin+vSec <= 180){
    var vColor = "Color.lime";
    }
    if(vMin+vSec > 180 && vMin+vSec <= 360){
    var vColor = "Color.yellow";
    }
    if(vMin+vSec > 360){
    var vColor = "Color.red";
    }

    drawTextAbsolute(5, 6, vTimeElapse, eval(vColor), Color.black,
    Text.BOLD|Text.RIGHT|Text.RELATIVETOTOP|Text.RELAT IVETORIGHT, null, 11, "TR");


    return;
    }

  • #2
    OK, I got the timer to work as I wnat but now I'm having trouble posting the text where I would like. I want it to plot in my indicator window, not the price window. How can I change:

    drawTextAbsolute(5, 6, vTimeElapse, eval(vColor), Color.black,
    Text.BOLD|Text.RIGHT|Text.RELATIVETOTOP|Text.RELAT IVETORIGHT, null, 11, "TR");

    to do that?

    Comment


    • #3
      Hello TBond,

      Remove setPriceStudy(true) from preMain and then reapply the formula.
      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


      • #4
        Jason,

        I did that and even set the y location to 250 and it still plots in price window.

        Comment


        • #5
          Hello TBond,

          After you removed setPriceStudy(true), did you remove the formula from the chart and then reapply? If this doesn't fix the problem for you post your formula and I'll test it on my end.
          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


          • #6
            Ah, I did not remove just reload. So this plots it in a separate indicator window. I guess only way to plot in indicator window I already have is to "shift" move it to that window, correct?

            Thanks for the assist!

            Comment


            • #7
              Correct, you must merge the two non-price studies in your case.
              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


              • #8
                OK, thanks.

                On another note, the bollinger band drift problem is still occurring on tick charts. After I shutdown and reload the datamanager and my charts, often the only tick bar shown is the current one "building". If I change the numbers of ticks from what I have in the cart, for example 100T, to 90T it then loads more data and when I change it back to 100T, it seems to be OK - usually. On ocassion however, it still does not load "all" the data I know is there.

                I chatted with you a few weeks ago about this problem (about the end of Jan)



                Since then I had to reinstall windows XP completely (reformat, new drive) and fresh install eSignal. I still have the problem.

                Is this going to be fixed and is there another way to rest the charts without completely shutting down datamanager and charts (it takes about 5+ mins for all my charts to reload).

                Comment


                • #9
                  Hello TBond,

                  The drift problem did require some additional work for the 7.9 version currently in Beta. Hopefully this version will fix your drift issue. I'll try to test your scenario with the current beta version.

                  As for the tick chart loading issue. I am seeing the same problem on my end and have reported the issue to development. Hopefully this can be resolved for the 7.9 release as well.

                  To refresh a chart manually you can hold down the Ctrl key and click on the Server Status label (Green label with "OK") at the top of the cursor window. However, it does not appear to relaod the history for the tick based chart.
                  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


                  • #10
                    Jason,

                    I think I may have found a partial solution to the drift problem for now.

                    In my time template I use for my tick charts I set a user defined with interval "T" and instead of "dynamic" I set it to 10 days. Seemed to work today since this is the 1st time I haven't had to reload everything in the morning since switching to version 7.8 about 3 months ago.

                    I suspect if the days were set to something like 1 however, I would still get the same drift problem - i.e., the drift is still there but since I'm forcing 10 days to load now it is not noticeable. I guess I'll see how it plays out over the next few days.

                    Comment


                    • #11
                      Drifting Bollinger Bands on tick Chart

                      Has anyone else noticed Bollinger bands "drifting" on tick charts? I had this problem about 2 yrs ago and it was fixed. I recently "upgraded" to 8.0 and now I have the problem again! :-(

                      Comment


                      • #12
                        Hello TBond,

                        Please give me the specific symbol(s), interval(s) and chart types you experienced this with. Also, what is the specific study and settings you used? EFS or Basic Study?

                        I've done some testing this morning on both the Basic study and EFS and haven't seen the drift. Let me know what your specific scenario was and I'll test it today as well.
                        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


                        • #13
                          Bollinger Band Drift

                          Haven't had this problem for a while, until updating to version 8.0 (build 782). I run several tick charts on various symbols - the ONLY one it seems to occur on is YM #F.

                          If I leave the chart open overnight, sometimes in the AM there is either no data on the chart at all or the bands have drifted. If they've drifted and I try either requesting new data (control click on cursor window) - I get a "no data" message. If I close that chart and reopen, there is no data available. If I select a different tick interval, again, no data available.

                          As I said, the charts worked fine for about 2 years until I upgraded to this version about year end 2006. I've been having these problems now since the beginning of 2007. HELP!

                          Comment


                          • #14
                            Hello TBond,

                            I'll be happy to investigate this issue. In order to help me reproduce this drift, please provide the following information.

                            1. What are the specific time template settings you are using with YM #F?

                            2. What options are checked/unchecked in the Study Properties window for the Line/Tick chart type (right-click Edit Studies).

                            3. Are you using a custom EFS or are you referring to the built-in Bollinger Band study under the Basic Studies menu? If you're using an EFS, please attach a copy.

                            Regarding the "no data" issue, this is not EFS related. This is a connection issue between your data manager and the server farm. The next time this occurs, please call into Tech Support and ask the rep to check your connections to the servers.
                            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


                            • #15
                              Jason,

                              As stated in the original message, the symbol is YM #F. I am using Bollinger Bands from Basic Studies settings 20,2.5,C. No other studies on the chart. The tick timeframe does not matter - it occurs on any time I've checked above 300T.

                              It seems specific to YM #F. I took the same chart, changed the symbol to NQ #F and saved it as a new chart and the bands never drift.

                              FYI, the drift occurs after about 24 hrs ouf data (i.e., leave charts open from prior day and by about 0800 or 0900 the drift begins)

                              Comment

                              Working...
                              X