namespace NinjaTrader.NinjaScript.Indicators.MyIndicators
{
public class myMACDdiff : Indicator
{
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Enter the description for your new custom Indicator here.";
Name = "myMACDdiff";
Calculate = Calculate.OnPriceChange;
IsOverlay = false;
DisplayInDataBox = true;
DrawOnPricePanel = true;
DrawHorizontalGridLines = true;
DrawVerticalGridLines = true;
PaintPriceMarkers = true;
ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
//Disable this property if your indicator requires custom values that cumulate with each new market data event.
//See Help Guide for additional information.
IsSuspendedWhileInactive = true;
AddPlot(Brushes.Orange, "MACDdiff");
}
else if (State == State.Configure)
{
}
}
protected override void OnBarUpdate()
{
double currentdiff = MACD(6, 20, 9).Diff[0];
double olddiff = MACD(6, 20, 9).Diff[1];
Value [0] = currentdiff - olddiff;
}
}
}
Comment