GetTradingDayEndLocal()

<< Click to Display Table of Contents >>

Navigation:  NinjaScript > Language Reference > Common > SessionIterator >

GetTradingDayEndLocal()

Previous page Return to chapter overview Next page

Definition

Converts the trading day end time from the exchange timezone to local time, and returns a DateTime object in the local timezone. The ActualTradingDayExchange property can be passed into GetTradingDayBeginLocal() for a quick timezone conversion.

 

Property Value

A DateTime object representing the exchange-based trading day end time converted to local time.

 

Syntax

<SessionIterator>.GetTradingDayEndLocal(DateTime tradingDayExchange)

 

Parameters

tradingDayExchange

The DateTime value used to calculate the trading day.

 

 

Example

ns



protected override void OnBarUpdate()
{
  // Only process strategy logic up until three hours prior to the end of the trading day at the exchange
  if (DateTime.Now <= Bars.SessionIterator.GetTradingDayEndLocal(Bars.SessionIterator.ActualTradingDayExchange).AddHours(-3))
  {
      // Strategy logic here
  }
}