Thanks,
//This namespace holds Indicators in this folder and is required. Do not change it.
namespace NinjaTrader.NinjaScript.Indicators
{
public class EMAColorBar : Indicator
{
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Enter the description for your new custom Indicator here.";
Name = "EMAColorBar";
Calculate = Calculate.OnBarClose;
IsOverlay = false;
DisplayInDataBox = true;
DrawOnPricePanel = true;
DrawHorizontalGridLines = true;
DrawVerticalGridLines = true;
PaintPriceMarkers = true;
ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
IsSuspendedWhileInactive = true;
int FastPeriod = 5;
int SlowPeriod = 7;
}
}
protected override void OnBarUpdate()
{
if(EMA(FastPeriod)[0] > EMA(SlowPeriod)[0])
BarBrush = Brushes.White;
if(EMA(FastPeriod)[0] < EMA(SlowPeriod)[0])
BarBrush = Brushes.Red;
}
}
}

Comment