Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Unwanted lines on chart
Collapse
X
-
Jesse
thank you for your response. I commented out those draw.lines but I still get lines drawn on the chart. In order to remove the lines complete I have to comment out the value[0][0] lines as well.
-
Hello TheTechnician86, In the code you provided there are multiple Draw.Line statements, did you comment them all out? The code here does not have any comments so this code specifically should be drawing lines.
Leave a comment:
-
Unwanted lines on chart
Greetings!
I am getting unwanted lines on my chart. If i comment out the draw.lines lines of code i still get the lines drawn. I am having an issue with another part of the script and i think this is the reason. Any help would be appreciated!
private void CalculateStructure()
{
if (CurrentBar < 1) return; // Ensure there is at least one bar
for (int i = 0; i <= CurrentBar; i++)
{
if (CurrentBar < 10)
{
// For the first 10 bars, find the highest high and lowest low
if (i == 0)
{
HighLevel = High[i];
LowLevel = Low[i];
}
else
{
if (High[i] > HighLevel)
{
HighLevel = High[i];
LastHHBar = HighLevel;
}
if (Low[i] < LowLevel)
{
LowLevel = Low[i];
LastLLBar = LowLevel;
}
}
}
else
{
// For bars after the first 10 bars, update HighLevel and LowLevel based on closing price
if (Close[0] > HighLevel)
{
HighLevel = High[0];
LowLevel = LastLLBar;
Draw.Line(this, "High Level" + CurrentBar, false, CurrentBar, HighLevel, CurrentBar, HighLevel, HighLvlColor, DashStyleHelper.Solid, 4);
Draw.Line(this, "Low Level" + CurrentBar, false, CurrentBar, LastLLBar, CurrentBar, LastLLBar, LowLvlColor, DashStyleHelper.Solid, 4);
Print($"New HH HighLevel at bar {CurrentBar}, price: {HighLevel}");
Print($"New HH LowLevel at bar {CurrentBar}, price: {LowLevel}");
}
else if (Close[0] < LowLevel)
{
LowLevel = Low[0];
HighLevel = LastHHBar;
Draw.Line(this, "High Level" + CurrentBar, false, CurrentBar, LastHHBar, CurrentBar, LastHHBar, HighLvlColor, DashStyleHelper.Solid, 4);
Draw.Line(this, "Low Level" + CurrentBar, false, CurrentBar, LowLevel, CurrentBar, LowLevel, LowLvlColor, DashStyleHelper.Solid, 4);
Print($"New LL HighLevel at bar {CurrentBar}, price: {HighLevel}");
Print($"New LL LowLevel at bar {CurrentBar}, price: {LowLevel}");
}
else
{
Draw.Line(this, "High Level" + CurrentBar, false, CurrentBar, HighLevel, CurrentBar, HighLevel, HighLvlColor, DashStyleHelper.Solid, 4);
Draw.Line(this, "Low Level" + CurrentBar, false, CurrentBar, LowLevel, CurrentBar, LowLevel, LowLvlColor, DashStyleHelper.Solid, 4);
Print($"Old HighLevel at bar {CurrentBar}, price: {HighLevel}");
Print($"Old LowLevel at bar {CurrentBar}, price: {LowLevel}");
}
}
}
}
region Properties
[NinjaScriptProperty]
[Display(Name = "Strength", Order = 1, GroupName = "Parameters")]
public int Strength { get; set; }
[NinjaScriptProperty]
[Display(Name = "TextOffset", Order = 2, GroupName = "Parameters")]
public int TextOffset { get; set; }
[NinjaScriptProperty]
[Display(Name = "LookBack", Order = 3, GroupName = "Parameters")]
public int LookBack { get; set; }
[NinjaScriptProperty]
[Display(Name = "DTBStrength", Order = 4, GroupName = "Parameters")]
public int DTBStrength { get; set; }
[NinjaScriptProperty]
[XmlIgnore]
[Display(Name = "HHcolor", Order = 5, GroupName = "Colors")]
public Brush HHcolor { get; set; }
[Browsable(false)]
public string HHcolorSerializable
{
get { return Serialize.BrushToString(HHcolor); }
set { HHcolor = Serialize.StringToBrush(value); }
}
[NinjaScriptProperty]
[XmlIgnore]
[Display(Name = "HLcolor", Order = 6, GroupName = "Colors")]
public Brush HLcolor { get; set; }
[Browsable(false)]
public string HLcolorSerializable
{
get { return Serialize.BrushToString(HLcolor); }
set { HLcolor = Serialize.StringToBrush(value); }
}
[NinjaScriptProperty]
[XmlIgnore]
[Display(Name = "LLcolor", Order = 7, GroupName = "Colors")]
public Brush LLcolor { get; set; }
[Browsable(false)]
public string LLcolorSerializable
{
get { return Serialize.BrushToString(LLcolor); }
set { LLcolor = Serialize.StringToBrush(value); }
}
[NinjaScriptProperty]
[XmlIgnore]
[Display(Name = "LHcolor", Order = 8, GroupName = "Colors")]
public Brush LHcolor { get; set; }
[Browsable(false)]
public string LHcolorSerializable
{
get { return Serialize.BrushToString(LHcolor); }
set { LHcolor = Serialize.StringToBrush(value); }
}
[NinjaScriptProperty]
[XmlIgnore]
[Display(Name = "DBcolor", Order = 9, GroupName = "Colors")]
public Brush DBcolor { get; set; }
[Browsable(false)]
public string DBcolorSerializable
{
get { return Serialize.BrushToString(DBcolor); }
set { DBcolor = Serialize.StringToBrush(value); }
}
[NinjaScriptProperty]
[XmlIgnore]
[Display(Name = "DTcolor", Order = 10, GroupName = "Colors")]
public Brush DTcolor { get; set; }
[Browsable(false)]
public string DTcolorSerializable
{
get { return Serialize.BrushToString(DTcolor); }
set { DTcolor = Serialize.StringToBrush(value); }
}
[NinjaScriptProperty]
[XmlIgnore]
[Display(Name = "HighLvlColor", Order = 11, GroupName = "Colors")]
public Brush HighLvlColor { get; set; }
[Browsable(false)]
public string HighLvlColorSerializable
{
get { return Serialize.BrushToString(HighLvlColor); }
set { HighLvlColor = Serialize.StringToBrush(value); }
}
[NinjaScriptProperty]
[XmlIgnore]
[Display(Name = "LowLvlColor", Order = 12, GroupName = "Colors")]
public Brush LowLvlColor { get; set; }
[Browsable(false)]
public string LowLvlColorSerializable
{
get { return Serialize.BrushToString(LowLvlColor); }
set { LowLvlColor = Serialize.StringToBrush(value); }
}
[NinjaScriptProperty]
[Display(Name = "TextFont", Order = 13, GroupName = "Fonts")]
public SimpleFont TextFont { get; set; }
#endregion
}
}Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by abelsheila, 05-14-2025, 07:38 PM
|
2 responses
32 views
0 likes
|
Last Post
![]()
by hglover945
Yesterday, 03:48 PM
|
||
Started by nailz420, 05-14-2025, 09:14 AM
|
1 response
66 views
0 likes
|
Last Post
|
||
Started by NinjaTrader_Brett, 05-12-2025, 03:19 PM
|
0 responses
337 views
1 like
|
Last Post
|
||
Started by domjabs, 05-12-2025, 01:55 PM
|
2 responses
64 views
0 likes
|
Last Post
![]()
by domjabs
05-12-2025, 02:50 PM
|
||
Started by Morning Cup Of Trades, 05-12-2025, 11:50 AM
|
1 response
83 views
0 likes
|
Last Post
|
Leave a comment: