Announcement

Collapse
No announcement yet.

Stymied -- Lines Don't Draw

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

  • Stymied -- Lines Don't Draw

    I have a page with a number of Advanced Charts and recently started using the firstxminshlc.efs that is available on file sharing.
    It has always worked as expected up to the current ESignal version I am using (Build 725).

    Today I introduced it to several new charts with mixed results: the lines display in one chart but not in another. The function that should print is drawLineRelative, and I verified that that function is not being skipped.

    The picture below shows two seemingly identical charts that were created after a fresh restart of ESignal, but which have two different outputs.

    Is there some setting that would prevent the lines from being drawn? Could there be a resource issue? Any ideas?
    Attached Files

  • #2
    Hello buhrmaster,

    I have not been able to reproduce this problem with the version of the study that I have attached. Have you made any modifications to your copy? Are there any other specific steps you go through that can consistently reproduce the problem?
    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


    • #3
      I downloaded a fresh copy to make sure that I had not done anything to it. The only changes I made were to add some debug lines and it is that version that created the two results shown.

      Unfortunately I cannot reproduce the result myself so I am thinking that somehow that particular chart may have been "corrupted." I am going to rebuild the chart from scratch.

      I did save the chart and applied it as a style template to a new chart but still the lines are missing. Using the good chart as the basis for a template produced a good chart.

      Comment


      • #4
        Jason,

        Under certain circumstances this EFS does not seem to work. I think I have narrowed it down to times when the opening interval does not start at the same time the subject market starts. For example, with a 10-minute opening range any interval greater than 20 minutes, I think, will not work (Values return null). This is my first foray into trying to understand EFS2 but I think part of the problem has to do with a test of the current day v. the previous day, which can fail if the intervals don't line up (just my guess), but rest of it I can't figure out.

        Basically what I would like to achieve for example is to return the 1st 10 minutes using any interval from 1 minute up to at least an hour. Any advice on how I would go about doing this?

        Thanks.

        Comment


        • #5
          buhr

          Hello buhrmaster,

          If I understand correctly, you want to plot the first 10 mins HLC on a 20 min chart (or up to 60)?

          This study wasn't intended to display lower time frame HLC values on a higher time frame chart. There isn't any error checking for this in the study, which is why no lines are drawn. The problem occurs because of line 48 in the version I previously attached.

          PHP Code:
          if (getDay(0inv(nMin)) != getDay(-1inv(nMin))) { 
          When looking at a lower time frame series on a higher time frame chart, the Series Object returns the last bar of the lower time frame series. In this example where the study is using a 10 minute interval and the chart interval is set to 20, we have two 10 minutes bars per chart bar. So in line 48, the bar indexes that get referenced are the first ( getDay(0, inv(nMin)) ) and second ( getDay(-1, inv(nMin)) ) bar of the day on the 10 minute chart. This if statement always evaluates to false when the study interval is lower than the chart interval. To get around this you need to add a few things.

          First you need to add some logic that checks the study interval to the chart interval. If the study interval is greater than or equal to the chart interval, use the existing code. If the study interval is less than the chart interval you need to go to an else statement and look for the change in day of the main chart interval.

          PHP Code:
          if (getDay(0) != getDay(-1)) { 
          When this bar in the main chart interval is identified, you then need to add a routine that gets the number of lower time frames bars per chart bar (getInterval()/nMin). In our current example, the number would be 2. Using than number minus 1 will be the bar index reference you need to use to get the first 10 minute bar's HLC values assigned to the vXHigh, vXLow and vXClose variables on lines 49-51. They would look something like this.

          PHP Code:
          var myIndex = (getInterval() / nMin) -1;

          vXHigh vHigh.getValue(myIndex);
          vXLow vLow.getValue(myIndex);
          vXClose vClose.getValue(myIndex); 
          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
            Jason-

            Thanks for your help. The only problem I ran into was with the myIndex used to reference the various price series; it would sometimes refer to the wrong interval. So I created a day series with the same interval (inv(x)) and looped through it backwards from 0 until I got a change in the day. I then used the index from this loop to retrieve the high/low/close values from their respective series. Does this sound OK to you or is there a better (cleaner) way to handle this? I really needed a "firstBarIndexOfDay(date)" function. During the trading day it appears to work for every interval I can throw at it but last night, after hours, for some odd intervals it returned the previous day's opening range.

            Another question: why does this only draw the last day's values? Is there a way to have it draw previous days' opening ranges?

            Comment


            • #7
              Hello buhrmaster,

              I'm not sure how it would be referring to the wrong interval. Perhaps you meant index? If the chart interval and the minutes parameter (nMin) are not evenly divisible, then you will have to add some rounding logic to myIndex. Depending on the value of the remainder you may need to force the number to the next index value with a Math.floor(myIndex) or Math.ceil(myIndex).

              Were you aware of the getFirstBarIndexOfDay( date, [symbol] ) function?

              The study only draws the last days values because the drawing functions are using a fixed tag name for those lines. Every time the functions get called the lines get redrawn to their updated location. Add a global counter variable that increments by one whenever the new day is detected. Then incorporate this counter into the tag name. Currently, the numbers 0, 1 and 2 are being used for the tag names. Change them to something like "low", "high" and "close." Then concatenate the global counter variable into the tag name like below.



              This will leave the last drawn lines for each day on the chart and will redraw the current day's lines as new data gets processed.
              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