Esempio n. 1
0
        protected override void OnStateChange()
        {
            if (State == State.SetDefaults)
            {
                Description             = @"Enter the description for your new custom Indicator here.";
                Name                    = "GuerillaTsi";
                Calculate               = Calculate.OnBarClose;
                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;
                TsiLongLength            = 25;
                TsiShortLength           = 5;
                TsiSignalLength          = 14;

                AddPlot(Brushes.Goldenrod, "GuerillaTsiPlot");
            }
            else if (State == State.Configure)
            {
            }
            else if (State == State.DataLoaded)
            {
                pc    = GuerillaPcDif(Close);
                absPc = GuerillaAbsVal(pc);

                doubleSmoothedPc    = GuerillaDoubleSmooth(pc, this.TsiLongLength, this.TsiShortLength);
                doubleSmoothedAbsPc = GuerillaDoubleSmooth(absPc, this.TsiLongLength, this.TsiShortLength);
            }
        }
        protected override void OnStateChange()
        {
            if (State == State.SetDefaults)
            {
                Description = @"Enter the description for your new custom Indicator here.";
                Name        = "GuerillaTkp";
                Calculate   = Calculate.OnBarClose;
                //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;
                TsiLongLength            = 25;
                TsiShortLength           = 5;
                TsiSignalLength          = 14;

                RsiLength          = 5;
                RsiBuyFilterLevel  = 50;
                RsiSellFilterLevel = 50;

                AddPlot(Brushes.Goldenrod, "GuerillaTkpPlot");
            }
            else if (State == State.Configure)
            {
            }
            else if (State == State.DataLoaded)
            {
                pc = GuerillaPcDif(Close);

                #region TSI
                tsi           = GuerillaTsi(this.TsiLongLength, this.TsiShortLength, this.TsiSignalLength);
                tsiSignalLine = EMA(tsi, this.TsiSignalLength);
                #endregion

                #region RSI
                maxPc    = GuerillaMax(pc, 0);
                minPc    = GuerillaMin(pc, 0);
                absMinPc = GuerillaAbsVal(minPc);

                upRma   = GuerillaRma(maxPc, this.RsiLength);
                downRma = GuerillaRma(absMinPc, this.RsiLength);

                rsi     = new Series <double>(this);
                buy     = new Series <bool>(this);
                sell    = new Series <bool>(this);
                neutral = new Series <bool>(this);
                #endregion
            }
        }