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 ZenCortexS66, Today, 01:25 PM
          0 responses
          0 views
          0 likes
          Last Post ZenCortexS66  
          Started by tkaboris, 04-26-2024, 05:13 PM
          1 response
          9 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by Taddypole, 04-26-2024, 02:47 PM
          2 responses
          16 views
          0 likes
          Last Post Taddypole  
          Started by futtrader, 04-21-2024, 01:50 AM
          6 responses
          59 views
          0 likes
          Last Post futtrader  
          Started by sgordet, Today, 11:48 AM
          0 responses
          8 views
          0 likes
          Last Post sgordet
          by sgordet
           
          Working...
          X