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

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:	273
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 judysamnt7, 03-13-2023, 09:11 AM
            4 responses
            57 views
            0 likes
            Last Post DynamicTest  
            Started by ScottWalsh, Today, 06:52 PM
            4 responses
            36 views
            0 likes
            Last Post ScottWalsh  
            Started by olisav57, Today, 07:39 PM
            0 responses
            7 views
            0 likes
            Last Post olisav57  
            Started by trilliantrader, Today, 03:01 PM
            2 responses
            19 views
            0 likes
            Last Post helpwanted  
            Started by cre8able, Today, 07:24 PM
            0 responses
            9 views
            0 likes
            Last Post cre8able  
            Working...
            X