• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Default Drawing Tool Template is Cached

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

    Default Drawing Tool Template is Cached

    Hi there,

    I am making an add-on where I am starting a Drawing Tool from code. I want to start the drawing tool with a specific template. I know there is no supported way to do this, but I came up with what I thought was a pretty good work around.

    I did a test with a Drawing Tool that had no Default.xml template, but did have other templates created via NT8s templating functionality by an end user.
    I started the drawing tool and it just used NT8s default template as expected.
    While NT is still running, I copied the specific template I wanted the Drawing Tool to start with to Default.xml in the Drawing Tools template dir, and then started the drawing tool. It started and I did a drawing on the chart and the drawing had the template I wanted.
    I then deleted the Default.xml I had created and started the drawing tool again, and it just used the default NT template for that tool. Perfect.

    Based on this I thought fantastic, I have a solution. So I then designed an add-on around this functionality. As I was building it I thought to take this further I wanted to check to see if there was a User defined Default.xml, and back that up first, and then restore it after the drawing was completed.

    I did this, but I found that after the first time the Drawing Tool starts with a Default.xml in the Drawing Tools template dir, it caches that copy of the Default.xml for the duration of that NT8 application session. You can delete the Default.xml, and then create a new Default.xml in its place with a different template XML in its content, but when you start the tool again, it still loads the cached Default.xml, not the new content from the file system.

    With NT8 still running I renamed the Template dir and then started the tool and it did revert back to the NT8 default, but when I renamed the Template dir back again and started the tool again, it still used the cached Default, instead of the Default.xml in the template dir.

    So NT8 detects if there is a Default.xml in the template dir, but if it has previously cached the file, it never loads it from the file system again for the duration of that application session, even if the timestamp and content of the file have changed.

    I can't seem to find a way around this. Is there any way I can programmaticly clear the cached Default template or force NT to load it from the file system again?

    Thanks for your time,

    codeOwl
    Last edited by codeowl; 01-21-2018, 02:03 AM.

    #2
    Hello codeOwl,

    Thanks for reporting this behavior.

    I've give shuffling the drawing object template files around manually a test and let you know what I find.

    I appreciate your patience.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Chelsea,

      Thanks for the quick response mate. I understand the caching, it makes sense not to load the file every time, but it would be awesome to programmaticly have some way to tell NT8 to load from the filesystem.

      At the moment when you want to apply a template, you have to:
      1. Click on Drawing Menu.
      2. Click on the Drawing Tool.
      3. Do the Drawing.
      4. Open the Drawing Properties dialogue.
      5. Click on the Template link.
      6. Click on the Load Template link.
      7. Select the Template you want to load.
      8. Click OK on the Template Selection dialogue.
      9. Click OK on the Drawing Properties dialogue.


      As you can appreciate, this can be a very repetitive and time consuming process, and the Drawing Properties dialogue is modal so you are locked out of the chart window once you get to that part, so when the market is moving and it is part of your process, this leaves you at a disadvantage.

      With the Add-On I have built it is a single click to start any Drawing Tool / Template configuration, and you do the drawing with the template already applied, which as you can see, is a massive advantage over the current process. I have all but completed the Add-On, however the one catch is, once Default.xml template has been loaded once, it just uses the cached one every time from then on.

      I think it would be a real win for NinjaTrader users if we had the ability to programmaticly get NT8 to reload the Default.xml template from the filesystem. Even if it was just a flag that we can set and it only affects the next time a drawing tool is started. Then we can just get NT8 to do it when it is relevant and otherwise it works as normal with the caching.

      Thanks for your time,

      codeOwl

      Comment


        #4
        Hello codeowl,

        Thank you for your response.

        There is no means to force the internal cache to release the Default. It will look for a Default and if it sees it it will load it on the first drawing of the object > if you then remove the Default.XML and draw it would not find the template name and therefore revert to the NT default > however if you had renamed another template to Default.XML in the file structure then if will see that there is a file named Default and use the cached version.

        I will check with development but I believe this would be expected with no workaround in which case I will forward this as a feature request.
        Patrick H.NinjaTrader Customer Service

        Comment


          #5
          Patrick,

          Thanks for looking into this mate. If it can't be done, the feature request would probably be:

          - To be able to programmatically start a drawing tool with any template applied.

          And the business case for it would be to reduce this:

          At the moment when you want to apply a template, you have to:
          Click on Drawing Menu.
          Click on the Drawing Tool.
          Do the Drawing.
          Open the Drawing Properties dialogue.
          Click on the Template link.
          Click on the Load Template link.
          Select the Template you want to load.
          Click OK on the Template Selection dialogue.
          Click OK on the Drawing Properties dialogue.

          As you can appreciate, this can be a very repetitive and time consuming process, and the Drawing Properties dialogue is modal so you are locked out of the chart window once you get to that part, so when the market is moving and it is part of your process, this leaves you at a disadvantage.


          Down to a single click, by giving us the ability to build Add-Ons where we can wrap the combinations of drawing tool / template into buttons that will start the drawing tool with that template applied. My approach of swapping out the Default.xml was one way of doing it, but it would be even better if it could just be done from code, and it would only apply to that instance of the drawing tool, as we have no way of knowing when a drawing tool has stopped, so restoring the default is tricky.

          Regards,

          codeOwl.

          Comment


            #6
            Hello codeOwl,

            Thank you for your patience.

            This feature request has been assigned the internal tracking id of SFT-2757.

            Please let me know if you have any questions.
            Patrick H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by swcooke, Today, 02:01 PM
            0 responses
            2 views
            0 likes
            Last Post swcooke
            by swcooke
             
            Started by guidoisot, Today, 01:11 PM
            1 response
            4 views
            0 likes
            Last Post NinjaTrader_PatrickG  
            Started by martyn73, Today, 12:26 PM
            0 responses
            8 views
            0 likes
            Last Post martyn73  
            Started by uday12, Today, 09:45 AM
            0 responses
            6 views
            0 likes
            Last Post uday12
            by uday12
             
            Started by uday12, Today, 08:25 AM
            3 responses
            20 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Working...
            X