Any examples
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
AddChartIndicator(RegressionChannel(200,3));
Collapse
X
-
Hello BartMan,
Thanks for your post.
You could use the Strategy Builder to create a condition using the RegressionChannel indicator with the 'Plot on chart' setting checked and then click the 'View code' button to see the generated syntax for how this is done.
The code might look something like this:
//class level variable
private Indicators.RegressionChannel RegressionChannel1;
//OnStateChange
else if (State == State.DataLoaded)
{
RegressionChannel1 = RegressionChannel(Close, 200, 3);
RegressionChannel1.Plots[0].Brush = Brushes.DarkGray;
RegressionChannel1.Plots[1].Brush = Brushes.DodgerBlue;
RegressionChannel1.Plots[2].Brush = Brushes.DodgerBlue;
AddChartIndicator(RegressionChannel1);
}
See the help guide documentation below for more information.
RegressionChannel(): https://ninjatrader.com/support/help...ionchannel.htm
AddChartIndicator(): https://ninjatrader.com/support/help...tindicator.htm
Adding Indicators to Strategies: https://ninjatrader.com/support/help..._strategie.htm
Creating Indicator to Value Conditions in Strategy Builder: https://ninjatrader.com/support/help...arisons<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>
-
Thanks, but that still does not work I get ==> RegressionChannelB1.cs,The name 'AddChartIndicator' does not exist in the current context,CS0103,60,5,
I believe it is a name conflict as @RegressionChannel.cs exist as a drawing tool and as an indicator.
Code attached
Attached Files
Comment
-
Hello BartMan,
Thanks for your notes.
I see that the script you shared is an indicator.
The AddChartIndicator() method can only be used in a custom NinjaScript strategy, not a custom NinjaScript indicator.
You would have to add three plots to your script for each plot the RegressionChannel indicator has and then assign the RegressionChannel indicator plot values (Middle, Upper, Lower) to each plot you added to the script.
See the help guide documentation below for more information and sample code.
AddPlot(): https://ninjatrader.com/support/help...t8/addplot.htm
RegressionChannel(): https://ninjatrader.com/support/help...on_channel.htm<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 CaptainJack, 05-29-2026, 05:09 AM
|
0 responses
222 views
0 likes
|
Last Post
by CaptainJack
05-29-2026, 05:09 AM
|
||
|
Started by CaptainJack, 05-29-2026, 12:02 AM
|
0 responses
140 views
0 likes
|
Last Post
by CaptainJack
05-29-2026, 12:02 AM
|
||
|
Started by charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
154 views
1 like
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
237 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
195 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|

Comment