#region Using declarations using NinjaTrader.Cbi; using NinjaTrader.Data; using NinjaTrader.Gui.Chart; using NinjaTrader.Gui.Design; using System; using System.ComponentModel; using System.Drawing; using System.Drawing.Drawing2D; using System.Xml.Serialization; #endregion namespace NinjaTrader.Indicator { [Description("USCBands")] public class USCBands : NinjaTrader.Indicator.Indicator { //#region Variables private bool bandas = true; //Micro Bands----------------------------------------------- private int timeFrame; private int tMAPeriod = 56; private double aTRMultiplier = 3.5; private int aTRPeriod = 100; private double trendThreshold = 0.5; private bool showCenterLine = false; private bool moveEndpointEveryTick; private int maxBarsBack = 0x7d0; private Color upBandColor = Color.Lime; private Color downBandColor = Color.Red; private bool colorBandsViaSlope = false; private bool bInit; private int AZ; private DataSeries trend; private int cbip; private int TimeFrameValue; private double TICK; private double SumTMAPeriod; private double TickScaleFactor; private double Threshold; private double PriorTick; private double FullSumW; private readonly double PIPSTOFORCERECALC = 10.0; private double PriceAtFullRecalc; private double range; private double slope; private DataSeries salida; private DataSeries salidaTmaMicro; //Macro Bands----------------------------------------------- private int timeFrame_2; private int tMAPeriod_2 = 120; private double aTRMultiplier_2 = 6.5; private int aTRPeriod_2 = 100; private double trendThreshold_2 = 0.5; private bool showCenterLine_2 = true; private Color upBandColor_2 = Color.Lime; private Color downBandColor_2 = Color.Red; private bool colorBandsViaSlope_2 = true; private bool bInit_2; private int AZ_2; private DataSeries trend_2; private int cbip_2; private int TimeFrameValue_2; private double TICK_2; private double SumTMAPeriod_2; private double TickScaleFactor_2; private double Threshold_2; private double PriorTick_2; private double FullSumW_2; private readonly double PIPSTOFORCERECALC_2 = 10.0; private double PriceAtFullRecalc_2; private double range_2; private double slope_2; private DataSeries salida_2; private DataSeries salidaTmaMacro; //#endregion //#region Funciones private double CalcPureTma(int i) { int num = this.TMAPeriod + 1; double num3 = num * base.Closes[this.cbip][i]; for (int j = 1; j <= this.TMAPeriod; j++) { num3 += (num - j) * (base.Closes[this.cbip][i + j] + base.Closes[this.cbip][i - j]); } return (num3 / this.FullSumW); } private double CalcTma(int inx) { if (inx >= this.TMAPeriod) { return this.CalcPureTma(inx); } return this.CalcTmaEstimate(inx); } private double CalcTmaEstimate(int i) { double num = 0.0; double num2 = 0.0; int num3 = 0; int tMAPeriod = this.TMAPeriod + 1; num2 = 0.0; for (num3 = 0; num3 <= this.TMAPeriod; num3++) { num += (tMAPeriod - num3) * (((i + num3) == -1) ? base.Closes[0][0] : base.Closes[this.cbip][i + num3]); num2 += tMAPeriod - num3; } tMAPeriod = this.TMAPeriod; for (num3 = i - 1; num3 >= 0; num3--) { num += tMAPeriod * base.Closes[this.cbip][num3]; num2 += tMAPeriod; tMAPeriod--; } this.PriorTick = base.Close[0]; return (num / num2); } private double CalcTmaUpdate(double PreviousTma) { double num = PreviousTma + ((base.Close[0] - this.PriorTick) * this.TickScaleFactor); this.PriorTick = base.Close[0]; return num; } private void ColorBandsAsNeeded() { if (base.CurrentBar >= Math.Min(base.LastVisibleBar, base.Count - 3)) { int num = Math.Sign((double) ((this.upperBand[this.AZ] - this.upperBand[this.AZ + 1]) + (this.lowerBand[this.AZ] - this.lowerBand[this.AZ + 1]))); Color color = (num > 0) ? this.upBandColor : this.downBandColor; base.PlotColors[0][0] = color; base.PlotColors[2][0] = color; base.PlotColors[0][this.AZ] = color; base.PlotColors[2][this.AZ] = color; int num2 = this.AZ + 1; while (true) { if ((num2 >= (base.CurrentBar - 5)) || (((Math.Sign((double) (this.upperBand[num2] - this.upperBand[num2 + 1])) == -num) && (Math.Sign((double) (this.upperBand[num2 - 1] - this.upperBand[num2])) == -num)) && ((Math.Sign((double) (this.lowerBand[num2] - this.lowerBand[num2 + 1])) == -num) && (Math.Sign((double) (this.lowerBand[num2 - 1] - this.lowerBand[num2])) == -num)))) { break; } base.PlotColors[0][num2] = color; base.PlotColors[2][num2] = color; num2++; } while (num2 < (base.CurrentBar - 1)) { if (!(base.PlotColors[0][num2] != base.Plots[0].Pen.Color)) { return; } base.PlotColors[0][num2] = base.Plots[0].Pen.Color; base.PlotColors[2][num2] = base.Plots[2].Pen.Color; num2++; } } } //Macro bands funciones-------------- private double CalcPureTma_2(int i_2) { int num_2 = this.TMAPeriod_2 + 1; double num3_2 = num_2 * base.Closes[this.cbip_2][i_2]; for (int j = 1; j <= this.TMAPeriod_2; j++) { num3_2 += (num_2 - j) * (base.Closes[this.cbip_2][i_2 + j] + base.Closes[this.cbip_2][i_2 - j]); } return (num3_2 / this.FullSumW_2); } private double CalcTma_2(int inx_2) { if (inx_2 >= this.TMAPeriod_2) { return this.CalcPureTma_2(inx_2); } return this.CalcTmaEstimate_2(inx_2); } private double CalcTmaEstimate_2(int i_2) { double num_2 = 0.0; double num2_2 = 0.0; int num3_2 = 0; int tMAPeriod_2 = this.TMAPeriod_2 + 1; num2_2 = 0.0; for (num3_2 = 0; num3_2 <= this.TMAPeriod_2; num3_2++) { num_2 += (tMAPeriod_2 - num3_2) * (((i_2 + num3_2) == -1) ? base.Closes[0][0] : base.Closes[this.cbip_2][i_2 + num3_2]); num2_2 += tMAPeriod_2 - num3_2; } tMAPeriod_2 = this.TMAPeriod_2; for (num3_2 = i_2 - 1; num3_2 >= 0; num3_2--) { num_2 += tMAPeriod_2 * base.Closes[this.cbip_2][num3_2]; num2_2 += tMAPeriod_2; tMAPeriod_2--; } this.PriorTick_2 = base.Close[0]; return (num_2 / num2_2); } private double CalcTmaUpdate_2(double PreviousTma_2) { double num_2 = PreviousTma_2 + ((base.Close[0] - this.PriorTick_2) * this.TickScaleFactor_2); this.PriorTick_2 = base.Close[0]; return num_2; } private void ColorBandsAsNeeded_2() { if (base.CurrentBar >= Math.Min(base.LastVisibleBar, base.Count - 3)) { int num_2 = Math.Sign((double) ((this.upperBand_2[this.AZ_2] - this.upperBand_2[this.AZ_2 + 1]) + (this.lowerBand_2[this.AZ_2] - this.lowerBand_2[this.AZ_2 + 1]))); Color color_2 = (num_2 > 0) ? this.upBandColor_2 : this.downBandColor_2; base.PlotColors[3][0] = color_2; base.PlotColors[5][0] = color_2; base.PlotColors[3][this.AZ_2] = color_2; base.PlotColors[5][this.AZ_2] = color_2; int num2_2 = this.AZ_2 + 1; while (true) { if ((num2_2 >= (base.CurrentBar - 5)) || (((Math.Sign((double) (this.upperBand_2[num2_2] - this.upperBand_2[num2_2 + 1])) == -num_2) && (Math.Sign((double) (this.upperBand_2[num2_2 - 1] - this.upperBand_2[num2_2])) == -num_2)) && ((Math.Sign((double) (this.lowerBand_2[num2_2] - this.lowerBand_2[num2_2 + 1])) == -num_2) && (Math.Sign((double) (this.lowerBand_2[num2_2 - 1] - this.lowerBand_2[num2_2])) == -num_2)))) { break; } base.PlotColors[3][num2_2] = color_2; base.PlotColors[5][num2_2] = color_2; num2_2++; } while (num2_2 < (base.CurrentBar - 1)) { if (!(base.PlotColors[3][num2_2] != base.Plots[3].Pen.Color)) { return; } base.PlotColors[3][num2_2] = base.Plots[3].Pen.Color; base.PlotColors[5][num2_2] = base.Plots[5].Pen.Color; num2_2++; } } } //#endregion protected override void Initialize() { //Micro Bands--------------------------------------------------------------------- base.Add(new Plot(new Pen(Color.Gainsboro, 2f), PlotStyle.Line, "\tMicro UpperBand")); base.Add(new Plot(Color.Gainsboro, PlotStyle.Line, "\t\tMicro USCBand")); base.Add(new Plot(new Pen(Color.Gainsboro, 2f), PlotStyle.Line, "\t\t\tMicro LowerBand")); base.Plots[0].Pen.DashStyle = DashStyle.Dash; base.Plots[1].Pen.DashStyle = DashStyle.Dash; base.Plots[2].Pen.DashStyle = DashStyle.Dash; Plots[0].Pen.Width = 1; Plots[1].Pen.Width = 1; Plots[2].Pen.Width = 1; base.Overlay = true; base.CalculateOnBarClose = true; PaintPriceMarkers = false; salida = new DataSeries(this); salidaTmaMicro = new DataSeries(this); salidaTmaMacro = new DataSeries(this); base.MaximumBarsLookBack = MaximumBarsLookBack.Infinite; if ((((this.timeFrame > 0) && (this.timeFrame != base.BarsPeriods[0].Value)) && ((base.BarsPeriod.Value > 0) && (base.BarsPeriods[0].Id != PeriodType.Kagi))) && (((base.BarsPeriods[0].Id != PeriodType.Renko) && (base.BarsPeriods[0].Id != PeriodType.LineBreak)) && (base.BarsPeriods[0].Id != PeriodType.PointAndFigure))) { base.Add(base.BarsPeriods[0].Id, this.timeFrame); this.cbip = 1; } this.trend = new DataSeries(this); //Macro Bands--------------------------------------------------------------------- base.Add(new Plot(new Pen(Color.Gainsboro, 2f), PlotStyle.Line, "\t\t\t\tMacro UpperBand")); base.Add(new Plot(Color.Gainsboro, PlotStyle.Line, "\t\t\t\t\tMacro USCBand")); base.Add(new Plot(new Pen(Color.Gainsboro, 2f), PlotStyle.Line, "\t\t\t\t\t\tMacro LowerBand")); base.Plots[3].Pen.DashStyle = DashStyle.Solid; base.Plots[4].Pen.DashStyle = DashStyle.Dash; base.Plots[5].Pen.DashStyle = DashStyle.Solid; Plots[3].Pen.Width = 2; Plots[4].Pen.Width = 1; Plots[5].Pen.Width = 2; salida_2 = new DataSeries(this); base.MaximumBarsLookBack = MaximumBarsLookBack.Infinite; if ((((this.timeFrame_2 > 0) && (this.timeFrame_2 != base.BarsPeriods[0].Value)) && ((base.BarsPeriod.Value > 0) && (base.BarsPeriods[0].Id != PeriodType.Kagi))) && (((base.BarsPeriods[0].Id != PeriodType.Renko) && (base.BarsPeriods[0].Id != PeriodType.LineBreak)) && (base.BarsPeriods[0].Id != PeriodType.PointAndFigure))) { base.Add(base.BarsPeriods[0].Id, this.timeFrame_2); this.cbip_2 = 1; } this.trend_2 = new DataSeries(this); } protected override void OnBarUpdate() { if (CurrentBar<20)return; //---------------------------------------------------------------------------------------------------------------------------------------- //Micro Bands-------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------------------------- if (!this.bInit) { this.TICK = base.TickSize; this.TimeFrameValue = (this.timeFrame == 0) ? base.BarsPeriod.Value : this.timeFrame; this.SumTMAPeriod = 0.0; for (int i = 1; i <= this.TMAPeriod; i++) { this.SumTMAPeriod += i; } this.FullSumW = (this.TMAPeriod + 1) + (2.0 * this.SumTMAPeriod); this.TickScaleFactor = ((double) (this.TMAPeriod + 1)) / ((this.TMAPeriod + 1) + this.SumTMAPeriod); this.PriorTick = base.Close[0]; this.Threshold = this.PIPSTOFORCERECALC * this.TICK; this.bInit = true; } if ((base.BarsPeriod.Value <= this.TimeFrameValue) && ((base.CurrentBar >= (this.tMAPeriod )) && (base.CurrentBars[this.cbip] >= this.TMAPeriod))) { this.AZ = (base.Historical || base.CalculateOnBarClose) ? 0 : 1; int shift = 0; int num3 = 0; if ((!base.Historical && !base.FirstTickOfBar) && (Math.Abs((double) (base.Close[0] - this.PriceAtFullRecalc)) < this.Threshold)) { if (!this.MoveEndpointEveryTick) { return; } this.tma[0] = this.CalcTmaUpdate(this.tma[0]); this.upperBand[0] = this.tma[0] + this.range; this.lowerBand[0] = this.tma[0] - this.range; } else { this.PriceAtFullRecalc = base.Close[0]; double num4 = this.TimeFrameValue / base.BarsPeriod.Value; num3 = (int) Math.Min((base.CurrentBar - 1) - (this.TMAPeriod + num4), (double) this.MaxBarsBack); num3 = (int) Math.Min((double) num3, 0.0 + (this.TMAPeriod * num4)); int inx = 0; int num6 = 0x3e7; double num7 = this.tma[num3 + 1]; double num8 = this.tma[num3 + 1]; for (shift = num3; shift >= 0; shift--) { if (this.TimeFrameValue == base.BarsPeriod.Value) { inx = shift; } else { inx = base.CurrentBars[this.cbip] - base.BarsArray[this.cbip].GetBar(base.Time[shift]); } if ((inx <= (base.CurrentBars[this.cbip] - this.tMAPeriod)) && (inx >= -1)) { if (inx == num6) { this.tma[shift] = this.tma[shift + 1] + ((num8 - num7) * (1.0 / num4)); this.upperBand[shift] = this.tma[shift] + this.range; this.lowerBand[shift] = this.tma[shift] - this.range; } else { num6 = inx; num7 = num8; num8 = this.CalcTma(inx); this.range = base.ATR(base.Closes[this.cbip], this.aTRPeriod)[Math.Min(base.CurrentBars[this.cbip], inx + 1)] * this.aTRMultiplier; if (this.range == 0.0) { this.range = 1.0; } if (num4 > 1.0) { this.tma[shift] = num7 + ((num8 - num7) * (1.0 / num4)); } else { this.tma[shift] = num8; } this.upperBand[shift] = this.tma[shift] + this.range; this.lowerBand[shift] = this.tma[shift] - this.range; this.slope = (num8 - num7) / ((this.range / this.ATRMultiplier) * 0.1); } } } } int numP = Math.Sign((double) ((this.upperBand[this.AZ] - this.upperBand[this.AZ + 1]) + (this.lowerBand[this.AZ] - this.lowerBand[this.AZ + 1]))); if(numP>0) { salida.Set(1); } else { salida.Set(-1); } } //Color linea central------------------------------------------------------------------------------------ if (showCenterLine == true) { if (Rising(tma)) { PlotColors[1][0] = upBandColor; } else if (Falling(tma)) { PlotColors[1][0] = downBandColor; } } else if (showCenterLine == false) { PlotColors[1][0] = Color.Transparent; } //Salida TMA-------------------------------------- salidaTmaMicro.Set(tma[0]); //-------------------------------------- if(bandas) { //---------------------------------------------------------------------------------------------------------------------------------------- //Macro Bands-------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------------------------- if (!this.bInit_2) { this.TICK_2 = base.TickSize; this.TimeFrameValue_2 = (this.timeFrame_2 == 0) ? base.BarsPeriod.Value : this.timeFrame_2; this.SumTMAPeriod_2 = 0.0; for (int i_2 = 1; i_2 <= this.TMAPeriod_2; i_2++) { this.SumTMAPeriod_2 += i_2; } this.FullSumW_2 = (this.TMAPeriod_2 + 1) + (2.0 * this.SumTMAPeriod_2); this.TickScaleFactor_2 = ((double) (this.TMAPeriod_2 + 1)) / ((this.TMAPeriod_2 + 1) + this.SumTMAPeriod_2); this.PriorTick_2 = base.Close[0]; this.Threshold_2 = this.PIPSTOFORCERECALC_2 * this.TICK_2; this.bInit_2 = true; } if ((base.BarsPeriod.Value <= this.TimeFrameValue_2) && ((base.CurrentBar >= (this.tMAPeriod_2 + base.BarsRequired)) && (base.CurrentBars[this.cbip_2] >= this.TMAPeriod_2))) { this.AZ_2 = (base.Historical || base.CalculateOnBarClose) ? 0 : 1; int shift_2 = 0; int num3_2 = 0; if ((!base.Historical && !base.FirstTickOfBar) && (Math.Abs((double) (base.Close[0] - this.PriceAtFullRecalc_2)) < this.Threshold_2)) { if (!this.MoveEndpointEveryTick) { return; } this.tma_2[0] = this.CalcTmaUpdate_2(this.tma_2[0]); this.upperBand_2[0] = this.tma_2[0] + this.range_2; this.lowerBand_2[0] = this.tma_2[0] - this.range_2; } else { this.PriceAtFullRecalc_2 = base.Close[0]; double num4_2 = this.TimeFrameValue_2 / base.BarsPeriod.Value; num3_2 = (int) Math.Min((base.CurrentBar - 1) - (this.TMAPeriod_2 + num4_2), (double) this.MaxBarsBack); num3_2 = (int) Math.Min((double) num3_2, 0.0 + (this.TMAPeriod_2 * num4_2)); int inx_2 = 0; int num6_2 = 0x3e7; double num7_2 = this.tma_2[num3_2 + 1]; double num8_2 = this.tma_2[num3_2 + 1]; for (shift_2 = num3_2; shift_2 >= 0; shift_2--) { if (this.TimeFrameValue_2 == base.BarsPeriod.Value) { inx_2 = shift_2; } else { inx_2 = base.CurrentBars[this.cbip_2] - base.BarsArray[this.cbip_2].GetBar(base.Time[shift_2]); } if ((inx_2 <= (base.CurrentBars[this.cbip_2] - this.tMAPeriod_2)) && (inx_2 >= -1)) { if (inx_2 == num6_2) { this.tma_2[shift_2] = this.tma_2[shift_2 + 1] + ((num8_2 - num7_2) * (1.0 / num4_2)); this.upperBand_2[shift_2] = this.tma_2[shift_2] + this.range_2; this.lowerBand_2[shift_2] = this.tma_2[shift_2] - this.range_2; } else { num6_2 = inx_2; num7_2 = num8_2; num8_2 = this.CalcTma_2(inx_2); this.range_2 = base.ATR(base.Closes[this.cbip_2], this.aTRPeriod_2)[Math.Min(base.CurrentBars[this.cbip_2], inx_2 + 1)] * this.aTRMultiplier_2; if (this.range_2 == 0.0) { this.range_2 = 1.0; } if (num4_2 > 1.0) { this.tma_2[shift_2] = num7_2 + ((num8_2 - num7_2) * (1.0 / num4_2)); } else { this.tma_2[shift_2] = num8_2; } this.upperBand_2[shift_2] = this.tma_2[shift_2] + this.range_2; this.lowerBand_2[shift_2] = this.tma_2[shift_2] - this.range_2; this.slope_2 = (num8_2 - num7_2) / ((this.range_2 / this.ATRMultiplier_2) * 0.1); } } } } int numP_2 = Math.Sign((double) ((this.upperBand_2[this.AZ_2] - this.upperBand_2[this.AZ_2 + 1]) + (this.lowerBand_2[this.AZ_2] - this.lowerBand_2[this.AZ_2 + 1]))); if(numP_2>0) { salida_2.Set(1); } else { salida_2.Set(-1); } } //Color linea central------------------------------------------------------------------------------------ if (showCenterLine_2 == true) { double difTMA = Math.Abs(tma_2[0] - tma_2[1]); // difTMA = Math.Round(difTMA, 4, MidpointRounding.AwayFromZero); if (Rising(tma_2) && difTMA > 0.005) { PlotColors[4][0] = upBandColor_2; } else if (Falling(tma_2) && difTMA > 0.005) { PlotColors[4][0] = downBandColor_2; } else { PlotColors[4][0] = Color.Yellow; } } else if (showCenterLine_2 == false) { PlotColors[4][0] = Color.Transparent; } //Salida TMA-------------------------------------- salidaTmaMacro.Set(tma_2[0]); //-------------------------------------- } //---------------------------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------------------------- if (this.colorBandsViaSlope) { this.ColorBandsAsNeeded(); } if (this.colorBandsViaSlope_2) { this.ColorBandsAsNeeded_2(); } } /////--------------------------------------------------------------------------------------------------------- #region Parameters [GridCategory("\t Parameters"), NinjaTrader.Gui.Design.DisplayName("\t Two bands"), Description("***")] public bool Bandas { get { return bandas; } set { bandas = value; } } ///Parametros generales---------------------- [GridCategory("\t Parameters")] [NinjaTrader.Gui.Design.DisplayName("\t\t Max Bar Back")] [Description("***")] public int MaxBarsBack { get { return maxBarsBack; } set { maxBarsBack = Math.Max(1, value); } } [GridCategory("\t Parameters")] [NinjaTrader.Gui.Design.DisplayName("\t\t\t Move Every Tick")] [Description("***")] public bool MoveEndpointEveryTick { get { return moveEndpointEveryTick; } set { moveEndpointEveryTick = value; } } //---------------------------------------------------------------------------------------------------------------------------- [XmlIgnore, Browsable(false)] public DataSeries upperBand { get { return Values[0]; } } [XmlIgnore, Browsable(false)] public DataSeries tma { get { return Values[1]; } } [XmlIgnore, Browsable(false)] public DataSeries lowerBand { get { return Values[2]; } } //------------------------------- [Browsable(false)] [XmlIgnore] public DataSeries Salida { get { return salida; } } [Browsable(false)] [XmlIgnore] public DataSeries SalidaTmaMicro { get {return salidaTmaMicro;} } [Browsable(false)] [XmlIgnore] public DataSeries SalidaTmaMacro { get {return salidaTmaMacro;} } ///Colores micro------------------------------ [GridCategory("\t\t\t [MicroBands] Visual Parameters"), NinjaTrader.Gui.Design.DisplayName("\t Trend Color"), Description("***")] public bool ColorBandsViaSlope { get { return colorBandsViaSlope; } set { colorBandsViaSlope = value; } } [GridCategory("\t\t\t [MicroBands] Visual Parameters"), NinjaTrader.Gui.Design.DisplayName("\t\t\t Up Color"), Description("***")] public Color UpBandColor { get { return upBandColor; } set { upBandColor = value; } } [Browsable(false)] public string upBandColorSerialize { get { return SerializableColor.ToString(this.upBandColor); } set { upBandColor = SerializableColor.FromString(value);} } [GridCategory("\t\t\t [MicroBands] Visual Parameters"), NinjaTrader.Gui.Design.DisplayName("\t\t\t\t Down Color"), Description("***")] public Color DownBandColor { get { return downBandColor; } set { downBandColor = value; } } [Browsable(false)] public string downBandColorSerialize { get { return SerializableColor.ToString(this.downBandColor); } set { downBandColor = SerializableColor.FromString(value);} } [GridCategory("\t\t\t [MicroBands] Visual Parameters"), NinjaTrader.Gui.Design.DisplayName("\t\t Show Center Line"), Description("***")] public bool ShowCenterLine { get { return showCenterLine; } set { showCenterLine = value; } } ///parametros micro----------------------- [GridCategory("\t\t [MicroBands] Parameters")] [NinjaTrader.Gui.Design.DisplayName("\t Period")] [Description("***")] public int TMAPeriod { get { return tMAPeriod; } set { tMAPeriod = Math.Max(1, value); } } [GridCategory("\t\t [MicroBands] Parameters")] [NinjaTrader.Gui.Design.DisplayName("\t\t Multiplier")] [Description("***")] public double ATRMultiplier { get { return aTRMultiplier; } set { aTRMultiplier = Math.Max(0.0, value); } } [GridCategory("\t\t [MicroBands] Parameters")] [NinjaTrader.Gui.Design.DisplayName("\t\t\t Softness Period")] [Description("***")] public int ATRPeriod { get { return aTRPeriod; } set { aTRPeriod = Math.Max(1, value); } } [GridCategory("\t\t [MicroBands] Parameters")] [NinjaTrader.Gui.Design.DisplayName("\t\t\t\t Trend Threshold")] [Description("***")] public double TrendThreshold { get { return trendThreshold; } set { trendThreshold = Math.Max(0.0, value); } } //--------------------------------------------------------------------------------------------------------- //Macro Bands------------------------------------------------------ //--------------------------------------------------------------------------------------------------------- [XmlIgnore, Browsable(false)] public DataSeries upperBand_2 { get { return Values[3]; } } [XmlIgnore, Browsable(false)] public DataSeries tma_2 { get { return Values[4]; } } [XmlIgnore, Browsable(false)] public DataSeries lowerBand_2 { get { return Values[5]; } } ///-------------------------------------- [Browsable(false)] [XmlIgnore] public DataSeries Salida_2 { get { return salida_2; } } ///colores macro------------------------ [GridCategory("\t\t\t\t [MacroBands] Visual Parameters"), NinjaTrader.Gui.Design.DisplayName("\t Trend Color"), Description("***")] public bool ColorBandsViaSlope_2 { get { return colorBandsViaSlope_2; } set { colorBandsViaSlope_2 = value; } } [GridCategory("\t\t\t\t [MacroBands] Visual Parameters"), NinjaTrader.Gui.Design.DisplayName("\t\t\t Up Color"), Description("***")] public Color UpBandColor_2 { get { return upBandColor_2; } set { upBandColor_2 = value; } } [Browsable(false)] public string upBandColor_2Serialize { get { return SerializableColor.ToString(this.upBandColor_2); } set { upBandColor_2 = SerializableColor.FromString(value);} } [GridCategory("\t\t\t\t [MacroBands] Visual Parameters"), NinjaTrader.Gui.Design.DisplayName("\t\t\t\t Down Color"), Description("***")] public Color DownBandColor_2 { get { return downBandColor_2; } set { downBandColor_2 = value; } } [Browsable(false)] public string downBand_2ColorSerialize { get { return SerializableColor.ToString(this.downBandColor_2); } set { downBandColor_2 = SerializableColor.FromString(value);} } [GridCategory("\t\t\t\t [MacroBands] Visual Parameters"), NinjaTrader.Gui.Design.DisplayName("\t\t Show Center Line"), Description("***")] public bool ShowCenterLine_2 { get { return showCenterLine_2; } set { showCenterLine_2 = value; } } ///parametros macro------------------------ [GridCategory("\t\t\t\t [MacroBands] Parameters")] [NinjaTrader.Gui.Design.DisplayName("\t Period")] [Description("***")] public int TMAPeriod_2 { get { return tMAPeriod_2; } set { tMAPeriod_2 = Math.Max(1, value); } } [GridCategory("\t\t\t\t [MacroBands] Parameters")] [NinjaTrader.Gui.Design.DisplayName("\t\t Multiplier")] [Description("***")] public double ATRMultiplier_2 { get { return aTRMultiplier_2; } set { aTRMultiplier_2 = Math.Max(0.0, value); } } [GridCategory("\t\t\t\t [MacroBands] Parameters")] [NinjaTrader.Gui.Design.DisplayName("\t\t\t Softness Period")] [Description("***")] public int ATRPeriod_2 { get { return aTRPeriod_2; } set { aTRPeriod_2 = Math.Max(1, value); } } [GridCategory("\t\t\t\t [MacroBands] Parameters")] [NinjaTrader.Gui.Design.DisplayName("\t\t\t\t Trend Threshold")] [Description("***")] public double TrendThreshold_2 { get { return trendThreshold_2; } set { trendThreshold_2 = Math.Max(0.0, value); } } #endregion } }