if (State == State.SetDefaults)
{
SetZOrder(-1);
Description = @"Enter the description for your new custom Indicator here.";
Name = "My3VerticalLines";
Calculate = Calculate.OnBarClose;
IsOverlay = true;
DisplayInDataBox = true;
DrawOnPricePanel = true;
DrawHorizontalGridLines = true;
DrawVerticalGridLines = true;
PaintPriceMarkers = true;
ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
//Disable this property if your indicator requires custom values that cumulate with each new market data event.
//See Help Guide for additional information.
IsSuspendedWhileInactive = true;
}
else if (State == State.Configure)
{
}
}
protected override void OnBarUpdate()
{
if (CurrentBar < 52) return;
Draw.VerticalLine(this, "line1", 0, false, "Line1");
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Set vertical line width and opacity
Collapse
X
-
Set vertical line width and opacity
How do I set the width of the verticalline and it's opacity? the indicator looks like this right now
Code:Last edited by johntraderuser2; 02-24-2024, 12:36 PM.Tags: None
-
Hello johntraderuser2,
Thanks for your post.
To set the width of the the vertical line being drawn, you would need to use one of the Draw.VerticalLine() method overloads that allow you to specify the width property.
Draw.VerticalLine(NinjaScriptBase owner, string tag, DateTime time, Brush brush, DashStyleHelper dashStyle, int width, bool drawOnPricePanel)
Draw.VerticalLine(NinjaScriptBase owner, string tag, int barsAgo, Brush brush, DashStyleHelper dashStyle, int width, bool drawOnPricePanel)
See this help guide page for more information about Draw.VerticalLine(): https://ninjatrader.com/support/help...rticalline.htm
A custom brush would need to be created to control Opacity (alpha value). Instead of using one of the pre-built brushes (Brushes.Red, Brushes.Blue, etc), you could create a SolidColorBrush employing the Color.FromArgb() method, the first value is the "alpha".
See the help guide page below for more information and examples about working with custom brushes.
Understanding Custom Brushes: https://ninjatrader.com/support/help...gcustombrushes<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CarlTrading, 03-31-2026, 09:41 PM
|
1 response
47 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
23 views
0 likes
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
33 views
1 like
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
51 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
42 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment