NC MA Angle Description
NC MA Angle is an MA angle indicator for NinjaTrader 8, and it comes with the full C# source code. The idea is simple but confusing: there are two ways to measure the angle of a moving average, and they rarely agree. One comes from the values, the other from the line you see, which changes when you rescale the chart. So I built one indicator that calculates both. The honest limitation: the on-screen angle only exists on a live chart.
How it works. It plots a moving average, by default an HMA with MA Period 100; MA Type also offers EMA, SMA, VWMA, TMA, TEMA and WMA. It compares the MA now with its value Lookback bars ago (5 by default). Degrees measures that change per bar in ATR units (the ATR uses the same 100 bars) and turns it into an angle, so 20 degrees means the MA moves about 0.36 ATR per bar, on any instrument and at any zoom. Degrees Visual takes the screen positions of the same two points and measures the angle of the line between them. Squeeze the price scale and it changes, just as your eye expects.
What you see. The MA is drawn on the price chart in gray. It turns green when Degrees reaches the API Threshold (20 by default) and red when it falls below -20. A blue line, which Display Line can hide, connects the two measured points. A box in the top right corner shows both readings, and Box Position and Font Size are adjustable. Set MA Color Source to VisualAPI and the color follows the on-screen angle instead. It calculates on each tick.
How to use it. Use the color as a trend filter: longs while the MA is green, shorts while it is red, patience while it is gray. Raise API Threshold to keep only steeper trends, or lower Lookback to react sooner. For strategies, API Absolute is a hidden plot that is +1 at or above the threshold, -1 below the negative threshold and 0 in between. API Visual works the same way but stays 0 on historical bars and in strategies, so keep it for live charts.
Make it yours. Like all my frameworks, it comes with a video that explains how both angles are calculated. Use it as is, learn from the code, or change it yourself or with AI like Claude. You could add an alert when the MA changes color, give the ATR its own period, or make the angle hold for a few bars first. Each angle has its own short method, so the math is easy to follow. Have some good trades!