dayOpen (int zone, int day) : var

dayClose (int zone, int day) : var

dayHigh (int zone, int day) : var

dayLow (int zone, int day) : var

dayPivot (int zone, int day) : var

Returns the open, close, high, low, and pivot point within the market hours (by default, 9:30 am until 16:00 pm) of a given working day and time zone. Can be used for seasonal trading, gap trading, or daily price action. The pivot point is defined as (High+Low+Close)/3.

Parameters:

zone UTC for UTC time or ET for New York time, or a number giving the zone offset in hours to UTC. Daylight saving time is considered in non-UTC zones from 2000 to 2019.
day Working day offset, i.e. 0 = today (see remarks), 1 = yesterday, 2 = day before yesterday, and so on. Weekends are skipped, f.i. if today is Monday, 1 refers to last Friday.

Returns

Price.

Usage:

dayClose(ET,1) returns yesterday's closing price of the current asset at the New York Stock Exchange.

Remarks:

Example:

// simple gap trading system, 
// based on a publication by David Bean 
function run()
{
  BarPeriod = 10;
  LookBack = 100*24*60/BarPeriod; // 100 days lookback 

  asset("SPX500");  
  Stop = 100*PIP;
  TakeProfit = 40*PIP;

  vars Prices = series(price());  
  var High = dayHigh(ET,1);
  var Low = dayLow(ET,1); 
  var Close = dayClose(ET,1);

// enter a trade when the NYSE opens 
  if(High > 0 && Low > 0 && Close > 0 
    && timeOffset(ET,0,9,30) == 0)
  {
    var Avg = SMA(Prices,LookBack);
    if(*Prices > Close 
      && *Prices < High
      && *Prices < Avg)
      enterShort();
          
    if(*Prices < Close 
      && *Prices > Low
      && *Prices > Avg)
      enterLong();
  }
}

See also:

price, timeOffset, market, BarMode, Pivot, Support/Resistance

► latest version online