Can you provide a link or sample to help accomplish that?
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
Change Swing Plot Colors Based On Condition
Collapse
X
-
Change Swing Plot Colors Based On Condition
I want to modify the Swing indicator so that the plot colors are set based on a condition.
Can you provide a link or sample to help accomplish that?Tags: None
-
Hello ScorpioTravis,
Thank you for the post.
The swing can be duplicated and then edited by using the NinjaScript editor. To duplicate the file you would first need to open it and then right click in the file -> Save as.
The swing is a fairly complicated indicator which can be pretty difficult to edit. We would likely need more specific details on what kind of conditions you are looking to make in order to provide more relevant help here.
To color plots you can use PlotBrushes https://ninjatrader.com/support/help...ub=PlotBrushes
I look forward to being of further assistance.JesseNinjaTrader Customer Service
-
Jesse, I made a copy and modified it by adding the following lines at the end of the protected override void OnBarUpdate() section (CONDITION# = other indicator values):
Code:{ if (CONDITION1 && CONDITION2) { PlotColors[0][0] = Color.Transparent; PlotColors[1][0] = Color.Yellow; } else if (CONDITION3 && CONDITION4) { PlotColors[0][0] = Color.Cyan; PlotColors[1][0] = Color.Transparent; } else { PlotColors[0][0] = Color.Transparent; PlotColors[1][0] = Color.Transparent; } }
I can't determine if that's caused by something in the original SWING code or if it's because of an error I made in the additional code logic for changing the colors.
Update: I sent the indicator data used for the CONDITION#s to an output window, but it doesn't match what's on the chart and data box. I'm still investigating.
Last edited by ScorpioTravis; 10-05-2021, 06:00 PM.
Comment
-
Hello ScorpioTravis,
When you say that you sent the indicator data are you referring to the plot data from the indicator or are you using SwingLowBar/HighBar?
For your conditions you would need to use a print to see what the values are on each bar where the conditions are both false.
I look forward to being of further assistance.JesseNinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_Jesse View PostHello ScorpioTravis,
When you say that you sent the indicator data are you referring to the plot data from the indicator or are you using SwingLowBar/HighBar?
For your conditions you would need to use a print to see what the values are on each bar where the conditions are both false.
I look forward to being of further assistance.
Comment
-
Hello ScorpioTravis,
Could you provide more details about the condition? Are you using indicator values and comparing against manually added indicators? That could be a situation where the chart may differ from the script.
I look forward to being of further assistance.JesseNinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_Jesse View PostHello ScorpioTravis,
Could you provide more details about the condition? Are you using indicator values and comparing against manually added indicators? That could be a situation where the chart may differ from the script.
I look forward to being of further assistance.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by algospoke, 04-17-2024, 06:40 PM
|
6 responses
48 views
0 likes
|
Last Post
by algospoke
Today, 06:18 PM
|
||
Started by arvidvanstaey, Today, 02:19 PM
|
4 responses
11 views
0 likes
|
Last Post Today, 04:08 PM | ||
Started by samish18, 04-17-2024, 08:57 AM
|
16 responses
61 views
0 likes
|
Last Post
by samish18
Today, 03:30 PM
|
||
Started by jordanq2, Today, 03:10 PM
|
2 responses
9 views
0 likes
|
Last Post
by jordanq2
Today, 03:23 PM
|
||
Started by traderqz, Today, 12:06 AM
|
10 responses
21 views
0 likes
|
Last Post
by traderqz
Today, 02:49 PM
|
Comment