Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Plotbrushes and the superdom
Collapse
X
-
Plotbrushes and the superdom
I have an indicator plot that changes color using plotbrushes and if statements. Should this be working in the superdom?Tags: None
-
Hello sampras010,
That should work, I just tried the following in the latest release and see the plots line color is blue which is being set from PlotBrushes. Are you certain the correct index is being used with PlotBrushes and also that your conditions are becoming true when used in the dom?
Code:protected override void OnStateChange() { if (State == State.SetDefaults) { Name = "ATest"; IsOverlay = true; AddPlot(Brushes.Red, "TEst"); } } protected override void OnBarUpdate() { PlotBrushes[0][0] = Brushes.Blue; Value[0] = Close[0]; }
-
with this the color doesnt change from red originating from the addplot
Code:protected override void OnStateChange() { if (State == State.SetDefaults) { Name = "ATest"; IsOverlay = true; AddPlot(Brushes.Red, "TEst"); } } protected override void OnBarUpdate() { if(CurrentBar<14) { return; } Value[0] = Close[0]; if(SMA(3)[14]<SMA(3)[0]) { PlotBrushes[0][0] = Brushes.Blue; } if(SMA(3)[14]>SMA(3)[0]) { PlotBrushes[0][0] = Brushes.Red; } }
Comment
-
Hello sampras010,
You will need to add prints into those conditions to make sure those conditions are becoming true. Also you used red for the second condition, if that is true you won't know it. I would suggest making the default a different color like yellow so you have 3 seperate colors.
When using the dom and indicators they by default only load 2 days of data, the indicators may not have any bars processed for those conditions to be true immediately. As a test first check that you can see the blue plot color if you use the sample I provided, that will prove it works. Then you can add prints into your code to make sure the conditions were true:
Code:if(SMA(3)[14]<SMA(3)[0]) { PlotBrushes[0][0] = Brushes.Blue; Print("Plot conditions is true for blue"); }
Comment
-
Thanks jesse, the first example you provided did work, however im trying to get the plot to alternate between red and blue as the other condition becomes true, ive tested this on 1 tick data, 2000 bars, on the NQ contract, which is still moving a lot at this time, so it takes no time to test this, like i said, with the example you provided the color changed to blue, however expecting further updates with if statements, the color did not change once
Comment
-
Hello sampras010,
The next step would be to use prints to make sure your conditions are becoming true. You can add prints inside the condition, you will only see prints if the condition was true. If no prints are observed that means the indicator is doing what its programmed and the default plot color was used because the conditions did not become true.
Comment
-
Ok. So this code works on a chart, the color of the plot alternates between blue and red on the closing price, but not in the superdom, the print shows value[0] is the close price as expected, as you can see i changed the code to simply if the bar was up or down, Im testing this on 1 tick data. in the superdom the plot is on the close, but it does not change colors like on the chart
Code:if(CurrentBar<14) { return; } Value[0] = Close[0]; if(Close[0]<Close[1]) { PlotBrushes[0][0] = Brushes.Blue; } else if (Close[0]>Close[1]) { PlotBrushes[0][0] = Brushes.Red; } Print(Value[0]);
Comment
-
Hello sampras010,
You used the Close price for the current bar and previous bar so you need to print both those values. You can additionally put the print inside your conditions, if no print is observed then the condition as not true, to know why it was not true the print can go outside the condition and print the values being used in the condition. You will need to do that test in the superdom and not the chart.
For the test also try using a bigger bar series like 1 minute so the value is not changing on every tick.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
599 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
344 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
103 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
558 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
557 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment