I made a small and simple S1R Indicator that each time makes new Support and Resistance levels based on previous candles, but it seemds it doesn't work I dono why
this is the code :
namespace NinjaTrader.NinjaScript.Indicators.TheGM { public class TheGMSupportandResistance : Indicator { protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"Enter the description for your new custom Indicator here."; Name = "TheGMSupportandResistance"; Calculate = Calculate.OnBarClose; IsOverlay = 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; } else if (State == State.Configure) { } } protected override void OnBarUpdate() { if (Low[0] < Low[1]) Draw.HorizontalLine(this, "Support", Low[0]-TickSize, Brushes.Green); if (High[0] > High[1]) Draw.HorizontalLine(this, "Resistance", High[0]+TickSize, Brushes.Red); } } }
Comment