Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ChartScale.Properties.HorizontalGridlinesInterval - No Effect

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

    ChartScale.Properties.HorizontalGridlinesInterval - No Effect

    Hi,

    I'm trying to set the Horizontal Grid Line Interval although it doesn't have any effect. I've tried with the code below in both an indicator and a chart style but when outputting chartScale.Properties.HorizontalGridlinesInterval to the output windows it still returns 0 and has no effect on the chart. Should it have the desired effect?

    Example code is below, I've also added the 4 lines within the OnRender method to the CandlStyle chart style but also has no effect.

    Thanks

    namespace NinjaTrader.NinjaScript.ChartStyles
    {
    public class GridLinesChartStyle : ChartStyle
    {
    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Enter the description for your new custom Chart style here.";
    Name = "GridLinesChartStyle";
    ChartStyleType = (ChartStyleType) 8;
    BarWidth = 2;
    }
    else if (State == State.Configure)
    {
    }
    }

    public override bool IsTransparent { get { return false; } } // replace with your logic to check if entire style is transparent

    public override int GetBarPaintWidth(int barWidth)
    {
    return 1; //replace with your bar width logic
    }

    public override void OnRender(ChartControl chartControl, ChartScale chartScale, ChartBars chartBars)
    {
    chartScale.Properties.HorizontalGridlinesIntervalT ype = HorizontalGridlinesIntervalType.Ticks;
    chartScale.Properties.HorizontalGridlinesInterval = 1;
    base.OnRender(chartControl, chartScale, chartBars);
    Print(chartScale.Properties.HorizontalGridlinesInt erval);
    }

    }
    }
    Last edited by tdouglas; 08-22-2015, 01:48 AM.

    #2
    What is the HorizontalGridlinesCalculation set to? If it's Automatic, that value would return 0. You need to set that to Fixed.

    Code:
    public override void OnRender(ChartControl chartControl, ChartScale chartScale, ChartBars chartBars)
    {
    	Print("HorizontalGridlinesCalculation: " + chartScale.Properties.HorizontalGridlinesCalculation);
    	Print("HorizontalGridlinesInterval: " + chartScale.Properties.HorizontalGridlinesInterval);
    	Print("HorizontalGridlinesIntervalType: " + chartScale.Properties.HorizontalGridlinesIntervalType);
    	
    	if (chartScale.Properties.HorizontalGridlinesCalculation != YAxisRangeType.Fixed)
    		chartScale.Properties.HorizontalGridlinesCalculation = YAxisRangeType.Fixed;
    	
    	chartScale.Properties.HorizontalGridlinesInterval = 100;
    	
    }
    MatthewNinjaTrader Product Management

    Comment


      #3
      Worked perfectly. Thanks!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by jeronymite, 04-12-2024, 04:26 PM
      3 responses
      43 views
      0 likes
      Last Post jeronymite  
      Started by frankthearm, Today, 09:08 AM
      4 responses
      9 views
      0 likes
      Last Post frankthearm  
      Started by yertle, Today, 08:38 AM
      5 responses
      15 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by adeelshahzad, Today, 03:54 AM
      3 responses
      18 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by bill2023, Yesterday, 08:51 AM
      6 responses
      27 views
      0 likes
      Last Post NinjaTrader_Erick  
      Working...
      X