#region Using declarations using NinjaTrader.Gui; using NinjaTrader.Gui.Chart; using System.Windows.Media; #endregion namespace NinjaTrader.NinjaScript.Indicators { public class InternalBarStrength : Indicator { protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"Internal Bar Strength (IBS) Indicator"; Name = "Internal Bar Strength"; Calculate = Calculate.OnPriceChange; IsOverlay = false; DisplayInDataBox = true; DrawOnPricePanel = true; PaintPriceMarkers = true; ScaleJustification = ScaleJustification.Right; IsSuspendedWhileInactive = true; AddPlot(new Stroke(Brushes.Yellow, DashStyleHelper.Solid, 3), PlotStyle.Line, "Internal Bar Strength"); } } protected override void OnBarUpdate() { if (High[0] == Low[0]) Value[0] = 0; // Prevent division by zero. else Value[0] = (Close[0] - Low[0]) / (High[0] - Low[0]); } public override string DisplayName { get { return Name; } } } } #region NinjaScript generated code. Neither change nor remove. namespace NinjaTrader.NinjaScript.Indicators { public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase { private InternalBarStrength[] cacheInternalBarStrength; public InternalBarStrength InternalBarStrength() { return InternalBarStrength(Input); } public InternalBarStrength InternalBarStrength(ISeries input) { if (cacheInternalBarStrength != null) for (int idx = 0; idx < cacheInternalBarStrength.Length; idx++) if (cacheInternalBarStrength[idx] != null && cacheInternalBarStrength[idx].EqualsInput(input)) return cacheInternalBarStrength[idx]; return CacheIndicator(new InternalBarStrength(), input, ref cacheInternalBarStrength); } } } namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns { public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase { public Indicators.InternalBarStrength InternalBarStrength() { return indicator.InternalBarStrength(Input); } public Indicators.InternalBarStrength InternalBarStrength(ISeries input ) { return indicator.InternalBarStrength(input); } } } namespace NinjaTrader.NinjaScript.Strategies { public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase { public Indicators.InternalBarStrength InternalBarStrength() { return indicator.InternalBarStrength(Input); } public Indicators.InternalBarStrength InternalBarStrength(ISeries input ) { return indicator.InternalBarStrength(input); } } } #endregion