N7 DrawLine not working - futures io
futures io futures trading



N7 DrawLine not working


Discussion in NinjaTrader

Updated
    1. trending_up 1,259 views
    2. thumb_up 9 thanks given
    3. group 1 followers
    1. forum 4 posts
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

N7 DrawLine not working

(login for full post details)
  #1 (permalink)
Roseville CA
 
Experience: Advanced
Platform: N7
Broker: Amp Futures/CQG
Trading: ES
 
Posts: 124 since Jun 2009
Thanks: 32 given, 20 received

Hello,

Any ideas on why this is drawing on chart?

 
Code
protected override void OnBarUpdate()
		
        {

			DrawLine("MyLine", 10, Close[10], 0, Close[0], Color.Blue);
 
 

        }
thank you

Started this thread Reply With Quote

Can you help answer these questions
from other members on futures io?
Work with historical tcks data on MUltichart NET PowerLa …
MultiCharts
COTbase for quant trading?
Elite Algorithmic NinjaTrader Trading
Neurological explanations for trading Success
Psychology and Money Management
NT8 indicator to simulate a Funding Evaluation where to …
NinjaTrader
What blockvolume is visible? - order processing
NinjaTrader
 
 
(login for full post details)
  #3 (permalink)
Market Wizard
Columbus, OH
 
Experience: None
Platform: NT 8, TOS
Trading: ES
 
Silvester17's Avatar
 
Posts: 3,578 since Aug 2009
Thanks: 5,065 given, 11,359 received



ceramictilepro View Post
Hello,

Any ideas on why this is drawing on chart?

 
Code
protected override void OnBarUpdate()
		
        {

			DrawLine("MyLine", 10, Close[10], 0, Close[0], Color.Blue);
 
 

        }
thank you

I think if you add: "if (CurrentBar < 10) return;"

it should work

edit:

made a simple example where you can change the lookback period in the indicator window:

 
Code
       #region Variables
        
        private int 		length 			= 10;
		
	private Color		lineColor           	= Color.Blue;
	private DashStyle	dash0Style		= DashStyle.Solid;
	private int		plot0Width		= 1;
        
        #endregion

        /// <summary>
        /// This method is used to configure the indicator and is called once before any bar data is loaded.
        /// </summary>
        protected override void Initialize()
	{
            Overlay		= true;
        }

        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
	    if (CurrentBar < length)  
		return;
			
            DrawLine("MyLine", true, length, Close[length], 0, Close[0], lineColor, dash0Style, plot0Width);
        }

        #region Properties
        
        [Description("lookback period")]
        [Category("Line Settings")]
	[Gui.Design.DisplayNameAttribute("Length")]
        public int Length
        {
            get { return length; }
            set { length = Math.Max(1, value); }
        }
		
	/// <summary>
	/// </summary>
	[XmlIgnore()]
	[Description("line color")]
	[Category("Line Settings")]
	[Gui.Design.DisplayName("Line Color")]
	public Color LineColor
	{
		get { return lineColor; }
		set { lineColor = value; }
	}
		
	[Browsable(false)]
	public string LineColorSerialize
	{
		get { return NinjaTrader.Gui.Design.SerializableColor.ToString(lineColor); }
		set { lineColor = NinjaTrader.Gui.Design.SerializableColor.FromString(value); }
	}
		
	/// <summary>
	/// </summary>
	[Description("DashStyle for Line")]
	[Category("Line Settings")]
	[Gui.Design.DisplayNameAttribute("Line Dash Style")]
	public DashStyle Dash0Style
	{
		get { return dash0Style; }
		set { dash0Style = value; }
	}
		
	/// <summary>
	/// </summary>
	[Description("Width for Line")]
	[Category("Line Settings")]
	[Gui.Design.DisplayNameAttribute("Line Width")]
	public int Plot0Width
	{
		get { return plot0Width; }
		set { plot0Width = Math.Max(1, value); }
	}
		
        #endregion

Reply With Quote
The following 5 users say Thank You to Silvester17 for this post:
 
(login for full post details)
  #4 (permalink)
Roseville CA
 
Experience: Advanced
Platform: N7
Broker: Amp Futures/CQG
Trading: ES
 
Posts: 124 since Jun 2009
Thanks: 32 given, 20 received

Very Nice! I'm using this one for sure!

Can you tell me if this can be attached to global drawing objects?

Thank You!


Silvester17 View Post
I think if you add: "if (CurrentBar < 10) return;"

it should work

edit:

made a simple example where you can change the lookback period in the indicator window:

 
Code
       #region Variables
        
        private int 		length 			= 10;
		
	private Color		lineColor           	= Color.Blue;
	private DashStyle	dash0Style		= DashStyle.Solid;
	private int		plot0Width		= 1;
        
        #endregion

        /// <summary>
        /// This method is used to configure the indicator and is called once before any bar data is loaded.
        /// </summary>
        protected override void Initialize()
	{
            Overlay		= true;
        }

        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
	    if (CurrentBar < length)  
		return;
			
            DrawLine("MyLine", true, length, Close[length], 0, Close[0], lineColor, dash0Style, plot0Width);
        }

        #region Properties
        
        [Description("lookback period")]
        [Category("Line Settings")]
	[Gui.Design.DisplayNameAttribute("Length")]
        public int Length
        {
            get { return length; }
            set { length = Math.Max(1, value); }
        }
		
	/// <summary>
	/// </summary>
	[XmlIgnore()]
	[Description("line color")]
	[Category("Line Settings")]
	[Gui.Design.DisplayName("Line Color")]
	public Color LineColor
	{
		get { return lineColor; }
		set { lineColor = value; }
	}
		
	[Browsable(false)]
	public string LineColorSerialize
	{
		get { return NinjaTrader.Gui.Design.SerializableColor.ToString(lineColor); }
		set { lineColor = NinjaTrader.Gui.Design.SerializableColor.FromString(value); }
	}
		
	/// <summary>
	/// </summary>
	[Description("DashStyle for Line")]
	[Category("Line Settings")]
	[Gui.Design.DisplayNameAttribute("Line Dash Style")]
	public DashStyle Dash0Style
	{
		get { return dash0Style; }
		set { dash0Style = value; }
	}
		
	/// <summary>
	/// </summary>
	[Description("Width for Line")]
	[Category("Line Settings")]
	[Gui.Design.DisplayNameAttribute("Line Width")]
	public int Plot0Width
	{
		get { return plot0Width; }
		set { plot0Width = Math.Max(1, value); }
	}
		
        #endregion


Started this thread Reply With Quote
The following user says Thank You to ceramictilepro for this post:
 
(login for full post details)
  #5 (permalink)
Market Wizard
Columbus, OH
 
Experience: None
Platform: NT 8, TOS
Trading: ES
 
Silvester17's Avatar
 
Posts: 3,578 since Aug 2009
Thanks: 5,065 given, 11,359 received


ceramictilepro View Post
Very Nice! I'm using this one for sure!

Can you tell me if this can be attached to global drawing objects?

Thank You!

as far as I know, global drawing objects can't be accessed via ninja script.

I might be wrong, but I don't think so.

Reply With Quote
The following 3 users say Thank You to Silvester17 for this post:


futures io Trading Community Platforms and Indicators NinjaTrader > N7 DrawLine not working


Last Updated on February 2, 2014


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

Journal Challenge w/Jigsaw

April
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts