Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

UpdateBar() does not update bar open value

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

    UpdateBar() does not update bar open value

    Per discussion in http://www.ninjatrader-support2.com/...ad.php?t=23264, I think there is an issue in the UpdateBar() routine, in that the open value can not be changed. To implement custom bars, this functionality is required.

    Because you can not change the open in the bar generation code, you are forced to work around the issue in the bar painting code in the ChartStyle, which works for renko, but then the values that show up in the data window do not match the actual values that the bars show. This is also true if you are trying to use the open values in a strategy/indicator. Effectively, you are forcing work arounds into all kinds of code, instead of just keeping it in the bar generation code where it belongs.

    I can understand not wanting to change the routine, due to legacy issues, but there should be a way to change the open of a bar even if it had to be done via a new routine/property (i.e. bar.SetOpen() or bar.Open) to make it explicit since normally you would not need to change the open. Is there a way to do this? If not, please change/add this functionality.

    #2
    I believe this is a limitation that has implications if we changed it which is likely why we have not. I will double check again though.
    RayNinjaTrader Customer Service

    Comment


      #3
      Yes, I expect there would be some legacy concerns. For that reason, adding a new routine to explicitly set the open would be the way to go. Thanks for looking into.

      Comment


        #4
        >> UpdateBar() does not update bar open value
        This is by design.

        Check out "bars.RemoveLastBar()" in case you needed to replace last bar. Don't try to remove more than one bar by multiples calls in a row. Note: this is beyond what we provide support for.

        Comment


          #5
          Perfect. Greatly Appreciated!

          Comment


            #6
            Curious: Are you still working on the Renkos? If so, would you mind if we considered incorporated your work in NT? Thanks

            Comment


              #7
              Sure, just have someone send me a PM or email, and I will work with you to get you the code and and answer any questions. It entails changes to RenkoBarType and OpenCloseStyle as the two work together.

              Comment


                #8
                Excellent, thanks. Appears you have turned off forum messaging. Would you mind firing me a mail to "dierk AT ninjatrader DOT com"? Thanks

                Comment


                  #9
                  FYI, new RenkoBarType code is in NT7B6.

                  The wick data is there, if you check in the data window. If you want to see wicks, you can enable CandleSticks for renko bars by enabling it in the RenkoBarType class in @BarTypes.cs file like this

                  Code:
                  public override Gui.Chart.ChartStyleType[] ChartStyleTypesSupported
                  {
                  	get { return new Gui.Chart.ChartStyleType[] { Gui.Chart.ChartStyleType.OpenClose, Gui.Chart.ChartStyleType.CandleStick  }; }
                  }
                  After making the change, just recompile any indicator and restart NT. You should then be able to select CandleStick in addition to OpenClose chart styles.

                  Comment


                    #10
                    Will the next beta allow possibility to change to candlestick type for Renko charts as default (without making any changes to the code)?

                    Thanks
                    Last edited by gregid; 01-22-2010, 07:14 AM.

                    Comment


                      #11
                      Thanks for your suggestion. We'll add it to the list of future considerations.

                      Comment


                        #12
                        Hi Aslane
                        I tried this and it works, however the wicks are only available for the current bar, how would I set it that the wicks remain for the historical bars as well.

                        thanks

                        Comment


                          #13
                          Originally posted by Eagle View Post
                          Hi Aslane
                          I tried this and it works, however the wicks are only available for the current bar, how would I set it that the wicks remain for the historical bars as well.

                          thanks
                          Well, this worked perfectly in B6, but Ninja seems to have changed the code quite a bit in B7 so it is completely busted in terms of wicks. That may also be why they did not make the one line of code change to enable CandleSticks that was mentioned in previous post.

                          I will leave it to the Ninja guys to explain why they made changes and to fix it. Most of the changes look like they were trying to bullet proof the code, but they failed to maintain the wick data when they made the changes. Basically, every AddBar() and UpdateBar() call got messed up because they did not maintain the wick data, and instead used the renko Hi/Lo of the bar.

                          Comment


                            #14
                            Thanks for the reply. Where is your original code supplied to Support. Would it make sense to add this original in the bar types and call it Renko 2 or something? I guess this file gets overwritten with each new version. But could be useful for me for the interim.
                            thanks

                            Comment


                              #15
                              Attached is a zip wile with two files: @BarsTypes.cs and RenkoBarsTypeB6.cs.

                              The @BarsTypes.cs file is the B7 code with the RenkoBarsType class commented out, and is intended to overwrite original B7 code.

                              The RenkoBarsTypeB6 file is the version of the code from B6 which works and has candlesticks enabled. (don't have time to repatch the B7 code right now).

                              You need to extract and drop the two files into the My Docs/NinjaTrader 7/bin/Custom/Type dir (importing this zip file into NT will not work). Before doing, you may want to make a copy of this dir outside of Ninja dir in case something goes wrong. Then go compile any indicator and shut down and restart NT. All should be good.

                              Hope that works.
                              Attached Files

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              633 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              364 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              105 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              567 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              568 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X