Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Chartcontrol commands: migration from NT7 to NT8

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

    Chartcontrol commands: migration from NT7 to NT8

    Hello,
    I have this code being part of an indicator for NT7.
    The code centers the chart within the chart window so that the last price is at y/2 of the chart.

    private void CentrePrice_Click(object sender, EventArgs e)
    { double yAxisSize;
    if (this.ChartControl.YAxisRangeTypeRight == YAxisRangeType.Fixed)
    {yAxisSize = this.ChartControl.FixedPanelMaxRight -
    this.ChartControl.FixedPanelMinRight;
    }
    else
    {this.ChartControl.YAxisRangeTypeRight = YAxisRangeType.Fixed;
    yAxisSize = this.ChartControl.Bounds.Height * TickSize / yAxisPixelsPerTick;
    }
    double center = this.GetCurrentBid();
    if (CurrentBar != this.LastBarIndexPainted)
    center = Close[CurrentBar - this.LastBarIndexPainted];
    this.ChartControl.FixedPanelMaxRight = center + (yAxisSize / 2);
    this.ChartControl.FixedPanelMinRight = center - (yAxisSize / 2);
    ChartControl.ChartPanel.Invalidate();
    }


    NT8 does not contain the NT7 ChartControl functions:
    ChartControl.YAxisRangeTypeRight,
    YAxisRangeType.Fixed
    ChartControl.FixedPanelMaxRight
    ChartControl.Bounds.Height
    yAxisPixelsPerTick

    Is there a way to code this in NT8?

    Thanks

    #2
    Originally posted by jazzytrumpet View Post
    The code centers the chart within the chart window so that the last price is at y/2 of the chart.
    Is there a way to code this in NT8?
    To center the price vertically, no coding is necessary. Simply check the "Center price on scale" box in the Data Series properties.
    Attached Files

    Comment


      #3
      Thanks a lot, tradesmart. This helps.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      156 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      90 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      138 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      130 views
      1 like
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      107 views
      0 likes
      Last Post CarlTrading  
      Working...
      X