ICE Data Services -



getFirstBarIndexOfDay( Date,[Symbol] )


  • Date:  A valid Date object (using "time" or "rawtime").
  • Symbol:  Optional parameter.  The function will use the chart symbol and interval if not specified.  Otherwise you may specify another symbol as well as an interval (see example 2).




Gets the absolute value index to the first bar of the given date. 

var vTime = getValue("Time");
if (vTime != null) {
  var vFirstIndex = getFirstBarIndexOfDay(vTime);
  if (vFirstIndex != null) {
    vTodaysOpen = getValueAbsolute("open", vFirstIndex);



Gets the absolute value index to the first bar of the givendate for a specified symbol and interval.  This is most commonly used toget the open price for the current chart symbol based on the daily bar from anintra-day or tick chart.


var vTodaysOpen = null;
function main() {
  var vTime = getValue("Time");
  var vFirstIndex = getFirstBarIndexOfDay(vTime, getSymbol() + ",D");
  if (vFirstIndex != null && getDay(0) != getDay(-1)) {
    debugPrintln(getCurrentBarIndex() + " " + vFirstIndex);
    vTodaysOpen = getValueAbsolute("open", vFirstIndex, getSymbol() + ",D");
  return vTodaysOpen;