Are there any similar sample indicator scripts?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to modify the MACD indicator to paint the Bar color
Collapse
X
-
Hello bibofeng,
Thanks for your post.
To create a copy of the MACD indicator to modify, open a New > NinjaScript Editor window, open the Indicators folder, and double-click on the MACD file. Right-click within the code of the MACD indicator, select 'Save as', name the copy of the file and click OK.
After making a copy of the indicator, you could modify that copy to suit your overall goals.
PlotBrushes[int PlotIndex][int barsAgo] would be used in a NinjaScript indicator to change the plot color to a specified color when a condition is true.
We do not have a reference sample in the help guide that demonstrates this specifically. That said, the code to add to the copy of the MACD script might look something like this:
Code:if (Diff[0] > 0) PlotBrushes[2][0] = Brushes.Green; else PlotBrushes[2][0] = Brushes.Red;
Note that the code above would be placed outside of the if-else condition used to assign plots a value.
See this help guide page for more information about PlotBrushes and sample code: https://ninjatrader.com/support/help...lotbrushes.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>
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by SalmaTrader, 07-07-2026, 10:26 PM
|
0 responses
36 views
0 likes
|
Last Post
by SalmaTrader
07-07-2026, 10:26 PM
|
||
|
Started by CarlTrading, 07-05-2026, 01:16 PM
|
0 responses
20 views
0 likes
|
Last Post
by CarlTrading
07-05-2026, 01:16 PM
|
||
|
Started by CaptainJack, 06-17-2026, 10:32 AM
|
0 responses
14 views
0 likes
|
Last Post
by CaptainJack
06-17-2026, 10:32 AM
|
||
|
Started by kinfxhk, 06-17-2026, 04:15 AM
|
0 responses
20 views
0 likes
|
Last Post
by kinfxhk
06-17-2026, 04:15 AM
|
||
|
Started by kinfxhk, 06-17-2026, 04:06 AM
|
0 responses
22 views
0 likes
|
Last Post
by kinfxhk
06-17-2026, 04:06 AM
|

Comment