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

Detecting when user changes bar width

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

    Detecting when user changes bar width

    In an indicator I'm writing, I would like to use the width that the user can change by pressing Alt-up and Alt-down. I see this in two places: ChartControl.BarWidth and Bars.BarsData.ChartStyle.BarWidth.

    Is there a preference about which I should use? Either one seems to work but I don't know if there are disadvantages to one over the other.

    I'm overriding Plot() to draw my indicator because I don't know of a better way to plot a bar chart using my own calculated values for open, high, low, close. If there is a better/cleaner way, please tell me.

    -A

    #2
    Hello,

    Thanks for the forum post.

    Unfortunately since there is no documentation on this you are operating out in unsupported territory here.

    I would suspect that both methods should do the trick for you however since its unsupported theirs not much more information I can provide other then that.

    Let me know if I can be of further assistance.

    Comment


      #3
      FYI - I like to have my candles a constant width - it helps me with pattern recognition. So the bars.barsdata method works better than ChartControl.BarWidth - I don't know why.
      However be aware that if you zoom in and zoom out the autoscaling is effectively overriden so this wouldn't be to everyone's taste.

      Comment


        #4
        am not a programmer, but from your post here, am wondering if you found a way to adjust bar width by adding an indicator to a chart. would like to compress (reduce) bar width and spacing on some of my tick charts in order to view more historical data and recent history within a normal window. the normal horizontal spacing tools do not provide enough for my needs. can you point me to any solutions on this subject...? thxs much Will

        Comment


          #5
          Hello valhallafutures,

          To change the bar spacing or width:
          ChartControl.BarWidth = 10;
          ChartControl.BarSpace = 10;
          Chelsea B.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by adeelshahzad, Today, 03:54 AM
          4 responses
          25 views
          0 likes
          Last Post adeelshahzad  
          Started by merzo, 06-25-2023, 02:19 AM
          10 responses
          823 views
          1 like
          Last Post NinjaTrader_ChristopherJ  
          Started by frankthearm, Today, 09:08 AM
          5 responses
          17 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by jeronymite, 04-12-2024, 04:26 PM
          3 responses
          43 views
          0 likes
          Last Post jeronymite  
          Started by yertle, Today, 08:38 AM
          5 responses
          16 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Working...
          X