Trading Articles |
Article Categories |
Article Tools |
N7 DrawLine not working
|
|
Updated
|
-
trending_up
1,259 views
-
thumb_up
9 thanks given
-
group
1 followers
-
forum
4 posts
-
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)
|
(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?
thank you
|
|
|
Can you help answer these questions from other members on futures io? |
|
|
|
Best Threads (Most Thanked) in the last 7 days on futures io |
|
|
(login for full post details)
|
#3 (permalink)
|
Market Wizard
Columbus, OH
Experience: None
Platform: NT 8, TOS
Trading: ES
Posts: 3,578 since Aug 2009
Thanks: 5,065 given,
11,359
received
|
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:
#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
|
|
|
|
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
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:
#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
|
|
|
|
|
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
Posts: 3,578 since Aug 2009
Thanks: 5,065 given,
11,359
received
|
ceramictilepro
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.
|
|
|
The following 3 users say Thank You to Silvester17 for this post:
|
|
Last Updated on February 2, 2014
|
|
Ongoing
|
|
March
|
|
Elite only
|
|
April
|
|
|
|