Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

First Bar of Session/ referring to bars during session

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

    First Bar of Session/ referring to bars during session

    I want my session to starts between 9:30am and 4:00 do I have to update the chart properties for each chart, save as template or is their a global way of doing this - in the Tools>Options? I cant find it

    Of the following which is more accurate for resetting variables at the start of the session?

    if(Time[0].Date != Time[1].Date)
    {
    reset vars here
    }

    or

    if ( Bars.SessionBreak )
    {
    reset vars here
    }

    or

    if (Bars.FirstBarOfSession)
    {
    reset vars here
    }

    If I am using 'BarsSinceSession' then on a 5min chart is the 9:35 close of that bar yield BarsSinceSession=1?

    or would it be more accurate
    if ( Time[0]=935)
    {
    } or something like that

    Can one use modulo arithmetic withe BarsSinceSession ? for example every 3 bars get the high and low of the last 3 5min bars i.e 15min high and low range?

    if ((BarsSinceSession % 3) == 0) //9:45 High and Low of Range
    {
    FIF_HIGH = HighestBar(High, 3)
    FIF_LOW = LowestBar(Low, 3)

    }


    or should I use

    if (Time[0]=945)
    //9:45 High and Low of Range
    {
    FIF_HIGH = HighestBar(High, 3)
    FIF_LOW = LowestBar(Low, 3)

    }

    Please advise

    Thanks

    #2
    To ensure that my indicator is only evaluated on a 5min chart is this the correct logic to use?

    if (Bars.Period.Id == PeriodType.Minute && BarsPeriod.Value = 5)
    {
    //then evaluate here?
    }

    Comment


      #3
      mefTrader,

      1. Correct for the Bars.Period one.

      2. Session begin and end times can't be set programmatically, thus please set them in the Chart Properties and use Session Break in combination with FirstBarOfSession then for the reset.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by sjsj2732, Yesterday, 04:31 AM
      0 responses
      31 views
      0 likes
      Last Post sjsj2732  
      Started by NullPointStrategies, 03-13-2026, 05:17 AM
      0 responses
      286 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      283 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      133 views
      1 like
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      91 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Working...
      X