Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Ninja ElliottOscillator Editing Question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    here is a screenshot...it does not seem to working as same color above and below zero line and neutral is transparent...thanks
    C:\Users\brian\Downloads\cs_file2.png

    Comment


      #17
      Sorry Brian, we could not access those screenshots you post? Can you please directly attach here? Did you use the exact version that I posted?
      BertrandNinjaTrader Customer Service

      Comment


        #18
        I posted exactly what you had...try this link (not sure how to attach a pic directly...asks for link to image with no other choice...thanks

        //
        // Copyright (C) 2006, NinjaTrader LLC <[email protected]>.
        // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
        //

        #region Using declarations
        using System;
        using System.Diagnostics;
        using System.Drawing;
        using System.Drawing.Drawing2D;
        using System.ComponentModel;
        using System.Xml.Serialization;
        using NinjaTrader.Data;
        using NinjaTrader.Gui.Chart;
        #endregion

        // This namespace holds all indicators and is required. Do not change it.
        namespace NinjaTrader.Indicator
        {
        /// <summary>
        /// Elliot Oscillator
        /// </summary>
        [Description("The Elliot Oscillator is a trend following momentum indicator that shows the relationship between two moving averages of prices.")]
        [Gui.Design.DisplayName("Elliot Oscillator")]
        public class ElliotOscillator2 : Indicator
        {
        #region Variables
        private int fast = 5;
        private int slow = 34;
        private double elliot = 0;
        private double elliot3 = 0;
        private DataSeries fastEma;
        private DataSeries slowEma;
        #endregion

        /// <summary>
        /// This method is used to configure the indicator and is called once before any bar data is loaded.
        /// </summary>
        protected override void Initialize()
        {
        Add(new Plot(Color.Transparent, "Elliot"));
        Add(new Plot(new Pen(Color.Blue, 3), PlotStyle.Bar, "UpTrend"));
        Add(new Plot(new Pen(Color.Red, 3), PlotStyle.Bar, "DownTrend"));
        Add(new Plot(Color.Red, "Elliot Displaced"));
        Add(new Line(Color.DarkGray, 0, "Zero line"));

        fastEma = new DataSeries(this);
        slowEma = new DataSeries(this);
        CalculateOnBarClose = true;
        PriceTypeSupported = true;
        AutoScale = true;
        }

        /// <summary>
        /// Calculates the indicator value(s) at the current index.
        /// </summary>
        protected override void OnBarUpdate()
        {
        if (CurrentBar < 3)
        return;

        if (CurrentBar == 0)
        {
        fastEma.Set(Input[0]);
        slowEma.Set(Input[0]);
        Value.Set(0);
        Elliott3.Set(0);
        }
        else
        {
        fastEma.Set(SMA(fast)[0]);
        slowEma.Set(SMA(slow)[0]);
        elliot = ((fastEma[0] - slowEma[0]));
        elliot3 = ((fastEma[3] - slowEma[3]));

        Value.Set(elliot);
        Elliott3.Set(elliot3);

        if (Value[0] > 0)
        Uptrend.Set(elliot);
        else if (Value[0] < 0)
        Downtrend.Set(elliot);

        }
        }

        #region Properties
        /// <summary>
        /// </summary>
        [Browsable(false)]
        [XmlIgnore()]
        public DataSeries Default
        {
        get { return Values[0]; }
        }
        [Browsable(false)]
        [XmlIgnore()]
        public DataSeries Uptrend
        {
        get { return Values[1]; }
        }

        [Browsable(false)]
        [XmlIgnore()]
        public DataSeries Downtrend
        {
        get { return Values[2]; }
        }

        /// <summary>
        /// </summary>
        [Browsable(false)]
        [XmlIgnore()]
        public DataSeries Elliott3
        {
        get { return Values[3]; }
        }




        /// <summary>
        /// </summary>
        [Description("Number of bars for fast SMA")]
        [Category("Parameters")]
        public int Fast
        {
        get { return fast; }
        set { fast = Math.Max(1, value); }
        }

        /// <summary>
        /// </summary>
        [Description("Number of bars for slow SMA")]
        [Category("Parameters")]
        public int Slow
        {
        get { return slow; }
        set { slow = Math.Max(1, value); }
        }

        #endregion
        }
        }

        #region NinjaScript generated code. Neither change nor remove.
        // This namespace holds all indicators and is required. Do not change it.
        namespace NinjaTrader.Indicator
        {
        public partial class Indicator : IndicatorBase
        {
        private ElliotOscillator2[] cacheElliotOscillator2 = null;

        private static ElliotOscillator2 checkElliotOscillator2 = new ElliotOscillator2();

        /// <summary>
        /// The Elliot Oscillator is a trend following momentum indicator that shows the relationship between two moving averages of prices.
        /// </summary>
        /// <returns></returns>
        public ElliotOscillator2 ElliotOscillator2(int fast, int slow)
        {
        return ElliotOscillator2(Input, fast, slow);
        }

        /// <summary>
        /// The Elliot Oscillator is a trend following momentum indicator that shows the relationship between two moving averages of prices.
        /// </summary>
        /// <returns></returns>
        public ElliotOscillator2 ElliotOscillator2(Data.IDataSeries input, int fast, int slow)
        {
        if (cacheElliotOscillator2 != null)
        for (int idx = 0; idx < cacheElliotOscillator2.Length; idx++)
        if (cacheElliotOscillator2[idx].Fast == fast && cacheElliotOscillator2[idx].Slow == slow && cacheElliotOscillator2[idx].EqualsInput(input))
        return cacheElliotOscillator2[idx];

        lock (checkElliotOscillator2)
        {
        checkElliotOscillator2.Fast = fast;
        fast = checkElliotOscillator2.Fast;
        checkElliotOscillator2.Slow = slow;
        slow = checkElliotOscillator2.Slow;

        if (cacheElliotOscillator2 != null)
        for (int idx = 0; idx < cacheElliotOscillator2.Length; idx++)
        if (cacheElliotOscillator2[idx].Fast == fast && cacheElliotOscillator2[idx].Slow == slow && cacheElliotOscillator2[idx].EqualsInput(input))
        return cacheElliotOscillator2[idx];

        ElliotOscillator2 indicator = new ElliotOscillator2();
        indicator.BarsRequired = BarsRequired;
        indicator.CalculateOnBarClose = CalculateOnBarClose;
        #if NT7
        indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
        indicator.MaximumBarsLookBack = MaximumBarsLookBack;
        #endif
        indicator.Input = input;
        indicator.Fast = fast;
        indicator.Slow = slow;
        Indicators.Add(indicator);
        indicator.SetUp();

        ElliotOscillator2[] tmp = new ElliotOscillator2[cacheElliotOscillator2 == null ? 1 : cacheElliotOscillator2.Length + 1];
        if (cacheElliotOscillator2 != null)
        cacheElliotOscillator2.CopyTo(tmp, 0);
        tmp[tmp.Length - 1] = indicator;
        cacheElliotOscillator2 = tmp;
        return indicator;
        }
        }
        }
        }

        // This namespace holds all market analyzer column definitions and is required. Do not change it.
        namespace NinjaTrader.MarketAnalyzer
        {
        public partial class Column : ColumnBase
        {
        /// <summary>
        /// The Elliot Oscillator is a trend following momentum indicator that shows the relationship between two moving averages of prices.
        /// </summary>
        /// <returns></returns>
        [Gui.Design.WizardCondition("Indicator")]
        public Indicator.ElliotOscillator2 ElliotOscillator2(int fast, int slow)
        {
        return _indicator.ElliotOscillator2(Input, fast, slow);
        }

        /// <summary>
        /// The Elliot Oscillator is a trend following momentum indicator that shows the relationship between two moving averages of prices.
        /// </summary>
        /// <returns></returns>
        public Indicator.ElliotOscillator2 ElliotOscillator2(Data.IDataSeries input, int fast, int slow)
        {
        return _indicator.ElliotOscillator2(input, fast, slow);
        }
        }
        }

        // This namespace holds all strategies and is required. Do not change it.
        namespace NinjaTrader.Strategy
        {
        public partial class Strategy : StrategyBase
        {
        /// <summary>
        /// The Elliot Oscillator is a trend following momentum indicator that shows the relationship between two moving averages of prices.
        /// </summary>
        /// <returns></returns>
        [Gui.Design.WizardCondition("Indicator")]
        public Indicator.ElliotOscillator2 ElliotOscillator2(int fast, int slow)
        {
        return _indicator.ElliotOscillator2(Input, fast, slow);
        }

        /// <summary>
        /// The Elliot Oscillator is a trend following momentum indicator that shows the relationship between two moving averages of prices.
        /// </summary>
        /// <returns></returns>
        public Indicator.ElliotOscillator2 ElliotOscillator2(Data.IDataSeries input, int fast, int slow)
        {
        if (InInitialize && input == null)
        throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");

        return _indicator.ElliotOscillator2(input, fast, slow);
        }
        }
        }
        #endregion

        Comment


          #19
          Right, that's file I sent you, but it seems it's not the one you actually then chart? You seen to call the UpDn variation?
          BertrandNinjaTrader Customer Service

          Comment


            #20
            Got it...now it works...thank you so much for all your help.

            Comment


              #21
              hey yall, has anyone converted this indi to NT8??

              Comment


                #22
                has anyone transcribed this indicator to NT8?

                Comment


                  #23
                  Hello raptureye,

                  I will take a look into this item to see if it can be converted into NT8 format. Once I have more details I will reply back here.

                  I do want to mention that conversions are not a service that our support offers but it looks like Bertrand had previously uploaded an indicator named "EWO2.cs" which I can review to see about an NT8 version.

                  I look forward to being of further assistance.
                  JesseNinjaTrader Customer Service

                  Comment


                    #24
                    Hi Jesse, of course so thank you, I appreciate what you can find out on y'all's end!

                    Comment


                      #25
                      Hello raptureye,

                      It looks like the other item is fairly simple and is just a few plots in addition to the calculation. I went ahead and moved this over to an NT8 script as there was really no conversion needed here, just the correct NT8 syntax modifications were needed.


                      Please let me know if I may be of further assistance.

                      Attached Files
                      JesseNinjaTrader Customer Service

                      Comment


                        #26
                        epic thanks Jesse!

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Jon17, Today, 04:33 PM
                        0 responses
                        1 view
                        0 likes
                        Last Post Jon17
                        by Jon17
                         
                        Started by Javierw.ok, Today, 04:12 PM
                        0 responses
                        4 views
                        0 likes
                        Last Post Javierw.ok  
                        Started by timmbbo, Today, 08:59 AM
                        2 responses
                        10 views
                        0 likes
                        Last Post bltdavid  
                        Started by alifarahani, Today, 09:40 AM
                        6 responses
                        40 views
                        0 likes
                        Last Post alifarahani  
                        Started by Waxavi, Today, 02:10 AM
                        1 response
                        19 views
                        0 likes
                        Last Post NinjaTrader_LuisH  
                        Working...
                        X