Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

pointO bar no longer works so I copy Rang bar and name it rangePlus but needs help

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

    pointO bar no longer works so I copy Rang bar and name it rangePlus but needs help

    range bar = new bar when there is a new range, no new bar when price repeats the range
    range bar plus = new bar even when price repeats the same range.
    I am not sure where to add the new bar of the same range.
    Attached Files

    #2
    Hello nkhoi,

    This updates on every data value. On what conditions do you want to call AddBar()?

    What do you mean by repeats the same range? Do you mean hits the low without making a new bar and then hits the high without making a new bar?
    What are the specific rules?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello nkhoi,

      This updates on every data value. On what conditions do you want to call AddBar()?

      What do you mean by repeats the same range? Do you mean hits the low without making a new bar and then hits the high without making a new bar?
      What are the specific rules?
      the range = 20 ticks, if it moves 20 ticks then it should add a new bar Click image for larger version

Name:	pointo-vs-range-bar.png
Views:	346
Size:	85.3 KB
ID:	1176147
      pointO is still working in NT7 so I include it here for illustration

      Comment


        #4
        Hello nkhoi,

        If you want the behavior to be the same as the NT7 script, I would recommend copying the logic from this, and updating any code breaking changes.

        Regarding "the range = 20 ticks, if it moves 20 ticks then it should add a new bar".

        So if the barClose is greater than barOpen + 20 * bars.Instrument.MasterInstrument.TickSize then call AddBar()?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_ChelseaB View Post
          Hello nkhoi,

          If you want the behavior to be the same as the NT7 script, I would recommend copying the logic from this, and updating any code breaking changes.

          Regarding "the range = 20 ticks, if it moves 20 ticks then it should add a new bar".

          So if the barClose is greater than barOpen + 20 * bars.Instrument.MasterInstrument.TickSize then call AddBar()?
          thanks for the hint, I comment out this line and it seems to work again, what will be the code breaking for this line?
          (bars.IsResetOnNewTradingDay && bars.SessionIterator.IsNewSession(time, isBar)
          -- NT error
          'NinjaTrader.Data.Bars' does not contain a definition for 'SessionIterator' and
          no extension method 'SessionIterator' accepting a first argument of type 'NinjaTrader.Data.Bars'
          could be found (are you missing a using directive or an assembly reference?)
          CS1061

          Comment


            #6
            Hello nkhoi,

            The SessionIterator code has changed.

            The code you have in RangePlus would be correct.
            Code:
            if (SessionIterator == null)
            SessionIterator = new SessionIterator(bars);
            
            isNewSession = SessionIterator.IsNewSession(time, isBar);
            
            if (isNewSession)
            SessionIterator.GetNextSession(time, isBar);

            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            571 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            331 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
            549 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            549 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X