Thx
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Remove Indicator
Collapse
X
-
Hello,
Thank you for the question.
I am not quite sure I understand the question, are you asking how to reverse the Add() syntax to Remove an indicator the strategy added to the chart?
Can you confirm if you are using Add syntax, if not could you provide a sample of the syntax you are currently using to add the indicator?
I look forward to being of further assistance.JesseNinjaTrader Customer Service
-
Hello,
Thank you for the reply.
While you cant directly remove the indicator after adding it, you could set its plot to transparent, use the Strategy Plot example or edit the indicator its self.
One example would be the following or to create a variable of the indicator which can be used in logic:
Code:private SMA mySma; protected override void Initialize() { mySma = SMA(12); Add(mySma); } protected override void OnBarUpdate() { if(Close[0] > Open[0]) { mySma.PlotColors[0][0] = Color.Transparent; //or for the whole plot mySma.Plots[0].Pen = new Pen(Color.Transparent, 0); } else { mySma.PlotColors[0][0] = Color.Red; //or for the whole plot mySma.Plots[0].Pen = new Pen(Color.Red, 1); } }
When running a strategy on a chart you may find the need to plot values onto a chart. If these values are internal strategy calculations that are difficult to migrate to an indicator, you can use the following technique to achieve a plot. NinjaTrader 8 With NinjaTrader 8 we introduced strategy plots which provide the ability
Another approach is to make a version of the indicator that includes the logic already to hide its plots when a condition becomes true. Mainly to just make its plots transparent.
I look forward to being of further assistance.JesseNinjaTrader Customer Service
Comment
-
Thanks. Thats a viable alternative. In fact I intend showing an Ichimoku indicator each time a respective condition becomes valid for verification and hide it if not. So that solution should work for me.
Btw. would removing indicators they way I intended previously work in NT8?
Thanks.
Comment
-
Hello,
No this would still be the same type of options for NT8. The script you are applying to the chart tells the platform to then Add the indicator, this all happens when the script is first starting.
The opposite action or removing actually does happen but only when the script is disabled. I don't believe actually removing the item would be the correct approach, in the case an item needs to be added after that, the script would need reloaded to Add that indicator. Instead the suggested approach would be to add the items you may need and toggle them depending on conditions.
I look forward to being of further assistance.JesseNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by helpwanted, Today, 03:06 AM
|
1 response
11 views
0 likes
|
Last Post Today, 03:35 AM | ||
Started by Brevo, Today, 01:45 AM
|
0 responses
9 views
0 likes
|
Last Post
by Brevo
Today, 01:45 AM
|
||
Started by aussugardefender, Today, 01:07 AM
|
0 responses
5 views
0 likes
|
Last Post Today, 01:07 AM | ||
Started by pvincent, 06-23-2022, 12:53 PM
|
14 responses
242 views
0 likes
|
Last Post
by Nyman
Today, 12:47 AM
|
||
Started by TraderG23, 12-08-2023, 07:56 AM
|
9 responses
387 views
1 like
|
Last Post
by Gavini
Today, 12:29 AM
|
Comment