Ejemplo n.º 1
0

        
Ejemplo n.º 2
0
        //private int testCond = 0;

        protected override void OnStateChange()
        {
            if (State == State.SetDefaults)
            {
                Description             = @"Enter the description for your new custom Indicator here.";
                Name                    = "Market Condition";
                Calculate               = Calculate.OnEachTick;
                IsOverlay               = true;
                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.
                /// show plots
                showBands                = true;
                showVolatilityText       = false;
                IsSuspendedWhileInactive = true;
                AddPlot(Brushes.DarkGray, "Upper");           // Stored in Plots[0]
                AddPlot(Brushes.DarkGray, "Lower");           // Stored in Plots[1]
            }
            else if (State == State.Configure)
            {
                atrPctSeries = new Series <double>(this, MaximumBarsLookBack.Infinite);
                marketCond   = new Series <int>(this, MaximumBarsLookBack.Infinite);
            }
            else if (State == State.DataLoaded)
            {
                sma    = SMA(200);
                atr    = ATR(14);
                stdDev = StdDev(100);
                ClearOutputWindow();
            }
        }
Ejemplo n.º 3
0
        protected override void OnStateChange()
        {
            if (State == State.SetDefaults)
            {
                Description             = @"JBWeisWave";
                Name                    = "JBWeisWave";
                Calculate               = Calculate.OnBarClose;
                IsOverlay               = true;
                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;
                Length                = 9;
                Style                 = SwingStyle.Close;
                WaveLineWidth         = 2;
                WaveColor             = Brushes.DeepSkyBlue;
                DownVolColor          = Brushes.White;
                UpVolColor            = Brushes.White;
                DownDeltaColor        = Brushes.Magenta;
                UpDeltaColor          = Brushes.Cyan;
                VolumeLabelBarSpacing = 30;
                DeltaLabelBarSpacing  = 50;
                WaveLineStyle         = DashStyleHelper.Solid;
                ShowVolumes           = true;
                ShowLines             = true;
                ShowDeltas            = true;
                ShowTail              = false;

                VolumeTextFont = new Gui.Tools.SimpleFont("Arial", 11);
                DeltaTextFont  = new Gui.Tools.SimpleFont("Arial", 11);
            }
            else if (State == State.Configure)
            {
                if (Calculate != Calculate.OnBarClose)
                {
                    Draw.TextFixed(this, "NinjaScriptInfo", "JBWeisWave only works with calculation set to 'on bar close'", TextPosition.BottomRight);
                    Log("JBWeisWave only works with calculation set to 'on bar close'", LogLevel.Error);
                    validConfig = false;
                }
            }
            else if (State == State.Historical)
            {
                if (ShowDeltas && !Bars.IsTickReplay)
                {
                    Draw.TextFixed(this, "NinjaScriptInfo", "JBWeisWave needs tick replay enabled on the data series when using delta", TextPosition.BottomRight);
                    Log("JBWeisWave needs tick replay enabled on the data series when using delta", LogLevel.Error);
                }
            }
            else if (State == State.DataLoaded)
            {
                this.atr             = ATR(Length);
                this.close           = new Series <double>(this, MaximumBarsLookBack.TwoHundredFiftySix);
                this.extreme         = new Series <double>(this, MaximumBarsLookBack.TwoHundredFiftySix);
                this.direction       = new Series <int>(this, MaximumBarsLookBack.TwoHundredFiftySix);
                this.extremeBar      = new Series <int>(this, MaximumBarsLookBack.TwoHundredFiftySix);
                this.waveVolume      = new Series <double>(this, MaximumBarsLookBack.TwoHundredFiftySix);
                this.waveVolumeDelta = new Series <double>(this, MaximumBarsLookBack.TwoHundredFiftySix);
                this.barVolumeDelta  = new Series <double>(this, MaximumBarsLookBack.TwoHundredFiftySix);
            }
        }