Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

indicator displacement

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

    indicator displacement

    Hello I have the displacements for the VOL and CurrencDayOHL all set to 0 however they are only appearing once 20 bars on a Today5m chart have passed. How can i get these moved over to the start of the day? Here is the chart and the chart setup:

    #2
    Hi tortexal,


    Unfortunately with the indicators you're using this is not possible, in order to do so you would need to modify the code.
    MichaelNinjaTrader Customer Service

    Comment


      #3
      Originally posted by tortexal View Post
      Hello I have the displacements for the VOL and CurrencDayOHL all set to 0 however they are only appearing once 20 bars on a Today5m chart have passed. How can i get these moved over to the start of the day? Here is the chart and the chart setup:
      It is not displacement here we are talking about. It is a minimum bar requirement.

      Comment


        #4
        Hello,

        When you attach the strategy reduce the Min. bars required field. This may mess up your strategy though, as most indicators and strategies need some minimum bars to operate properly.
        DenNinjaTrader Customer Service

        Comment


          #5
          Thanks for the responses, The strategy is set to a 1 bar requirement simply to offset potential inaccuracies of the first bar printed due to a difference in local system time and my IB feed versus actual opening price. However, it won't really have any effect on my strategy based on how the strategy is coded.

          I checked out the manual and it indicates that i should be able to pass an int value to BarsRequired. Since I didn't see BarsRequired as a definable option in the indicator properties window before applying, i tried to hard code it in. However, when i change the line "indicator.BarsRequired = BarsRequired;" to 0 or 1 and recompile as a new separate indicator, it doesn't actually save the 0 or 1 value. Instead it reverts back to the very same "BarsRequired;" value.

          Comment


            #6
            Hello,

            Can you post your code so we can assist you?
            DenNinjaTrader Customer Service

            Comment


              #7
              Sure this is just the stock VOL code. The problem I get is when i change line 76 to an int value. It seems to default back to BarsRequired. Since the VOL code cant be modified directly it has to be saved as something else which i've done

              //
              // Copyright (C) 2006, NinjaTrader LLC <www.ninjatrader.com>.
              // 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>
              /// Volume is simply the number of shares (or contracts) traded during a specified time frame (e.g. hour, day, week, month, etc).
              /// </summary>
              [Description("Volume is simply the number of shares (or contracts) traded during a specified time frame (e.g. hour, day, week, month, etc).")]
              public class VOL : Indicator
              {
              /// <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(new Pen(Color.Blue, 2), PlotStyle.Bar, "Volume"));
              Add(new Line(Color.DarkGray, 0, "Zero line"));
              }

              /// <summary>
              /// Called on each bar update event (incoming tick)
              /// </summary>
              protected override void OnBarUpdate()
              {
              Value.Set(Volume[0]);
              }
              }
              }

              #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 VOL[] cacheVOL = null;
              private static VOL checkVOL = new VOL();

              /// <summary>
              /// Volume is simply the number of shares (or contracts) traded during a specified time frame (e.g. hour, day, week, month, etc).
              /// </summary>
              /// <returns></returns>
              public VOL VOL()
              {
              return VOL(Input);
              }

              /// <summary>
              /// Volume is simply the number of shares (or contracts) traded during a specified time frame (e.g. hour, day, week, month, etc).
              /// </summary>
              /// <returns></returns>
              public VOL VOL(Data.IDataSeries input)
              {

              if (cacheVOL != null)
              for (int idx = 0; idx < cacheVOL.Length; idx++)
              if (cacheVOL[idx].EqualsInput(input))
              return cacheVOL[idx];

              VOL indicator = new VOL();
              indicator.BarsRequired = BarsRequired;
              indicator.CalculateOnBarClose = CalculateOnBarClose;
              indicator.Input = input;
              indicator.SetUp();

              VOL[] tmp = new VOL[cacheVOL == null ? 1 : cacheVOL.Length + 1];
              if (cacheVOL != null)
              cacheVOL.CopyTo(tmp, 0);
              tmp[tmp.Length - 1] = indicator;
              cacheVOL = tmp;
              Indicators.Add(indicator);

              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>
              /// Volume is simply the number of shares (or contracts) traded during a specified time frame (e.g. hour, day, week, month, etc).
              /// </summary>
              /// <returns></returns>
              [Gui.Design.WizardCondition("Indicator")]
              public Indicator.VOL VOL()
              {
              return _indicator.VOL(Input);
              }

              /// <summary>
              /// Volume is simply the number of shares (or contracts) traded during a specified time frame (e.g. hour, day, week, month, etc).
              /// </summary>
              /// <returns></returns>
              public Indicator.VOL VOL(Data.IDataSeries input)
              {
              return _indicator.VOL(input);
              }
              }
              }

              // This namespace holds all strategies and is required. Do not change it.
              namespace NinjaTrader.Strategy
              {
              public partial class Strategy : StrategyBase
              {
              /// <summary>
              /// Volume is simply the number of shares (or contracts) traded during a specified time frame (e.g. hour, day, week, month, etc).
              /// </summary>
              /// <returns></returns>
              [Gui.Design.WizardCondition("Indicator")]
              public Indicator.VOL VOL()
              {
              return _indicator.VOL(Input);
              }

              /// <summary>
              /// Volume is simply the number of shares (or contracts) traded during a specified time frame (e.g. hour, day, week, month, etc).
              /// </summary>
              /// <returns></returns>
              public Indicator.VOL VOL(Data.IDataSeries input)
              {
              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.VOL(input);
              }
              }
              }
              #endregion

              Comment


                #8
                That's the wrong place to change BarsRequired. Note the statement before that which says:

                Code:
                [B][COLOR=blue]#region[/COLOR] NinjaScript generated code. Neither change nor remove.[/B]
                [B][COLOR=seagreen]// This namespace holds all indicators and is required. Do not change it.[/COLOR][/B]
                If you want to change the BarsRequired value, it should be changed in the Initialize() method instead.
                Last edited by KBJ; 05-07-2009, 12:21 AM. Reason: Fix typo ("the" instead of "then").

                Comment


                  #9
                  same problem

                  I'm also seeing this 20-bar lag before NT plots VOL bars. Is there any way to fix this?

                  Comment


                    #10
                    One would have to change the VOL indicator to have the following statement:

                    Code:
                    BarsRequired=0;
                    in the Intialize() method.

                    There is no reason for this not to be done, as VOL is not an indicator which depends on there being a certain number of bars extant before it can display a correct result, as some other indicators are, so I hereby request that this change be made to the NinjaTrader supported indicator for 7.0.

                    (It's a one-line change, so please tell me you can squeeze it in! Thanks.)
                    Last edited by KBJ; 10-30-2010, 02:52 PM. Reason: Corrected BarsRequired value to be 0 instead of 1.

                    Comment


                      #11
                      Thanks for the input KBJ, I will forward your request to development...
                      BertrandNinjaTrader Customer Service

                      Comment


                        #12
                        Set the chart property "Show unstable period.." to a value of true. That should have the vol start to plot immediately.
                        RayNinjaTrader Customer Service

                        Comment


                          #13
                          Originally posted by NinjaTrader_Ray View Post
                          Set the chart property "Show unstable period." to a value of true. That should have the vol start to plot immediately.
                          Ray, thanks, that's another good workaround.

                          However, since this option is found on the chart's Properties screen, it affects all indicators on the chart.

                          Not displaying the "unstable" period is useful for indicators like SMA(14) where results cannot be fully calculated until there are at least 14 bars. And this makes sense, since the results for the first 14 bars are only estimated, so in most cases of this type we wouldn't want those "unstable" values to be displayed.

                          But for the VOL indicator which has no properties (and thus no period), there is no unstable period (other than for perhaps the first bar, I don't know - you tell me), so why not make the VOL indicator always display a value (even for the oldest/leftmost bars on the chart), like is done for the price bars?

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by joseph_kuruvilla12, Today, 01:01 AM
                          1 response
                          7 views
                          0 likes
                          Last Post Emma1
                          by Emma1
                           
                          Started by samish18, Today, 04:01 AM
                          1 response
                          4 views
                          0 likes
                          Last Post Emma1
                          by Emma1
                           
                          Started by greenberet, Today, 04:05 AM
                          0 responses
                          2 views
                          0 likes
                          Last Post greenberet  
                          Started by edward_steve12, Today, 03:23 AM
                          0 responses
                          3 views
                          0 likes
                          Last Post edward_steve12  
                          Started by edward_steve12, Today, 02:25 AM
                          0 responses
                          7 views
                          0 likes
                          Last Post edward_steve12  
                          Working...
                          X