Chart Sizing - adjusts the vertical scale of the chart by the number of ticks

public class ChartSizingSimple : Indicator
    {
        #region Variables
        // Wizard generated variables
            private int myInput0 = 40; // Default setting for MyInput0
private int myInput1 = 20; // Default setting for MyInput0

        #endregion

        protected override void Initialize()
        {
            Overlay = true;
        }

       protected override void OnBarUpdate()
        {
if (CurrentBar < 1)
        return;

else
{
ChartControl.YAxisRangeTypeRight = YAxisRangeType.Fixed;
ChartControl.FixedPanelMaxRight = Close[0] + TickSize * myInput0 + TickSize * 2 + TickSize * myInput1;
ChartControl.FixedPanelMinRight = Close[0] - TickSize * myInput0 - TickSize * 2 + TickSize * myInput1;

}


}

        #region Properties
        [Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
        [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
        public DataSeries Plot0
        {
            get { return Values[0]; }
        }


        [Description("")]
        [GridCategory("Parameters")]
        public int MyInput0
        {
            get { return myInput0; }
            set { myInput0 = Math.Max(1, value); }
        }

[Description("")]
        [GridCategory("Parameters")]
        public int MyInput1
        {
            get { return myInput1; }
            set { myInput1 = value; }
        }


        #endregion
    }

Comments

Popular posts from this blog

ATR in Tick - shows ATR in the number of ticks

Constant Lines Areas - makes vertical constant lines and color each area created by the lines