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 AaronKoRn, Today, 09:49 PM
          0 responses
          6 views
          0 likes
          Last Post AaronKoRn  
          Started by carnitron, Today, 08:42 PM
          0 responses
          9 views
          0 likes
          Last Post carnitron  
          Started by strategist007, Today, 07:51 PM
          0 responses
          10 views
          0 likes
          Last Post strategist007  
          Started by StockTrader88, 03-06-2021, 08:58 AM
          44 responses
          3,977 views
          3 likes
          Last Post jhudas88  
          Started by rbeckmann05, Today, 06:48 PM
          0 responses
          9 views
          0 likes
          Last Post rbeckmann05  
          Working...
          X