Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Dynamic setting "horizontal grid lines interval "

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

    Dynamic setting "horizontal grid lines interval "

    Is there anyway to dynamic setting horizontal interval according to current average true range (ATR(14) round up to closed integer) in indicator?

    #2
    Hi joysync, thanks for your question.

    This will need to be tested, but we have properties for the chart scale here where you can access the interval of the HorizontalGridlinesInterval
    https://ninjatrader.com/support/help...properties.htm

    I was able to change the interval type in OnRender like this:

    Code:
        public class TestIndicator : Indicator
        {
    
            protected override void OnStateChange()
            {
                if (State == State.SetDefaults)
                {
                    //...
                }
                else if (State == State.Configure)
                {
    
                    AddPlot(Brushes.Yellow, "MyPlot");
                }
    
            }
    
            double myvalue = 0;
            protected override void OnBarUpdate()
            {
                Value[0] = ATR(20)[0];
                myvalue = Value[0];
            }
    
            protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
            {
                chartScale.Properties.HorizontalGridlinesInterval = myvalue;
    
            }
        }
    Please let me know if I can assist any further.

    Comment


      #3
      thanks Chris. I will let your know result.

      Comment

      Latest Posts

      Collapse

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