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 Hwop38, 05-04-2026, 07:02 PM
      0 responses
      157 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      307 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      244 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      346 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      176 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X