AddChartIndicator(ADX(7)); AddChartIndicator(ADX(14)); AddChartIndicator(ADX(28));
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
ADD horizontal lines to indicators created inside strategy
Collapse
X
-
ADD horizontal lines to indicators created inside strategy
i have 3 adx indicators with different parameters. how do i have a different horizontal line for each?
currently all 3 have 25 mark as horizontal lines. i want 15 mark for ADX(28), 20 mark for ADX(14) and 30 mark for ADX(7)Code:
Tags: None
-
Hello junkone,
Thanks for your post.
The ADX indicator is programmed to plot a horizontal line at values of 25 and 75. This could be seen by viewing the indicator's code in a New> NinjaScript Editor window.
If you would like this line to be different, you would need to create a copy of the ADX indicator and modify it so that AddLine() plots a line at a different values.
AddLine(): https://ninjatrader.com/support/help...t8/addline.htm
To create a copy of your script to modify, open a New > NinjaScript Editor, select the script you want to make a copy of, right-click in the Editor, select 'Save as', name the script, and click OK.
You would then use the modified indicator in your strategy instead of the default ADX indicator.
Let us know if we may assist further.<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>
-
ok. is there a way to fix it as when i put the properties of 14, 28, it does not change the values for the horizontal lines
Code:if (State == State.SetDefaults) { Description = "CustomADX"; Name = "CustomADX"; IsSuspendedWhileInactive = true; Period = 14; HorizontalBar =30; switch(Period) { case 14: HorizontalBar=20; // these values dont change when i change a different value in the break; case 28: HorizontalBar=15; break; case 7: HorizontalBar=30; break; } AddPlot(Brushes.DarkCyan, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNa meADX); AddLine(Brushes.Yellow, HorizontalBar, "Minimum"); AddLine(Brushes.Green, HorizontalBar + 10, "MidTrend"); AddLine(Brushes.Red, HorizontalBar + 20, "HiTrend"); //AddLine(Brushes.Goldenrod, 75, NinjaTrader.Custom.Resource.NinjaScriptIndicatorUp per); }
Comment
-
Hello junkone,
Thanks for your note.
Please see the attached example script which demonstrates creating a copy of the ADX indicator and changing AddLine() so that the lines are placed at a value of 14 and 28.
Ultimately, to understand why the script is behaving as it is, such as plotting or not plotting objects where expected, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.
In the script add prints (outside of any conditions) that print the values of every variable used in every condition along with the time of that bar. Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).
Below is a link to a forum post that demonstrates how to use prints to understand behavior.
https://ninjatrader.com/support/foru...121#post791121
Let us know if we may assist further.Attached Files<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>
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Today, 05:17 AM
|
0 responses
43 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
124 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
65 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
42 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
46 views
0 likes
|
Last Post
|

Comment