Announcement

Collapse
No announcement yet.

getTodayOHLC.efs

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

  • getTodayOHLC.efs

    Anyone know how to change the getTodayOHLC.efs to exclude premarket (include only 8:30 - 15:16 CST)? I'd like to draw H/L for regular market hours only.

    Thanks

  • #2
    Time Templates

    You should be able to create and apply a time template for your chart that sets the time interval for the data. Right click on your chart and choose Time Templates -Edit.

    Comment


    • #3
      Hello gdargento,

      werosen's suggestion is part of the solution, but there is more to it. unfortunately, the formula will not do what you need because it get's its data from the daily chart. You will need a new formula that collects the data you're after from the current chart interval the formula is running on, which will use the specified start and end times of your custom time template to filter out the pre-market data.

      What the formula will need to do is establish some global variables such as nHigh, nLow and nOpen. Look for the first bar of each day and reset the global variables using that first bar of that day's data.

      PHP Code:
      if (getDay(0) != getDay(-1)) {  // we have a new day
          
      nHigh high(0);  // set to current bar's high
          
      nLow low(0);  // set to current bar's low
          
      nOpen open(0); // set to current bar's open
      } else {  // still the same day as the last bar
          
      nHigh Math.max(nHighhigh(0));  // set to new bars high if greater
          
      nLow Math.min(nLowlow(0));  // set to new bars low if lower
          // leave nOpen alone until the next day is found

      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