Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
NT8 chart scaling [F] mode
Collapse
X
-
I am trying to set autoscale to automatic using this property:
But I get an error (Object reference not set to an instance of an object.).Code:ChartControl.ChartPanels[0].Scales[0].Properties.YAxisRangeType = YAxisRangeType.Automatic;
I also cannot "read" the value of YAxisRangeType (Same error). I am doing this inside the OnBarUpdate of an Indicator. I simply want to set the scale to automatic at the end of the day, at 031500 time. Is there a better way? Thanks.Last edited by RogBear; 08-13-2018, 10:59 PM.
Comment
-
Hello
Thank you for the post.
It looks like something has changed since this post was created, I tested this syntax and also get an error. I was able to use the following successfully to gather the scale and set its properties:
Ensure you have the following using statements at the top of the file:
Code:using System.Linq; using NinjaTrader.Gui.Chart;
This includes error checking for null objects. You can control the panel using ChartPanels[0] and then pick the scale needed by its ScaleJustification. ScaleJustification == ScaleJustification.RightCode:if (ChartControl != null) { ChartPanel cp = ChartControl.ChartPanels[0]; if (cp != null) { ChartScale scale = cp.Scales.First(s => s.ScaleJustification == ScaleJustification.Right); if (scale != null) scale.Properties.YAxisRangeType = YAxisRangeType.Fixed; } }
I look forward to being of further assistance.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
605 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
351 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
105 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
560 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
561 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment