Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarsSinceSession Conversion

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

    BarsSinceSession Conversion

    Dear Support,

    What is the NT8 conversion for the following NT7 bar index?:

    Code:
                 int barsSince = Bars.BarsSinceSession;
    There is no code breaking for Bars.BarsSinceSession in "Help." However, there is a Bars.BarsSinceNewTradingDay, but I'm not sure produces the same results since new trading day is not the same as session.

    Many Thanks.

    #2
    Hello aligator,

    Thanks for your post.

    With reference to the code-breaking change section of the help guide, BarsSinceNewTradingDay is the NT8 equivalent of the NT7 BarsSinceSession:

    Click image for larger version

Name:	Alligator-1.PNG
Views:	78
Size:	5.7 KB
ID:	1059272 Reference: https://ninjatrader.com/support/help...ng_changes.htm


    If you are using a multisession trading day and want to keep track of the bars since each session begins, you can use the bool IsFirstBarOfSession as a starting point to set an int type counter and update the counter on each new bar.

    For example:

    if (Bars.IsFirstBarOfSession)
    {
    myBarsSinceSession = 1; // set/reset counter on each new session (you would need to create myBarsSinceSession as an int type variable)
    }

    if (IsFirstTickOfBar)
    {
    myBarsSinceSession++; // increment counter
    }


    References:
    https://ninjatrader.com/support/help...rofsession.htm
    https://ninjatrader.com/support/help...ttickofbar.htm
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_PaulH View Post
      Hello aligator,

      Thanks for your post.

      With reference to the code-breaking change section of the help guide, BarsSinceNewTradingDay is the NT8 equivalent of the NT7 BarsSinceSession:

      Click image for larger version

Name:	Alligator-1.PNG
Views:	78
Size:	5.7 KB
ID:	1059272 Reference: https://ninjatrader.com/support/help...ng_changes.htm


      If you are using a multisession trading day and want to keep track of the bars since each session begins, you can use the bool IsFirstBarOfSession as a starting point to set an int type counter and update the counter on each new bar.

      For example:

      if (Bars.IsFirstBarOfSession)
      {
      myBarsSinceSession = 1; // set/reset counter on each new session (you would need to create myBarsSinceSession as an int type variable)
      }

      if (IsFirstTickOfBar)
      {
      myBarsSinceSession++; // increment counter
      }


      References:
      https://ninjatrader.com/support/help...rofsession.htm
      https://ninjatrader.com/support/help...ttickofbar.htm
      Thank you so much Paul.

      Cheers!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by patricia70, Today, 03:57 AM
      0 responses
      4 views
      0 likes
      Last Post patricia70  
      Started by pjsmith, Today, 03:25 AM
      0 responses
      5 views
      0 likes
      Last Post pjsmith
      by pjsmith
       
      Started by cincai, Today, 01:04 AM
      1 response
      13 views
      0 likes
      Last Post NinjaTrader_Jason  
      Started by voltation, Today, 12:37 AM
      1 response
      13 views
      0 likes
      Last Post NinjaTrader_Jason  
      Started by Negustrader, Today, 01:01 AM
      0 responses
      8 views
      0 likes
      Last Post Negustrader  
      Working...
      X