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 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