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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      561 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      325 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      547 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      547 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X