Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Setting StartBarsAgo and EndBarsAgo bug?

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

    Setting StartBarsAgo and EndBarsAgo bug?

    On v7 b15 I am having trouble setting StartBarsAgo and EndBarsAgo accessing a manually drawn regression channel using the following code. Colors, pen widths etc. can be changed but the start and end bar cannot.

    I have not tested this with trendlines etc. but perhaps they may react in a similar manner.

    foreach (IDrawObject draw in DrawObjects)
    {

    if ((draw.Tag.Contains(regChannelTag)) &&draw is IRegressionChannel)
    {
    IRegressionChannel regression = (IRegressionChannel) draw;
    if(regression.DrawType==DrawType.RegressionChannel ) // is this required as well?
    {
    regression.EndBarsAgo = 0 ; // Does not work
    regression.StartBarsAgo = 50 ; // Does not work
    regression.PenUpper.Color = Color.Green ; // Works fine - changes color
    regression.Pen.Width = 5 ; // Works fine - changes width

    }
    }
    }

    Is this a bug? Thanks.
    Last edited by rtrader; 05-22-2010, 09:04 AM.

    #2
    rtrader,

    I suggest you test some easier cases first and then isolate down where the issue may be.

    Start with this and see where the regression channel draws at the beginning of the chart. Look at how it draws on the chart.
    Code:
    if (CurrentBar == 20)
        regCh = DrawRegressionChannel("reg", 5, 0, Color.Blue);
    Then add this and see that the regression channel is now longer than what you saw before signifying startBarsAgo amend worked.
    Code:
    if (CurrentBar == 21)
         regCh.StartBarsAgo = 10;
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Josh -

      What you suggest works but not in the code I included which was derived from example 3 under "DrawObjects" in the Help documentation.

      Why should Pen Colors and widths be changed OK (see my comments against the code) but not the Start and End bars within the same construct? StartBarsAgo and EndBarsAgo can be examined but not set...
      Last edited by rtrader; 05-22-2010, 11:20 AM.

      Comment


        #4
        rtrader,

        I suggest you check if you actually have 50 bars on the chart to make it a feasible setting at that point in time. If you are not at least 50 bars into the chart at the point in time you try to set bars ago to 50, it won't work.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Josh -

          There are thousands of bars on the chart. Setting StartBarsAgo and EndBarsAgo should work but they don't.

          I have modified one of your own indicators - drawobjecttest.zip - to prove that it doesn't work, courtesy of Ray in this thread:



          Your indicator is here:


          Please see attached image. The line color is changed locally and globally but the line is not lengthened to the latest bar - 1.
          Attached Files
          Last edited by rtrader; 05-23-2010, 03:03 AM.

          Comment


            #6
            rtrader,

            The information you have provided in the other thread is different than here. When using manually drawn object it will behave as Ray has stated in the other thread. If you draw the object from the code itself as seen in the example of the code here it will behave the way described here.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Josh -

              I realise that the information in the other thread is different than what I have described here. In the long run I would like to propagate modified indicators across charts - manually drawn initially and purely programatically when Ninja is updated later. But this is later....

              All I have done is extract an indicator that you supplied from a thread that Ray gave me and added only one extra line to illustrate the point that setting EndBarsAgo (ditto StartBarsAgo) to a different value does not change the line length or position either locally or globally.

              You yourself describe in


              how a line color can be changed. I am trying to change the line lengths.

              As per the graphic I attached in my last post I have added the line:

              "globalLine.EndBarsAgo = 1;" after your code "globalLine.Pen.Color = Color.Black".

              In my own code "Line.EndBarsAgo = 1" or any other value doesn't work either.

              Please add the line to your code yourself. It does not work!!
              Attached Files
              Last edited by rtrader; 05-23-2010, 12:24 PM.

              Comment


                #8
                As Ray has already mentioned in the other thread, thank you for the feedback. It is already on our list of requests.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Josh -

                  What do you mean about my feeback that Ray mentioned in the other thread? I didn't have any feedback and nothing was mentioned about startBarsAgo or endBarsAgo in the thread.

                  I have spent quite some time on this but am now getting somewhat frustrated. I think I have been extremely clear and explicit in what I have asked.

                  Although I, along with all your other subscribers, will obviously get the benefit of the new features (including DrawObject) in version 7 and a lot, if not all, of the features are excellent, it is really frustrating to spend time testing something and not get what I think is a reasonable reply to a query. I know you all have a lot going on with many other issues but would really appreciate some clarification on this - I will then leave the topic alone. If I am correct then there is a bug in DrawObject. If not then all well and good. Am I being unreasonable?

                  Ray told me that, at present, it is not possible to *programatically* draW an object on a chart and have it progagated to other charts with later modification from the same indicator. I understand this completely and look forward to this feature in a later release.

                  However, you yourself have demonstrated that it is possible to *manually* draw a user drawn object, propagate it to other charts *manually* but then modify *some* of it's properties programatically - e.g. the color - both locally and globally. I believe that exposing StartBarsAgo and EndBarsAgo and utilising them does not work in this context. They can be examined but not set to a value that changes the position of the object. I would like to use this feature with user drawn objects.

                  Please can you answer the following for me:

                  1) Re. user drawn objects. Did you run your code (that I supplied below) with the extra line to validate or invalidate what I am saying about startBarsAgo or EndBarsAgo? It can't take more than a few minutes as you demonstrated in your thread.

                  2) Do you agree that there may be an issue with setting startBarsAgo / endBarsAgo in *any* context? If so I am quite happy about it as long as I know and that it might be fixed one day.

                  Thanks.

                  P.S. I have now discovered an issue with startTime and endTime which I will post in another thread, so maybe you haven't quite heard the last of me. Have you come across any issues with these two yet?

                  Comment


                    #10
                    rtrader,

                    We are obviously not on the same page. To clear the air, for this thread, disregard everything on the other thread.

                    I will get back to you at a later point in time in regards to startBarsAgo, endBarsAgo.
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      rtrader,

                      The reason programmatically modifying the startBarsAgo and endBarsAgo parameters of manually drawn objects is to prevent any possibility of malicious code.

                      If programmatic access to move or even remove a manually drawn object was allowed it would open up the door for someone to create an indicator that removes someones draw objects without the user knowing why. We would have no way to explain to the customer that it was through malicious indicator/strategy code that does it if the code was hidden behind a compiled assembly.
                      Josh P.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                      0 responses
                      602 views
                      0 likes
                      Last Post Geovanny Suaza  
                      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                      0 responses
                      347 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by Mindset, 02-09-2026, 11:44 AM
                      0 responses
                      103 views
                      0 likes
                      Last Post Mindset
                      by Mindset
                       
                      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                      0 responses
                      560 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by RFrosty, 01-28-2026, 06:49 PM
                      0 responses
                      559 views
                      1 like
                      Last Post RFrosty
                      by RFrosty
                       
                      Working...
                      X