Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Length of lists and associated text objects.

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

    Length of lists and associated text objects.

    I have several Lists, one for each time frame I use.
    I have labels(text objects) associated with the List elements. Lower Highs, Higher Lows etc.
    While I would rather not play with removing items from the List to limit the text objects
    I am thinking that if the number of text objects exceed some number I either remove the first and then add one. There are complications to doing this. Then I thought about if the number was greater than x I would Reposition the first as the next Text object and so on.
    The issue becomes one of considering the Tags. Currently the Tags are a String representation of the Time Frame, the direction, and the list count all which were usefull in debugging. If I start repositioning older objects , rather than deleting the text objects the tags structure would have to change drastically.

    I am unsure of what approach to take if anyone has input I would like to hear it.
    My ultimate goal is to free up the load caused by too many off the screen historical text objects.I have also considered using OnRender to speed the drawing. However last time in NT8 I attempted that, it was crash and burn.

    Thanks.

    #2
    Hello JerryWar,

    Thanks for your post on this subject (excessive tags).

    A simple approach is to use a counter that is set to the maximum objects you want to see. For example

    private int myTextCounter = 1;
    private int myMaxObjects = 100; // limit to 100

    In the OnBarUpdate()

    if (Conditions to draw the text)
    {
    DrawText (this, "text"+myTextCounter,....);
    myTextCounter++;

    if ( myTextCounter >= myMaxObjects)
    {
    myTextCounter = 1; // reset
    }
    }

    When drawing a new object with an existing object name, the older object will be automatically removed, thus limiting you to the latest "n" (100 in the above example) objects. If you make it (myMaxObjects in the example) a public parameter then you can change the number of objects at run time in case you have a particular instance need to see more (or less) objects.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      That was one of the scenario's I spoke of but the "Name" is the "Tag" and the tag is comprised of information that describes its conditions. I cannot use the existing old tag name because it does not define the current conditions encoded into the tag which are used to normally migrate a new text Object. It would seem under this scenario I would have to have a remove operation to, Remove the old Tag and then Create a new one so the program could function as it normally does. The second problem is that your reference to the old text object thru the same counter used to track the number . As I described above I use the tag already for other tracking purposes inherent to the program. That is the crux of my dilemma as I need to somehow accomplish both my ongoing tracking plus counting.
      Maybe I create an FIFO array of tags from 0 to max number of Text objects. That way I can reference the tags as is but on when it does the FIFO operation it removes the last tag( text object). The question starts to become as this gets more and more complicated is does the added code
      operations with Text objects negate the benefit.
      Last edited by JerryWar; 07-27-2017, 09:52 AM.

      Comment


        #4
        Hello JerryWar,

        Thanks for your reply and clarity.

        I can understand where the complexity of what you are doing with the tag names can certainly add to the coding overhead and detract from the benefit of reduction.

        Perhaps other forum members can provide solutions or ideas to assist.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Paul I tried your method for what I thought was a simple case. It turned out not to be so simple.
          UpArrows are different Tools than DownArrows so you can't use the same counter tag. So every tool needs its own counter and not only that the Tags must be appended with some descriptor to delineate it from the other draw tools. So be it. It works however there is one aspect which did not work as I had anticipated.
          Obviously my thinking was incorrect. I was hoping that if I scrolled and did a Ninjascript reload it would use the right end position on the chart as the last bar and date. So I would now see x objects back from the right scroll point on the chart. I know I can go in and change the last date but that does not give me enough resolution and if I change that date I risk the dreaded Multitime frame setstate error so I no longer mess around with days back or End date.

          Bottom line Is there a setting I can use to have it use the right hand chart point as the end load point when I reload Ninjascript ? Or do I have to change the counter max objects thru the indicator U.I if I want to look further back in history ?

          Thanks
          P.S. It is a different behavior that has confused me. This was done, after the update to newest version and I know the indicators are not loading the same with same reference points. i.e. rather than use the right of the screen they are calculating all the way thru till the End of the available data. I will un-install at some point and confirm this.
          Last edited by JerryWar; 07-30-2017, 03:58 PM.

          Comment


            #6
            Hello JerryWar,

            Thanks for your reply.

            I would change the max count in the UI.
            Paul H.NinjaTrader Customer Service

            Comment


              #7
              YOu are not understanding my last comment. Draw tools are operating differently in this new version.
              It used to be if you were scrolled back in time and you reloaded. they would populate up to the right hand Border.Now they populate all the way to the end of data.

              Comment


                #8
                Hello JerryWar,

                Thanks for your reply.

                Draw methods will be processed from the beginning of data until the current bar when loading or reloading Ninjscript. This has always been the case. Perhaps I am misunderstanding your observation. Please feel free to post a test script that demonstrates the issue you are concerned about or perhaps a video to clarify.
                Paul H.NinjaTrader Customer Service

                Comment


                  #9
                  I will have to re install last version to video. Not till this coming weekend.
                  thanks
                  Jerry

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by ScottWalsh, Today, 04:29 PM
                  0 responses
                  5 views
                  0 likes
                  Last Post ScottWalsh  
                  Started by rtwave, 04-12-2024, 09:30 AM
                  2 responses
                  22 views
                  0 likes
                  Last Post rtwave
                  by rtwave
                   
                  Started by tsantospinto, 04-12-2024, 07:04 PM
                  5 responses
                  70 views
                  0 likes
                  Last Post tsantospinto  
                  Started by cre8able, Today, 03:20 PM
                  0 responses
                  7 views
                  0 likes
                  Last Post cre8able  
                  Started by Fran888, 02-16-2024, 10:48 AM
                  3 responses
                  49 views
                  0 likes
                  Last Post Sam2515
                  by Sam2515
                   
                  Working...
                  X