public class LINEPROJECTOR : Indicator { #region Variables private int length = 25; // Default setting for Length #endregion protected override void Initialize() { Overlay = true; } protected override void OnBarUpdate() { DrawLine("tag1", false, 10, 1000, 0, 1001, Color.LimeGreen, DashStyle.Dot, 2); } #region Properties [Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove public DataSeries PlotH { get { return Values[0]; } } [Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove public DataSeries PlotL { get { return Values[1]; } } [Description("Scope of detection")] [GridCategory("Parameters")] public int Length { get { return length; } set { length = Math.Max(8, value); } } #endregion }
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Drawing a simple line in an indicator
Collapse
X
-
Drawing a simple line in an indicator
Is there some special sauce I need to add to the recipe to draw a simple line? I'm experimenting with drawing objects for the very first time and the example taken from the NT7 language guide doesn't do a thing :-( here is my code:
Code:Tags: None
-
Hello ShruggedAtlas,
Thanks for your post and I am happy to assist you.
On which instrument you are putting up the indicator.
The line is drawn on price level of 1000 to 1001. So if you are watching for example ES then you wont be able to see it.
Also you need to check for the minimum bar requirement. Please refer to this post for further reference http://ninjatrader.com/support/forum...ead.php?t=3170
A workable code will be
Code:protected override void OnBarUpdate() { if (CurrentBar < 10) return; DrawLine("tag1", false, 10, Close[0], 0, Close[0], Color.LimeGreen, DashStyle.Dot, 2); }
JoydeepNinjaTrader Customer Service
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Net Change
by Segwin
Started by Segwin, 05-07-2018, 02:15 PM
|
10 responses
1,767 views
0 likes
|
Last Post
by Leafcutter
Today, 03:01 AM
|
||
Change colour of Stop market and limit orders to red and green via indicator script
by Rapine Heihei
Started by Rapine Heihei, 04-23-2024, 07:51 PM
|
2 responses
30 views
0 likes
|
Last Post
by Max238
Today, 02:25 AM
|
||
Started by Shansen, 08-30-2019, 10:18 PM
|
24 responses
943 views
0 likes
|
Last Post
by spwizard
Today, 01:29 AM
|
||
Started by Max238, Today, 01:28 AM
|
0 responses
9 views
0 likes
|
Last Post
by Max238
Today, 01:28 AM
|
||
Started by rocketman7, Today, 01:00 AM
|
0 responses
7 views
0 likes
|
Last Post
by rocketman7
Today, 01:00 AM
|
Comment