Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarsSinceSession Conversion

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

  • aligator
    replied
    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:	91
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!

    Leave a comment:


  • NinjaTrader_PaulH
    replied
    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:	91
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

    Leave a comment:


  • aligator
    started a topic BarsSinceSession Conversion

    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.

Latest Posts

Collapse

Topics Statistics Last Post
Started by Gathem, Yesterday, 06:06 PM
2 responses
27 views
0 likes
Last Post NinjaTrader_PaulH  
Started by Malekyou, 01-15-2021, 07:42 AM
3 responses
25 views
0 likes
Last Post backtester831  
Started by frankduc, Today, 06:59 AM
1 response
8 views
0 likes
Last Post NinjaTrader_Jesse  
Started by jack1234, 05-03-2017, 08:41 AM
8 responses
2,934 views
0 likes
Last Post NinjaTrader_PaulH  
Started by prodigaltrader, Today, 12:18 AM
1 response
12 views
0 likes
Last Post NinjaTrader_PaulH  
Working...
X