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 traderqz, Today, 12:06 AM
      6 responses
      12 views
      0 likes
      Last Post traderqz  
      Started by Skifree, Today, 03:41 AM
      3 responses
      12 views
      0 likes
      Last Post Skifree
      by Skifree
       
      Started by traderqz, Yesterday, 09:06 AM
      5 responses
      33 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by guillembm, Today, 11:25 AM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by owensd, 04-21-2024, 11:34 PM
      9 responses
      34 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Working...
      X