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

how to skip first bar of session in condition

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

    how to skip first bar of session in condition

    how to skip first bar of session in condition


    I use a condition that counts all bars (the volume of all bars since the beginning of the session), I had the task of excluding the first bar of the session from the condition, that is, I need to start the calculation of the condition from the second bar of the session

    how can I do it right?

    Tried so - does not work

    if (Bars.IsFirstBarOfSession == false)
    if Conditionl)
    {
    }

    UPD

    rechecked by printout

    if (Bars.IsFirstBarOfSession == false) - works good

    the first bar is excluded from the calculation.

    Then the question changes to how to exclude, for example, the first 3 bars from the calculation?
    Last edited by memonolog; 10-20-2020, 04:26 AM.

    #2
    Hello memonolog,

    Thanks for your post.

    You can use Bars.BarsSinceNewTradingDay: https://ninjatrader.com/support/help...tradingday.htm

    if (Bars.BarsSinceNewTradingDay > 3) // perform after the 3 first bars
    {
    if (your condition)
    {
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_PaulH View Post
      Hello memonolog,

      Thanks for your post.

      You can use Bars.BarsSinceNewTradingDay: https://ninjatrader.com/support/help...tradingday.htm

      if (Bars.BarsSinceNewTradingDay > 3) // perform after the 3 first bars
      {
      if (your condition)
      {
      Thank you Paul

      Comment


        #4
        Paul, is there a way to achieve this kind of condition within the strat builder? I have a range bar pattern I'm working with and I need the strategy to ignore any bars from a prior session, or even better, a prior time.

        thanks,
        David

        Comment


          #5
          Hello trader3000a,

          Thanks for your post.

          The only reference the strategy builder would have is Misc>First bar of session which is a true/false condition.

          You can use a time filter or time referfence.
          References:


          Paul H.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by llanqui, Today, 11:10 AM
          1 response
          15 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by reynoldsn, 05-10-2024, 07:04 PM
          2 responses
          23 views
          0 likes
          Last Post reynoldsn  
          Started by llanqui, Today, 10:29 AM
          1 response
          12 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by Trader146, 05-10-2024, 09:17 PM
          1 response
          22 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by bourasrafik, Today, 03:26 PM
          0 responses
          5 views
          0 likes
          Last Post bourasrafik  
          Working...
          X