Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MaximumBarsLookBack

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

    MaximumBarsLookBack

    I'm having a problem with dataseries.

    It seems there is a new 'feature' where dataseries only accept to look back for a certain number of bars. And there is a new parameter where you can say 256 or all ... at least thats my understanding.

    So I've set this parameter to Infinite - but I'm still getting this error.




    This is the definition of the DataSeries-Property

    [Browsable(false)]
    [XmlIgnore()]
    public DataSeries SwingHandlerHigh
    {
    get
    {
    Update();
    return SwingHigh;
    }
    }

    How can I prevent this error.

    But by the way - this solution is going to be a potential error source anyway.

    What if you start with a dataseries with about 200 entries and during the day the 256 entry range will be exceeded - and you have built some logic on that - like I do -- you will get an application crash!!!

    I think this construction gives a strategy an unneccessary destabilization potential.

    So it will end up to set all the MaximumBarsLookBack to Infinite and the memory saving effect has gone.

    Why isn't it possible to pass a number of lookbackperiods ?
    Last edited by TheChingachgook; 01-15-2010, 05:35 AM.

    #2
    You probably have a couple of custom data series as well in your indicator. That parameter needed to be applied there as well. Please search this forum for this new parameter. You will find a couple of references which should provide some guidance. Thanks

    Comment


      #3
      Originally posted by NinjaTrader_Dierk View Post
      You probably have a couple of custom data series as well in your indicator. That parameter needed to be applied there as well. Please search this forum for this new parameter. You will find a couple of references which should provide some guidance. Thanks

      Dirk ... I have no custom dataseries in this indicator - and I've got a problem to be fixed.

      Did you ever think that this could be a bug?

      Am I here in a support or in a refuse forum?

      You should be aware that I'm a beta tester here and basically I'm doing a test job for NinjaTrader for free. As I already told you I'm migrating a prospective NT-3rd Party tool - and that is not a Kindergarden tool like most of the others.

      I have to migrate and retest about 60.000 lines of code and believe me this is everything else than funny.

      If I will get always when I have a problem a 'it is your problem' answer, I think this forum is useless for me.

      My system ran in NT6.5 without any bugs - and now I have to deal with basic stuff and I have to find errors where I didn't ever think about that it could be a problem.

      And it should be your job to help when anybody has problems. If you already aware about some solutions of some problems, what does prevent you to at least give me the link to that thread instead of 'rutsch mir den Buckel runter'.

      So never the less - please do your job and help me to get my system migrated, even when something occurs in the undocumented area (because for this system it is neccessary to enter this area), because I want do start my NT-partnership as soon as the NT7 version gets released and I will need a lot of time to get everything tested before.

      Comment


        #4
        Here is some clarification:
        - Your indicator uses custom code which we do not support (like calling base.Initialize() in Initialize()). Obviously I'm not aware of other potentially unsupported code in your NT6.5 indicators. There should be no surprise that unsupported code could break with NT7
        - Nevertheless I pointed you to an issue other users ran into as they had trouble converting their custom indicators and got exact same error.


        This may or may be not applicable to your custom code.

        If this does not help, then I suggest
        a) stripping down your indicator to supported code only and posting it here or sending it to us for further research or
        b) taking any of the standard indicators provided and tweak it using supported concepts only until the issue you experience shows up

        Thanks

        Edit: In case you have not came across yet, then please make sure you reviewed the "code breaking changes" in the beta docs you should have received.

        Comment


          #5
          For clarification:

          MySwingHandler is an inheritance of the class Swing, which is a NinjaTrader-Indicator.

          if a method is defined with 'override' always the method in the inheritated
          class ist going to be called by the operatingsystem....

          If you want to call the initialize method of the superclass you have to call base.Initialze() .... this has nothing to do with supported or unsupported code - this a c# construct and I think in C# it should be possible to use standard C#-constructs like instantiation and inheritance.


          And now I already see what the problem is:

          as I told you MySwinghandler is inheritated from Swing - therfore I have to call the Initialize-Method of Swing - like I do in the MySwinghandler.Initialize() Method.

          -->>

          public class MySwingHandler : Swing
          {
          #region Variables
          // Wizard generated variables
          // 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()
          {
          base.Initialize();

          CalculateOnBarClose = true;
          Overlay = true;
          PriceTypeSupported = false;
          MaximumBarsLookBack = MaximumBarsLookBack.Infinite;
          }


          ... But in the Swing.Initialize() some DataSeries Objects are going to be instantiated ... unfortunately in the default setting (256) and this causes the problem.

          public class Swing : Indicator
          {
          #region Variables
          private double currentSwingHigh = 0;
          private double currentSwingLow = 0;
          private ArrayList lastHighCache;
          private double lastSwingHighValue = 0;
          private ArrayList lastLowCache;
          private double lastSwingLowValue = 0;
          private int saveCurrentBar = -1;
          private int strength = 5;
          private DataSeries swingHighSeries;
          private DataSeries swingHighSwings;
          private DataSeries swingLowSeries;
          private DataSeries swingLowSwings;
          #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.Green, PlotStyle.Dot, "Swing high"));
          Add(new Plot(Color.Orange, PlotStyle.Dot, "Swing low"));
          Plots[0].Pen.Width = 2;
          Plots[0].Pen.DashStyle = DashStyle.Dot;
          Plots[1].Pen.Width = 2;
          Plots[1].Pen.DashStyle = DashStyle.Dot;

          lastHighCache = new ArrayList();
          lastLowCache = new ArrayList();

          swingHighSeries = new DataSeries(this);
          swingHighSwings = new DataSeries(this);
          swingLowSeries = new DataSeries(this);
          swingLowSwings = new DataSeries(this);

          DisplayInDataBox = false;
          CalculateOnBarClose = true;
          PaintPriceMarkers = false;
          Overlay = true;
          }


          So I think this is going to be an issue for the develoment team. This has nothing to do with inheritance. If I would use the Swing-Indicator itself I also would come into the same troubles because all the swing-series are instatiated with a 256 default lookback number.

          The Swing-Indicator can be used to determine relative Highs and lows in different granularities. This is a very cool thing and in my system it is used to find support and resitance lines e.g. for targets or for entries.

          If you would like to find major relative Highs and Lows you sometimes have to look back more than this number to find the first. I'm using 700 barsBack to find something usefull.

          And if the lookbar-Bars are restricted to 256 the indicator is simply useless.

          Believe me, the LookBack-restriction will cause a lot of problems for you in the future and the people will set this property to infinite whereever they can, to avoid to run into problems.

          Please pass this thread to the development team - they really should think about another solution if the aim is to save memory - in the moment it should be still possible.

          The current solution only causes problems - because this is everything else than save code - and will not help at the end.
          Last edited by TheChingachgook; 01-15-2010, 07:40 AM.

          Comment


            #6
            Thanks for your analysis.

            All standard NT7 indicators go by the 256 setting by default to save memory. This could be "overwritten" as the user adds a strategy/indicator by the UI. So, it won't be any issue for users going with the supported concepts of NT only.
            Also: Hosted data series as well as hosted indicators would inherit the setting from their host.

            The inheritance you're using is not supported nor was it ever. However, here are some hints. Obviously it's important to tell the base class to use the Infinite setting. You could try e.g.
            - to set Infinite before calling base.Initialize()
            - worst case copy&paste the Swing code

            I have not tested any of the approaches above, but that what I would try first.

            I'll let you know if anything else would come to my mind.

            Comment


              #7
              Please hold off further research for now. I'm looking into something and will get back to you.

              Comment


                #8
                Dierk ...

                @The inheritance you're using is not supported nor was it ever.

                -->> As I have already mentioned in my previons posting:

                "So I think this is going to be an issue for the develoment team. This has nothing to do with inheritance. If I would use the Swing-Indicator itself I also would come into the same troubles because all the swing-series are instatiated with a 256 default lookback number."


                @ This could be "overwritten" as the user adds a strategy/indicator by the UI.
                -->> I'm talking here about strategy development - which is a major part of NinjaTrader - so where can I set the lookBackBars by the UI, when I'm calling an Indicator from an strategy?


                @ - to set Infinite before calling base.Initialize()
                -->> I tried it - but it is obvious that it has no effect
                The code in the Swing-Class would have to look like this

                swingHighSeries = new DataSeries(this, MaximumBarsLookBack);
                swingHighSwings = new DataSeries(this
                , MaximumBarsLookBack);
                swingLowSeries = new DataSeries(this
                , MaximumBarsLookBack);
                swingLowSwings = new DataSeries(this
                , MaximumBarsLookBack);

                if you understand what I mean. Currently even the MaximumBarsLookBack in the Swing-class has no effect!!!!


                @- worst case copy&paste the Swing code
                I think I can't take this statement serious ...

                Comment


                  #9
                  >> Also: Hosted data series as well as hosted indicators would inherit the setting from their host.
                  My statement below was incorrect in the marked section as there was a bug which will be fixed with next update. This should resolve your issue provided your hosting indicator is set to "Infinite". Thanks for pointing that out.

                  >> so where can I set the lookBackBars by the UI, when I'm calling an Indicator from an strategy?
                  In the UI of the hosting strategy.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  636 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  366 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  107 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  568 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  571 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X