Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

willium vix fix indicator

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

    willium vix fix indicator

    Hi

    I am looking for the indicator based on WVF.

    WVF = (HHV (Close,22) - Low)/(HHV(Close,22))*100;

    i need a bb band and stochD of the same.plz help me out of it.

    thx
    sumana.m

    #2
    Hi

    Originally posted by sumana.m View Post
    Hi

    I am looking for the indicator based on WVF.

    WVF = (HHV (Close,22) - Low)/(HHV(Close,22))*100;

    i need a bb band and stochD of the same.plz help me out of it.

    thx
    sumana.m
    Code:
    #region Using declarations
    using System;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Drawing;
    using System.Drawing.Drawing2D;
    using System.Xml.Serialization;
    using NinjaTrader.Cbi;
    using NinjaTrader.Data;
    using NinjaTrader.Gui.Chart;
    #endregion
    
    // This namespace holds all indicators and is required. Do not change it.
    namespace NinjaTrader.Indicator
    {
        /// <summary>
        /// Willium Vix Fix -- Of tuple
        /// </summary>
        [Description("Willium Vix Fix -- Of tuple")]
        public class WVF : Indicator
        {
            #region Variables
            // Wizard generated variables
                private int wVF_Period = 22; // Default setting for WVF_Period
                private int stochD_Period = 14; // Default setting for StochD_Period
                private DataSeries        CurVar_DS;
                private DataSeries        CurVar_StochK;
            // User defined variables (add any user defined variables below)
            #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.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "WVFplot0"));
                Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Bar, "StockDplot"));
                Overlay                = false;
                CurVar_DS = new DataSeries(this);
                CurVar_StochK=new DataSeries(this);
            }
    
            /// <summary>
            /// Called on each bar update event (incoming tick)
            /// </summary>
            protected override void OnBarUpdate()
            {
                // Use this method for calculating your indicator values. Assign a value to each
                // plot below by replacing 'Close[0]' with your own formula.
                //CurRSI_DS.Set(RSI(periodRSI,0)[0]);
                
                double LLV = MIN(Close, wVF_Period)[0];
                double HHV = MAX(Close, wVF_Period)[0];
                //WVF = (HHV (Close,22) - Low)/(HHV(Close,22))*100;
                CurVar_DS.Set(100*((HHV-Low[0])/HHV));
                
                WVFplot0.Set(CurVar_DS[0]);
                //StoK.Set(SMA(StoRSI_DS, periodK)[0]);
                CurVar_StochK.Set(Stochastics(CurVar_DS,stochD_Period,2).K[0]);
                //CurVar_StochK.Set(Stochastics(CurVar_DS,stochD_Period,2).D[0]);
                StockDplot.Set(CurVar_StochK[0]);
            }
    
            #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 WVFplot0
            {
                get { return Values[0]; }
            }
    
            [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 StockDplot
            {
                get { return Values[1]; }
            }
    
            [Description("WVF works with two value 22 and 26")]
            [GridCategory("Parameters")]
            public int WVF_Period
            {
                get { return wVF_Period; }
                set { wVF_Period = Math.Max(22, value); }
            }
    
            [Description("")]
            [GridCategory("Parameters")]
            public int StochD_Period
            {
                get { return stochD_Period; }
                set { stochD_Period = 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 WVF[] cacheWVF = null;
    
            private static WVF checkWVF = new WVF();
    
            /// <summary>
            /// Willium Vix Fix -- Of tuple
            /// </summary>
            /// <returns></returns>
            public WVF WVF(int stochD_Period, int wVF_Period)
            {
                return WVF(Input, stochD_Period, wVF_Period);
            }
    
            /// <summary>
            /// Willium Vix Fix -- Of tuple
            /// </summary>
            /// <returns></returns>
            public WVF WVF(Data.IDataSeries input, int stochD_Period, int wVF_Period)
            {
                if (cacheWVF != null)
                    for (int idx = 0; idx < cacheWVF.Length; idx++)
                        if (cacheWVF[idx].StochD_Period == stochD_Period && cacheWVF[idx].WVF_Period == wVF_Period && cacheWVF[idx].EqualsInput(input))
                            return cacheWVF[idx];
    
                lock (checkWVF)
                {
                    checkWVF.StochD_Period = stochD_Period;
                    stochD_Period = checkWVF.StochD_Period;
                    checkWVF.WVF_Period = wVF_Period;
                    wVF_Period = checkWVF.WVF_Period;
    
                    if (cacheWVF != null)
                        for (int idx = 0; idx < cacheWVF.Length; idx++)
                            if (cacheWVF[idx].StochD_Period == stochD_Period && cacheWVF[idx].WVF_Period == wVF_Period && cacheWVF[idx].EqualsInput(input))
                                return cacheWVF[idx];
    
                    WVF indicator = new WVF();
                    indicator.BarsRequired = BarsRequired;
                    indicator.CalculateOnBarClose = CalculateOnBarClose;
    #if NT7
                    indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                    indicator.MaximumBarsLookBack = MaximumBarsLookBack;
    #endif
                    indicator.Input = input;
                    indicator.StochD_Period = stochD_Period;
                    indicator.WVF_Period = wVF_Period;
                    Indicators.Add(indicator);
                    indicator.SetUp();
    
                    WVF[] tmp = new WVF[cacheWVF == null ? 1 : cacheWVF.Length + 1];
                    if (cacheWVF != null)
                        cacheWVF.CopyTo(tmp, 0);
                    tmp[tmp.Length - 1] = indicator;
                    cacheWVF = 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>
            /// Willium Vix Fix -- Of tuple
            /// </summary>
            /// <returns></returns>
            [Gui.Design.WizardCondition("Indicator")]
            public Indicator.WVF WVF(int stochD_Period, int wVF_Period)
            {
                return _indicator.WVF(Input, stochD_Period, wVF_Period);
            }
    
            /// <summary>
            /// Willium Vix Fix -- Of tuple
            /// </summary>
            /// <returns></returns>
            public Indicator.WVF WVF(Data.IDataSeries input, int stochD_Period, int wVF_Period)
            {
                return _indicator.WVF(input, stochD_Period, wVF_Period);
            }
        }
    }
    
    // This namespace holds all strategies and is required. Do not change it.
    namespace NinjaTrader.Strategy
    {
        public partial class Strategy : StrategyBase
        {
            /// <summary>
            /// Willium Vix Fix -- Of tuple
            /// </summary>
            /// <returns></returns>
            [Gui.Design.WizardCondition("Indicator")]
            public Indicator.WVF WVF(int stochD_Period, int wVF_Period)
            {
                return _indicator.WVF(Input, stochD_Period, wVF_Period);
            }
    
            /// <summary>
            /// Willium Vix Fix -- Of tuple
            /// </summary>
            /// <returns></returns>
            public Indicator.WVF WVF(Data.IDataSeries input, int stochD_Period, int wVF_Period)
            {
                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.WVF(input, stochD_Period, wVF_Period);
            }
        }
    }
    #endregion
    getting error and values are different
    Last edited by sumana.m; 12-20-2014, 03:52 AM.

    Comment


      #3
      Hi

      anyone
      Attached Files

      Comment


        #4
        sumana.m,

        What kind of error are you getting?

        What values are you comparing against?
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          hi


          Thanks for your decent reply ....
          Originally posted by NinjaTrader_Cal View Post
          sumana.m,

          What kind of error are you getting?

          What values are you comparing against?
          many error removed in the last version.
          so u may close the thread.
          Attached Files
          Last edited by sumana.m; 12-21-2014, 09:01 AM.

          Comment


            #6
            Hi

            just asking one additional question, can we draw a few lines based on this indic to derive pivot line in price chart?pivot lines should be drawn based on bar range not based on time slice ....
            Last edited by sumana.m; 12-23-2014, 07:48 AM.

            Comment


              #7
              Sumana,

              Yes, you can use DrawLine() method to place lines on the chart where you would like your pivot lines to be.

              http://www.ninjatrader.com/support/h...l?drawline.htm
              Cal H.NinjaTrader Customer Service

              Comment


                #8
                Hi

                Thanks for your reply.

                Originally posted by NinjaTrader_Cal View Post
                Sumana,

                Yes, you can use DrawLine() method to place lines on the chart where you would like your pivot lines to be.

                http://www.ninjatrader.com/support/h...l?drawline.htm
                DrawLine(string tag, int startBarsAgo, double startY, int endBarsAgo, double endY, Color color);

                can i apply it in a for loop ... eg. stochfast rising it will start marking bar lows until price leave the bar or breaks the pivot line and when stochfast will be droping it will start marking barhighs only until the bar highs break highs or fall down completely ?

                thanks
                sumana.m

                Comment


                  #9
                  Yes, just ensure that you use unique Tag Names so that each line is drawn.

                  for(int i = 0; i< 10; i++)
                  {
                  DrawLine("myLine" + CurrentBar + i, 2, Low[0], 0, Low[0], Color.Red);
                  }
                  Cal H.NinjaTrader Customer Service

                  Comment


                    #10
                    Hi

                    I am really very new to NT.

                    Originally posted by NinjaTrader_Cal View Post
                    Yes, just ensure that you use unique Tag Names so that each line is drawn.

                    for(int i = 0; i< 10; i++)
                    {
                    DrawLine("myLine" + CurrentBar + i, 2, Low[0], 0, Low[0], Color.Red);
                    }
                    not able to code this one.stuck little bit. shared the main code already.can you plz add few lines in that file looking for something like this. check in attached picture

                    thanks to u for these help.
                    Attached Files
                    Last edited by sumana.m; 12-23-2014, 09:30 AM.

                    Comment


                      #11
                      Sumana,

                      The For loop example is to get you started.

                      Inside the loop you would want to look for the conditions you want to check on where to place the Lines.

                      You did not have this in any of the files you have attached. Therefore, you need to check your conditions inside there.

                      Additionally, we do not provide custom coding for NinjaScript items. I would be more than welcome to guide you and provide samples as I have already done.
                      Cal H.NinjaTrader Customer Service

                      Comment


                        #12
                        hi

                        that forloop should start checking from the 1st bar of the chart.any substitute macro defined in ninja ?

                        got error error calling onbar update method on log.
                        PHP Code:
                        #region Using declarations
                        using System;
                        using System.ComponentModel;
                        using System.Diagnostics;
                        using System.Drawing;
                        using System.Drawing.Drawing2D;
                        using System.Xml.Serialization;
                        using NinjaTrader.Cbi;
                        using NinjaTrader.Data;
                        using NinjaTrader.Gui.Chart;
                        #endregion

                        // This namespace holds all indicators and is required. Do not change it.
                        namespace NinjaTrader.Indicator
                        {
                            
                        /// <summary>
                            /// Willium Vix Fix -- Of tuple
                            /// </summary>
                            
                        [Description("Willium Vix Fix -- Of tuple")]
                            public class 
                        WVF Indicator
                            
                        {
                                
                        #region Variables
                                // Wizard generated variables
                                    
                        private int wVF_Period 22// Default setting for WVF_Period
                                    
                        private int stochD_Period 14// Default setting for StochD_Period
                                    
                        private int stochK_Period=7;
                                    private 
                        int CustSmoothing=3;
                                    private 
                        DataSeries        CurVar_DS;
                                    private 
                        DataSeries        CurVar_StochK;
                                
                        // User defined variables (add any user defined variables below)
                                #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.FromKnownColor(KnownColor.Orange), PlotStyle.Line"WVFplot0"));
                                    
                        Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line"StockDplot"));
                                    
                        Overlay                false;
                                    
                        CurVar_DS = new DataSeries(this);
                                    
                        CurVar_StochK=new DataSeries(this);
                                }

                                
                        /// <summary>
                                /// Called on each bar update event (incoming tick)
                                /// </summary>
                                
                        protected override void OnBarUpdate()
                                {
                                    
                        // Use this method for calculating your indicator values. Assign a value to each
                                    // plot below by replacing 'Close[0]' with your own formula.
                                    //CurRSI_DS.Set(RSI(periodRSI,0)[0]);
                                    
                                    
                        double LLV MIN(ClosewVF_Period)[0];
                                    
                        double HHV MAX(ClosewVF_Period)[0];
                                    
                        //WVF = (HHV (Close,22) - Low)/(HHV(Close,22))*100;
                                    
                        CurVar_DS.Set(100*((HHV-Low[0])/HHV));
                                    
                                    
                        //WVFplot0.Set(CurVar_DS[0]);
                                    //StoK.Set(SMA(StoRSI_DS, periodK)[0]);
                                    
                        CurVar_StochK.Set(StochasticsFast(CurVar_DS,stochD_Period,stochK_Period/*,CustSmoothing*/).K[0]);
                                    
                        //CurVar_StochK.Set(Stochastics(CurVar_DS,stochD_Period,2).D[0]);
                                    
                        StockDplot.Set(CurVar_StochK[0]);
                                    
                                    for(
                        int i 0i10i++)
                                    {
                                    
                        DrawLine("myLine" CurrentBar i2Low[0], 0Low[0], Color.Red);
                                    }
                                }

                                
                        #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 WVFplot0
                                
                        {
                                    
                        get { return Values[0]; }
                                }

                                [
                        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 StockDplot
                                
                        {
                                    
                        get { return Values[1]; }
                                }

                                [
                        Description("WVF works with two value 22 and 26")]
                                [
                        GridCategory("Parameters")]
                                public 
                        int WVF_Period
                                
                        {
                                    
                        get { return wVF_Period; }
                                    
                        set wVF_Period Math.Max(22value); }
                                }

                                [
                        Description("")]
                                [
                        GridCategory("Parameters")]
                                public 
                        int StochD_Period
                                
                        {
                                    
                        get { return stochD_Period; }
                                    
                        set stochD_Period Math.Max(1value); }
                                }
                                
                                [
                        Description("")]
                                [
                        GridCategory("Parameters")]
                                public 
                        int StochK_Period
                                
                        {
                                    
                        get { return stochK_Period; }
                                    
                        set stochK_Period Math.Max(1value); }
                                }
                                
                                
                                
                        #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 
                        WVF[] cacheWVF null;

                                private static 
                        WVF checkWVF = new WVF();

                                
                        /// <summary>
                                /// Willium Vix Fix -- Of tuple
                                /// </summary>
                                /// <returns></returns>
                                
                        public WVF WVF(int stochD_Periodint stochK_Periodint wVF_Period)
                                {
                                    return 
                        WVF(InputstochD_PeriodstochK_PeriodwVF_Period);
                                }

                                
                        /// <summary>
                                /// Willium Vix Fix -- Of tuple
                                /// </summary>
                                /// <returns></returns>
                                
                        public WVF WVF(Data.IDataSeries inputint stochD_Periodint stochK_Periodint wVF_Period)
                                {
                                    if (
                        cacheWVF != null)
                                        for (
                        int idx 0idx cacheWVF.Lengthidx++)
                                            if (
                        cacheWVF[idx].StochD_Period == stochD_Period && cacheWVF[idx].StochK_Period == stochK_Period && cacheWVF[idx].WVF_Period == wVF_Period && cacheWVF[idx].EqualsInput(input))
                                                return 
                        cacheWVF[idx];

                                    
                        lock (checkWVF)
                                    {
                                        
                        checkWVF.StochD_Period stochD_Period;
                                        
                        stochD_Period checkWVF.StochD_Period;
                                        
                        checkWVF.StochK_Period stochK_Period;
                                        
                        stochK_Period checkWVF.StochK_Period;
                                        
                        checkWVF.WVF_Period wVF_Period;
                                        
                        wVF_Period checkWVF.WVF_Period;

                                        if (
                        cacheWVF != null)
                                            for (
                        int idx 0idx cacheWVF.Lengthidx++)
                                                if (
                        cacheWVF[idx].StochD_Period == stochD_Period && cacheWVF[idx].StochK_Period == stochK_Period && cacheWVF[idx].WVF_Period == wVF_Period && cacheWVF[idx].EqualsInput(input))
                                                    return 
                        cacheWVF[idx];

                                        
                        WVF indicator = new WVF();
                                        
                        indicator.BarsRequired BarsRequired;
                                        
                        indicator.CalculateOnBarClose CalculateOnBarClose;
                        #if NT7
                                        
                        indicator.ForceMaximumBarsLookBack256 ForceMaximumBarsLookBack256;
                                        
                        indicator.MaximumBarsLookBack MaximumBarsLookBack;
                        #endif
                                        
                        indicator.Input input;
                                        
                        indicator.StochD_Period stochD_Period;
                                        
                        indicator.StochK_Period stochK_Period;
                                        
                        indicator.WVF_Period wVF_Period;
                                        
                        Indicators.Add(indicator);
                                        
                        indicator.SetUp();

                                        
                        WVF[] tmp = new WVF[cacheWVF == null cacheWVF.Length 1];
                                        if (
                        cacheWVF != null)
                                            
                        cacheWVF.CopyTo(tmp0);
                                        
                        tmp[tmp.Length 1] = indicator;
                                        
                        cacheWVF 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>
                                /// Willium Vix Fix -- Of tuple
                                /// </summary>
                                /// <returns></returns>
                                
                        [Gui.Design.WizardCondition("Indicator")]
                                public 
                        Indicator.WVF WVF(int stochD_Periodint stochK_Periodint wVF_Period)
                                {
                                    return 
                        _indicator.WVF(InputstochD_PeriodstochK_PeriodwVF_Period);
                                }

                                
                        /// <summary>
                                /// Willium Vix Fix -- Of tuple
                                /// </summary>
                                /// <returns></returns>
                                
                        public Indicator.WVF WVF(Data.IDataSeries inputint stochD_Periodint stochK_Periodint wVF_Period)
                                {
                                    return 
                        _indicator.WVF(inputstochD_PeriodstochK_PeriodwVF_Period);
                                }
                            }
                        }

                        // This namespace holds all strategies and is required. Do not change it.
                        namespace NinjaTrader.Strategy
                        {
                            public 
                        partial class Strategy StrategyBase
                            
                        {
                                
                        /// <summary>
                                /// Willium Vix Fix -- Of tuple
                                /// </summary>
                                /// <returns></returns>
                                
                        [Gui.Design.WizardCondition("Indicator")]
                                public 
                        Indicator.WVF WVF(int stochD_Periodint stochK_Periodint wVF_Period)
                                {
                                    return 
                        _indicator.WVF(InputstochD_PeriodstochK_PeriodwVF_Period);
                                }

                                
                        /// <summary>
                                /// Willium Vix Fix -- Of tuple
                                /// </summary>
                                /// <returns></returns>
                                
                        public Indicator.WVF WVF(Data.IDataSeries inputint stochD_Periodint stochK_Periodint wVF_Period)
                                {
                                    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.WVF(inputstochD_PeriodstochK_PeriodwVF_Period);
                                }
                            }
                        }
                        #endregion 
                        Last edited by sumana.m; 12-23-2014, 10:07 AM.

                        Comment


                          #13
                          Hello,

                          Thank you for the question.

                          This is because you are referencing bars that are not yet created in the for loop.

                          If you consider on bar 0 you are trying to draw a line that stars 2 bars ago which at this point would be -2 or an invalid index location.

                          You would first need to check that there are enough bars on the chart before drawing or calculating when using BarsAgo values.

                          Here are a few ways to prevent processing until you have enough data.

                          Code:
                          if(CurrentBar < BarsRequired) return;
                          This checks the BarsRequired which is defaulted to 20 bars, alternately you can just use a integer amount like so:
                          Code:
                          if(CurrentBar < 2) return;
                          Both of these will prevent the OnBarUpdate from running past this point, if this statement is above the DrawLine this should prevent the error you are getting.

                          Please let me know if I may be of additional assistance.
                          JesseNinjaTrader Customer Service

                          Comment


                            #14
                            Hi

                            chart i got abit hectic.
                            PHP Code:
                            #region Using declarations
                            using System;
                            using System.ComponentModel;
                            using System.Diagnostics;
                            using System.Drawing;
                            using System.Drawing.Drawing2D;
                            using System.Xml.Serialization;
                            using NinjaTrader.Cbi;
                            using NinjaTrader.Data;
                            using NinjaTrader.Gui.Chart;
                            #endregion

                            // This namespace holds all indicators and is required. Do not change it.
                            namespace NinjaTrader.Indicator
                            {
                                
                            /// <summary>
                                /// Willium Vix Fix -- Of tuple
                                /// </summary>
                                
                            [Description("Willium Vix Fix -- Of tuple")]
                                public class 
                            WVF Indicator
                                
                            {
                                    
                            #region Variables
                                    // Wizard generated variables
                                        
                            private int wVF_Period 22// Default setting for WVF_Period
                                        
                            private int stochD_Period 14// Default setting for StochD_Period
                                        
                            private int stochK_Period=7;
                                        private 
                            int CustSmoothing=3;
                                        private 
                            DataSeries        CurVar_DS;
                                        private 
                            DataSeries        CurVar_StochK;
                                    
                            // User defined variables (add any user defined variables below)
                                    #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.FromKnownColor(KnownColor.Orange), PlotStyle.Line"WVFplot0"));
                                        
                            Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line"StockDplot"));
                                        
                            Overlay                false;
                                        
                            CurVar_DS = new DataSeries(this);
                                        
                            CurVar_StochK=new DataSeries(this);
                                    }

                                    
                            /// <summary>
                                    /// Called on each bar update event (incoming tick)
                                    /// </summary>
                                    
                            protected override void OnBarUpdate()
                                    {
                                        
                            // Use this method for calculating your indicator values. Assign a value to each
                                        // plot below by replacing 'Close[0]' with your own formula.
                                        //CurRSI_DS.Set(RSI(periodRSI,0)[0]);
                                        
                                        
                            double LLV MIN(ClosewVF_Period)[0];
                                        
                            double HHV MAX(ClosewVF_Period)[0];
                                        
                            //WVF = (HHV (Close,22) - Low)/(HHV(Close,22))*100;
                                        
                            CurVar_DS.Set(100*((HHV-Low[0])/HHV));
                                        
                                        
                            //WVFplot0.Set(CurVar_DS[0]);
                                        //StoK.Set(SMA(StoRSI_DS, periodK)[0]);
                                        
                            CurVar_StochK.Set(StochasticsFast(CurVar_DS,stochD_Period,stochK_Period/*,CustSmoothing*/).K[0]);
                                        
                            //CurVar_StochK.Set(Stochastics(CurVar_DS,stochD_Period,2).D[0]);
                                        
                            StockDplot.Set(CurVar_StochK[0]);
                                        
                            //Marking Lows
                                        
                            for(int i 0i10i++)
                                        {
                                            
                            //Rising(CurVar_StochK) ||
                                            
                            if(CurrentBar BarsRequired) return;
                                            if( ( 
                            CurVar_StochK[0]<=20 && CurVar_StochK[0]>=0)){
                                            
                            //if()    
                                        
                            DrawLine("myLine" CurrentBar i8Low[0], 0Low[0], Color.Yellow);
                                            }
                                        }
                                        
                            //Marking Highs
                                        
                            for(int i 0i10i++)
                                        {
                                            if(
                            CurrentBar BarsRequired) return;
                                            if( 
                            CurVar_StochK[0]>=90 && CurVar_StochK[0]<=100){
                                            
                            //if(CurVar_StochK[0]>=90)
                                            
                            DrawLine("myLine2" CurrentBar i8High[0], 0High[0], Color.Red);
                                            }
                                        }
                                    }

                                    
                            #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 WVFplot0
                                    
                            {
                                        
                            get { return Values[0]; }
                                    }

                                    [
                            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 StockDplot
                                    
                            {
                                        
                            get { return Values[1]; }
                                    }

                                    [
                            Description("WVF works with two value 22 and 26")]
                                    [
                            GridCategory("Parameters")]
                                    public 
                            int WVF_Period
                                    
                            {
                                        
                            get { return wVF_Period; }
                                        
                            set wVF_Period Math.Max(22value); }
                                    }

                                    [
                            Description("")]
                                    [
                            GridCategory("Parameters")]
                                    public 
                            int StochD_Period
                                    
                            {
                                        
                            get { return stochD_Period; }
                                        
                            set stochD_Period Math.Max(1value); }
                                    }
                                    
                                    [
                            Description("")]
                                    [
                            GridCategory("Parameters")]
                                    public 
                            int StochK_Period
                                    
                            {
                                        
                            get { return stochK_Period; }
                                        
                            set stochK_Period Math.Max(1value); }
                                    }
                                    
                                    
                                    
                            #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 
                            WVF[] cacheWVF null;

                                    private static 
                            WVF checkWVF = new WVF();

                                    
                            /// <summary>
                                    /// Willium Vix Fix -- Of tuple
                                    /// </summary>
                                    /// <returns></returns>
                                    
                            public WVF WVF(int stochD_Periodint stochK_Periodint wVF_Period)
                                    {
                                        return 
                            WVF(InputstochD_PeriodstochK_PeriodwVF_Period);
                                    }

                                    
                            /// <summary>
                                    /// Willium Vix Fix -- Of tuple
                                    /// </summary>
                                    /// <returns></returns>
                                    
                            public WVF WVF(Data.IDataSeries inputint stochD_Periodint stochK_Periodint wVF_Period)
                                    {
                                        if (
                            cacheWVF != null)
                                            for (
                            int idx 0idx cacheWVF.Lengthidx++)
                                                if (
                            cacheWVF[idx].StochD_Period == stochD_Period && cacheWVF[idx].StochK_Period == stochK_Period && cacheWVF[idx].WVF_Period == wVF_Period && cacheWVF[idx].EqualsInput(input))
                                                    return 
                            cacheWVF[idx];

                                        
                            lock (checkWVF)
                                        {
                                            
                            checkWVF.StochD_Period stochD_Period;
                                            
                            stochD_Period checkWVF.StochD_Period;
                                            
                            checkWVF.StochK_Period stochK_Period;
                                            
                            stochK_Period checkWVF.StochK_Period;
                                            
                            checkWVF.WVF_Period wVF_Period;
                                            
                            wVF_Period checkWVF.WVF_Period;

                                            if (
                            cacheWVF != null)
                                                for (
                            int idx 0idx cacheWVF.Lengthidx++)
                                                    if (
                            cacheWVF[idx].StochD_Period == stochD_Period && cacheWVF[idx].StochK_Period == stochK_Period && cacheWVF[idx].WVF_Period == wVF_Period && cacheWVF[idx].EqualsInput(input))
                                                        return 
                            cacheWVF[idx];

                                            
                            WVF indicator = new WVF();
                                            
                            indicator.BarsRequired BarsRequired;
                                            
                            indicator.CalculateOnBarClose CalculateOnBarClose;
                            #if NT7
                                            
                            indicator.ForceMaximumBarsLookBack256 ForceMaximumBarsLookBack256;
                                            
                            indicator.MaximumBarsLookBack MaximumBarsLookBack;
                            #endif
                                            
                            indicator.Input input;
                                            
                            indicator.StochD_Period stochD_Period;
                                            
                            indicator.StochK_Period stochK_Period;
                                            
                            indicator.WVF_Period wVF_Period;
                                            
                            Indicators.Add(indicator);
                                            
                            indicator.SetUp();

                                            
                            WVF[] tmp = new WVF[cacheWVF == null cacheWVF.Length 1];
                                            if (
                            cacheWVF != null)
                                                
                            cacheWVF.CopyTo(tmp0);
                                            
                            tmp[tmp.Length 1] = indicator;
                                            
                            cacheWVF 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>
                                    /// Willium Vix Fix -- Of tuple
                                    /// </summary>
                                    /// <returns></returns>
                                    
                            [Gui.Design.WizardCondition("Indicator")]
                                    public 
                            Indicator.WVF WVF(int stochD_Periodint stochK_Periodint wVF_Period)
                                    {
                                        return 
                            _indicator.WVF(InputstochD_PeriodstochK_PeriodwVF_Period);
                                    }

                                    
                            /// <summary>
                                    /// Willium Vix Fix -- Of tuple
                                    /// </summary>
                                    /// <returns></returns>
                                    
                            public Indicator.WVF WVF(Data.IDataSeries inputint stochD_Periodint stochK_Periodint wVF_Period)
                                    {
                                        return 
                            _indicator.WVF(inputstochD_PeriodstochK_PeriodwVF_Period);
                                    }
                                }
                            }

                            // This namespace holds all strategies and is required. Do not change it.
                            namespace NinjaTrader.Strategy
                            {
                                public 
                            partial class Strategy StrategyBase
                                
                            {
                                    
                            /// <summary>
                                    /// Willium Vix Fix -- Of tuple
                                    /// </summary>
                                    /// <returns></returns>
                                    
                            [Gui.Design.WizardCondition("Indicator")]
                                    public 
                            Indicator.WVF WVF(int stochD_Periodint stochK_Periodint wVF_Period)
                                    {
                                        return 
                            _indicator.WVF(InputstochD_PeriodstochK_PeriodwVF_Period);
                                    }

                                    
                            /// <summary>
                                    /// Willium Vix Fix -- Of tuple
                                    /// </summary>
                                    /// <returns></returns>
                                    
                            public Indicator.WVF WVF(Data.IDataSeries inputint stochD_Periodint stochK_Periodint wVF_Period)
                                    {
                                        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.WVF(inputstochD_PeriodstochK_PeriodwVF_Period);
                                    }
                                }
                            }
                            #endregion 
                            looking for proper condition to suits with it.
                            Attached Files
                            Last edited by sumana.m; 12-23-2014, 11:38 AM.

                            Comment


                              #15
                              Hello,

                              I am not sure what sort of condition you are looking for specifically.

                              It seems the script is now working without errors, can you please tell me what kind of condition you are looking of to take you out of a bad trade?

                              NinjaTrader does not come with any conditions pre built, you would need to create conditions based on what you are trying to achieve.

                              If you can tell me what exactly you are trying to do I can try to direct you to the correct information.

                              Please let me know if I may be of additional assistance.
                              JesseNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by ghoul, Today, 06:02 PM
                              3 responses
                              14 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by jeronymite, 04-12-2024, 04:26 PM
                              3 responses
                              44 views
                              0 likes
                              Last Post jeronymite  
                              Started by Barry Milan, Yesterday, 10:35 PM
                              7 responses
                              20 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by AttiM, 02-14-2024, 05:20 PM
                              10 responses
                              180 views
                              0 likes
                              Last Post jeronymite  
                              Started by DanielSanMartin, Yesterday, 02:37 PM
                              2 responses
                              13 views
                              0 likes
                              Last Post DanielSanMartin  
                              Working...
                              X