Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
      BertrandNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by ZenCortexAuCost, Today, 04:22 AM
      0 responses
      0 views
      0 likes
      Last Post ZenCortexAuCost  
      Started by SantoshXX, Today, 03:09 AM
      0 responses
      13 views
      0 likes
      Last Post SantoshXX  
      Started by DanielTynera, Today, 01:14 AM
      0 responses
      2 views
      0 likes
      Last Post DanielTynera  
      Started by yertle, 04-18-2024, 08:38 AM
      9 responses
      42 views
      0 likes
      Last Post yertle
      by yertle
       
      Started by techgetgame, Yesterday, 11:42 PM
      0 responses
      14 views
      0 likes
      Last Post techgetgame  
      Working...
      X