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:	48
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);
            https://ninjatrader.com/support/help...oniterator.htm
            https://ninjatrader.com/support/help...ng_changes.htm
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by cmv727, Today, 05:38 AM
            0 responses
            12 views
            0 likes
            Last Post cmv727
            by cmv727
             
            Started by AlessioCianini12, Today, 01:38 AM
            0 responses
            33 views
            0 likes
            Last Post AlessioCianini12  
            Started by nandhumca, Yesterday, 11:54 PM
            0 responses
            29 views
            0 likes
            Last Post nandhumca  
            Started by nandhumca, Yesterday, 11:51 PM
            0 responses
            28 views
            0 likes
            Last Post nandhumca  
            Started by ezrollin, Yesterday, 11:48 PM
            2 responses
            31 views
            0 likes
            Last Post ezrollin  
            Working...
            X