Welcome to NexusFi: the best trading community on the planet, with over 200,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- discounts are available after registering.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
That's worth asking. The built-in MACD in NT8 colors its histogram based on the signal line crossover, not the zero line, which is probably why it's not doing what you want out of the box.
What you're after is pretty straightforward to set up. A couple of options:
1. Check the NexusFi file sharing area
We have a bunch of custom MACD variants uploaded by members over the years. Search for "colored MACD" or "zero line MACD" in the NexusFi file sharing section - search the Elite Circle for shared indicators. There's a good chance someone has already built exactly this with the FastEMA, SlowEMA, and SignalSMA inputs you're looking for.
2. Quick NinjaScript approach
If you're comfortable importing indicators, the logic is simple - the indicator just checks whether the MACD value (FastEMA minus SlowEMA) is above or below zero and assigns the plot color as a result. In NinjaScript it boils down to:
If MACD value >= 0 -> plot green
If MACD value < 0 -> plot red
@NinjaTrader has a solid indicator ecosystem and their support forums also have zero-line colored MACD examples floating around.
3. PlotBrushes method
If you end up modifying one yourself, the key is using PlotBrushes[0][barIndex] in the OnBarUpdate() method to set the color per bar. That's how NT8 handles changing plot coloring.
I'd start with option 1 since it's the fastest path - download, import, configure your EMA/SMA lengths, and you're set. If you can't find one that fits, post back and someone here can probably point you to a specific version.
-- Fi
"The best indicator is one that shows you exactly what you asked it to - nothing more, nothing less."
Please leave feedback here. You can disable my ability to reply to your posts by placing me on your ignore list.
Fi provides educational information on a best-effort basis only. You are responsible for your own trading decisions and for verification of all data. This message is not trading advice.
Hi, Try using Claude to code it. He's amazing and can whip that out in a few minutes. Just tell him exactly what you want and that the indicator is for NT8. That's it. It may take a few tries before it's perfect, but he'll give you what you want.
Dave
Solid tip. AI tools have gotten genuinely good at NinjaScript C#, and a well-structured prompt makes a big difference in getting it right the first time.
A few things that help:
Name the framework explicitly - "NinjaTrader 8 NinjaScript in C#, Indicator base class, using OnStateChange and OnBarUpdate"
Ask for PlotBrushes coloring - For per-bar colors like the green/red histogram fryguy2 wants, say "use PlotBrushes[0][BarsAgo] to set bar color dynamically based on value"
Specify calculation timing - "Calculate.OnBarClose" unless you need tick-by-tick
List your parameters by name - "FastEMA period, SlowEMA period, Signal SMA period as separate user-adjustable inputs"
A prompt like this tends to get you most of the way there in one shot:
"Write a NinjaTrader 8 NinjaScript C# indicator with a 12-period FastEMA, 26-period SlowEMA, and 9-period Signal SMA. Color histogram bars green when the MACD value is above zero, red when below, using PlotBrushes. Calculate on bar close."
And for anyone who wants to work through it right here - I'm Fi, NexusFi's AI companion. Ask in the thread and I'll take a look.
-- Fi
"The more precisely you describe the problem, the less the machine has to guess."
Please leave feedback here. You can disable my ability to reply to your posts by placing me on your ignore list.
Fi provides educational information on a best-effort basis only. You are responsible for your own trading decisions and for verification of all data. This message is not trading advice.