Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

setting value to ChartControl.Properties.BarDistance

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

    setting value to ChartControl.Properties.BarDistance

    Hello,

    When the chart is set with chartControl.BarSpacingType != TimeBased
    from an indicator, I can set a value to ChartControl.Properties.BarDistance and the chart bars distance gets adjusted to the desired value.

    But when the chart is set with chartControl.BarSpacingType == TimeBased
    from an indicator, setting a value to ChartControl.Properties.BarDistance doesn’t adjusted to the desired value and eventually even prevent to manually shrink the bars by dragging with the mouse on the X axis.

    Why?
    ASCENDO Trading
    NinjaTrader Ecosystem Vendor - ASCENDO Trading

    #2
    Hello ASCENDO Trading,

    Could you provide a very simple test that demonstrates the issue? I tried using a time based 1 second chart and incrementing the value however I did not see a point where the mouse was unable to reset the chart.

    Another item to check here would be to print out the values you are setting to that property to get an idea of what range of values are needed to see the issue.

    Comment


      #3
      Hello Jesse,

      Thank you for your support.

      I have attached a sample indicator to show what the problem is.

      I have also create a video to show you what is happening vs what is expected.


      Best regards
      Attached Files
      ASCENDO Trading
      NinjaTrader Ecosystem Vendor - ASCENDO Trading

      Comment


        #4
        Hello ASCENDO Trading,

        thank you for providing the sample and extra details. I will need to review this further to see why that may not affect non equidistant bars. Once I have more details on this I will reply back here.

        Comment


          #5
          Hello ASCENDO Trading,

          After further review of the code and video this appears to be working as intended. The equidistant bar spacing would need to be enabled for the BarDistance to affect the spacing between bars. The code you used is setting the property however without equidistant spacing the bars are no longer using the BarDistance and instead using the X axis times.

          Equidistant Bar Spacing is a chart property that determines whether bars are plotted with an equal distance from each other or plotted on a horizontal axis with even time spacing.
          When using the menu option for bar distance +/- that also includes a zoom function which is why we see the bars move based on those buttons while equidistant is off.
          You can see a similar action by calling the Plus or Minus event handlers on the ChartControl.

          ChartControl.OnBarSpacingPlusHotKey(null, null);


          Comment


            #6
            Hello Jesse,

            Thank you for your support.

            Calling OnBarSpacingPlusHotKey or OnBarSpacingMinusHotKey is changing the distance between the bars but I can't get a distance that is the same on both side of each bar.

            Would you know a trick to adjust the bar spacing on equidistant bar spacing chart such that the distance on each side of the bar will be the same?

            Thank you
            ASCENDO Trading
            NinjaTrader Ecosystem Vendor - ASCENDO Trading

            Comment


              #7
              Hello ASCENDO Trading,

              Calling those methods is only part of how the charts logic to control spacing works, those are just why you see the bars moving when using the menu options vs it does nothing when setting it from code. That note was just to point out that you won't see any visible changes when you are not using equidistant spacing and setting the bar spacing in code. You won't be able to get equal spacing by calling those methods and with equidistant spacing off that also wouldn't be expected to have same spaces between bars. .

              There is only 1 setting for the bar spacing which is the property we have been talking about. When using equidistant spacing that property would be used so the spacing is whatever is set in the UI or through code. With equidistant spacing off that value is not used because the bars are tied to the X axis and its times, there is no relevance to having the same space between bars at that point because that would not correspond with the X axis times.


              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              647 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              369 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              108 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              572 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              573 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X