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

Bar Width

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

    Bar Width

    Hi, how do you set the "Match data series width' setting from within an indicator?

    #2
    Hello pman777,

    Thank you for the post.

    I could not find any available property to set this up. You could perform the same logic with the BarWidth property that Chart Control has.

    After you get that value, you can set the Width of any plot in the Plots array.

    Please let me know If I can assist further.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChrisL View Post
      Hello pman777,

      Thank you for the post.

      I could not find any available property to set this up. You could perform the same logic with the BarWidth property that Chart Control has.

      After you get that value, you can set the Width of any plot in the Plots array.

      Please let me know If I can assist further.
      Hi ChrisL,

      There is a built-in feature for that in NT 8.0.16.3.

      If you use "Bar" for Plot style in any indicator properties, the NT8 will insert a check box under the indicators properties which you can click to "Match data series width".

      Cheers!

      Comment


        #4
        Hello aligator,

        Good catch, I missed that. Thank you for sharing!
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          i'm wondering if Pman777's original intent was to set this within the indicator coding itself so that it comes as default when loaded...
          that's my question - can i do something in the indicator code when i'm coding a new indicator that uses a bar histogram to check that box as a default ?
          thanks,
          wes

          i just looked at BarWidth but i'm not sure how i would use this to do the same as the checkbox "Match Data Series Width" ?
          Last edited by stafe; 03-02-2019, 07:23 PM.

          Comment


            #6
            Hello stafe,

            Thanks for the follow-up.

            I found this property hiding under a different moniker: "AutoWidth", setting AutoWidth = true; in State.SetDefaults after your plots are added will enable the "Match bar width" property even though it might not set it within the UI property grid.

            Please let me know if I can assist further.

            Chris L.NinjaTrader Customer Service

            Comment


              #7
              thank you, that's very helpful...

              Comment


                #8
                For those who come across this thread, ChrisL is referring to a property of the Plot class. It has a property Plot.AutoWidth = true. You have to find the Plot you wish to change in the Plots array of the Indicator and change that to true. I suspect plots are added to the array in the order for which you call AddPlot so you should be able to modify the last Plot in the array it immediately after AddPlot.

                As of NinjaTrader 8.0.24.1, if you set this flag in SetDefaults after you call AddPlot, it will check the item in the UI.

                Please put a feature request to have AddPlot() return the Plot it just created. This would make for easier time in adjusting this flag and knowing which plot you are adjusting.
                Last edited by ntbone; 06-15-2021, 09:31 PM.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by rocketman7, Today, 02:12 AM
                5 responses
                23 views
                0 likes
                Last Post rocketman7  
                Started by trilliantrader, 04-18-2024, 08:16 AM
                7 responses
                28 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Started by samish18, 04-17-2024, 08:57 AM
                17 responses
                66 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Started by briansaul, Today, 05:31 AM
                1 response
                15 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by PaulMohn, Today, 03:49 AM
                1 response
                12 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Working...
                X