Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Issue with the Draw Text Method

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

    Issue with the Draw Text Method

    We've discovered what appears to be a bug using the Draw Text method to display trade signals. Having changed the default color for adding text to a chart, the color now shows up in indicator plots. It is not possible to change the color plot and we have already tried to restore the text color to it's default setting via the chart properties (Ctrl + T) -> Preset -> Restore. The attached DrawTextTest indicator is what we've used for testing. Please let us know how to correct this issue as it affects various indicators that apply the Draw Text method. Is there a global setting that can be deactivated so that the chosen default text color is not called with the Draw.Text generated signals?
    Attached Files

    #2
    Hello KrisLassen,

    Welcome, and thank you for your post!

    I'm not able to hit this issue on my end. Could you confirm that you are able to hit this issue on the latest version of NinjaTrader 8, R14.2? I may also suggest setting up a clean environment test so we can see if there is maybe an installation issue or a platform issue.

    Upgrade installers can be found here: https://ninjatrader.com/PlatformDirect

    Creating a clean environment can be done by following the steps below:
    1. Close NinjaTrader 8, and rename the "NinjaTrader 8" folder in My Documents to something like: "NinjaTrader 8 OLD"
    2. Uninstall NinjaTrader from the Windows Control Panel and reinstall using the installer from http://ninjatrader.com/PlatformDirect
    3. Add your test script to your new platform and attempt to reproduce the issue. If the issues arises here, could you provide us some clear steps we can take to hit the issue in case there is some detail we are missing?


    If you ever need to switch back to your original platform, you may do so by closing NinjaTrader and swapping the platform folder names.

    For example, Close NinjaTrader and rename the new "NinjaTrader 8" folder to "NinjaTrader 8 NEW" and the "NinjaTrader 8 OLD" folder to "NinjaTrader 8." Then restart the platform. Simply put: NinjaTrader 8 will always load the "NinjaTrader 8" folder in My Documents.

    If the issue goes away after the clean environment test, please let us know if the issue arises again when switching back to your original "NinjaTrader 8" platform folder in My Documents.

    I'll be happy to work with you further on this as needed.
    JimNinjaTrader Customer Service

    Comment


      #3
      I am having an issue that may be related I will send a picture and trace and log files to support referring this thread

      James 108

      Comment


        #4
        Hello James108,

        Thanks for reaching out via email.

        The issue in your email appears to be the same. However, there are factors that are still unknown to cause this issue and we will need a set of steps that we can follow to reproduce the issue from a clean installation using a test script.

        I had advised in email to also test with a blank workspace and to rebuild step by step until the issue arises. That can give us a starting point on where to look. If we can identify a certain indicator or set of indicators that causes this behavior, we could work with that indicator developer to better identify the cause.

        I look forward to being of further assistance.
        JimNinjaTrader Customer Service

        Comment


          #5
          NinjaTrader bug

          Hello Jim,

          I have had at least 10 users with the same problem. There is a fat bug with Draw.Text. All indicators that use Draw.Text are affected.

          I have tried to reproduce the issue on my notebook, but was unable to do so. From now on I will redirect all users with the problem to this thread.

          Also please check, why only the text is affected (it takes the default color selected for drawing text) but not the background color used by Draw.Text.

          Thank you for your help!
          Last edited by Harry; 07-02-2018, 06:33 AM.

          Comment


            #6
            errors

            I am also having errors in drawing red and blue arrows, wants to draw them black?
            Attached Files

            Comment


              #7
              Hello everyone,

              We have not been able to reproduce the behavior using a simple case like the test script provided. Draw.Text does set the brush used for the text color to ChartContol.Properties.ChartText when a drawing tool is created with a null brush, but it is unclear if the issue seen is coming about from a workspace issue or some certain steps to hit the issue.

              My lead and I are reviewing this code to see if there are some scenarios that can be accounted for. I'll update this post of any new findings. In the meantime, if there is any further detail that can be provided to show how exactly this issue can be hit, we could use it when testing and debugging.
              JimNinjaTrader Customer Service

              Comment


                #8
                Hello Jim,

                Thank you for your response.

                I have not been able to reproduce the issue on my machine, but I have seen it on several other machines. What I have seen on these machines:

                - definitely all indicators that use Draw.Text (tried at least four or five indicators including the test indicator from post #1) will not use the forecolor set in the parameter list of Draw.Text
                - the selected color is overridden by the user selected default color for text objects (see Text Properties -> "Color - font")

                Once this has happened all text objects generated by Draw.Text will use the default color instead of the specified color.

                I have not been able to reproduce this behavior. But maybe you have an idea, what may cause the default font color selected for text objects to override the color specified in the parameter list of Draw.Text.
                Last edited by Harry; 07-02-2018, 10:51 AM.

                Comment


                  #9
                  Thank you all for your notes.

                  cshrum, may I ask if you can send us your workspace and the Text template you are using?

                  You can locate the workspace under Documents\NinjaTrader 8\workspaces and the template will be under Documents\NinjaTrader 8\templates\DrawingTool\Text.

                  Please right click on the workspace and template files and select 'Send to' > 'Compressed (zipped) folder'. Please then attach the .zip files to an email to platformsupport[at]ninjatrader[dot]com with 'ATTN: Patrick H' in the subject line and a reference to this thread in the body of the email.

                  I look forward to your response.

                  Comment


                    #10
                    Hello cshrum,

                    We do not seem to have received your files. Were you able to send the workspace and template in an email to platformsupport[at]ninjatrader[dot]com?

                    Originally posted by NinjaTrader_PatrickH View Post
                    Thank you all for your notes.

                    cshrum, may I ask if you can send us your workspace and the Text template you are using?

                    You can locate the workspace under Documents\NinjaTrader 8\workspaces and the template will be under Documents\NinjaTrader 8\templates\DrawingTool\Text.

                    Please right click on the workspace and template files and select 'Send to' > 'Compressed (zipped) folder'. Please then attach the .zip files to an email to platformsupport[at]ninjatrader[dot]com with 'ATTN: Patrick H' in the subject line and a reference to this thread in the body of the email.

                    I look forward to your response.

                    Comment


                      #11
                      Hello Patrick,

                      I have had another user with the same problem today.

                      The DrawTextTest indicator did not plot the text elements in limegreen and red, but used the font color preset via the DEFAULT template for text elements. The user had never changed this color, but it was black. Therefore the test indicator was printing black on black.

                      What is new here is that we found an intermediate fix for the problem.

                      (1) We open a neutral chart without any indicator.
                      (2) We added a text element "TEXT" to the chart.
                      (3) We changed the font color to another color and saved the new settings as DEFAULT template for text elements.
                      (4) Afterwards we added the test indicator and it was working again as expected, drawing limegreen and red text elements with a black background.

                      This points to a corrupted template under DrawingTool Text. When saving a new template the issue disappeared.

                      (5) Afterwards we added a second indicator to the chart, which also uses Draw.Text. This indicator behaved in a different fashion, as it would still print black on black. This indicator had been added to different charts, which seems to have an impact on the problem.
                      (6) To fix the issue with the second indicator

                      - we opened the indicator dialogue box and restored the original presets (lower right corner of the indicator)
                      - then closed all hidden workspaces
                      - then closed all charts in the remaining workspace "Untitled"
                      - saved the empty workspace "Untitled" and shut down NinjaTrader
                      - after a restart of NinjaTrader, we opened a new chart
                      - added a text element and changed the color font of the text element, then saved the new font color as DEFAULT template for text

                      (7) Then we added the second indicator that uses Draw.Text and it also worked as expected.

                      Conclusions:

                      The issue here is that Draw.Text does not use the specified forecolor, but uses the preset default color for text elements instead.

                      At least for the test indicator the issue could be fixed by saving a modified text template under "DEFAULT".

                      For the second indicator that uses Draw.Text it was necessary to restore the indicator template which is stored in the UI file and close all other charts with that indicator added, before the issue disappeared.

                      Comment


                        #12
                        Drawings

                        Hi, just to contribute to that discussion, I do have the very same problem as well. All of a sudden the color of an indicator is changing to black, and does not correct by reentering the template, or the workspace, or reload NT, or even reboot the server.. I got a DrawTextTest indicator from Harry to show the problem.
                        Attached Files

                        Comment


                          #13
                          Hello Harry,

                          Thanks for writing back with that information.

                          It's good to know the root of the issue is due to a faulty template/workspace. We should try to narrow down this cause in the future when other factors become known.

                          To address the issue more immediately, yes there is logic in place to set Draw.Text to ChartControl.Properties.ChartText at line 471 in the DrawingTool. I would like to see if this logic can be improved, but I would need to be able to test using the template/workspace that can hit the issue. The goal will be to confirm if this issue can be avoided without breaking any existing functionality.

                          @Anyone hitting this issue, could you prepare a backup of the NinjaTrader platform that includes everything needed to hit the issue, or a copy of the NinjaTrader 8 platform folder so we can plug it in on our end and test? You may send these to platformsupport [at] ninjatrader [dot] com addressing me in the subject so I can look into it. Please be sure to remove any historical data and other components that would not be needed so the package is as light as possible. You may use a File Sharing service like WeTransfer to transfer the the back up or Documents/NinjaTrader 8/ contents.

                          WeTransfer - https://wetransfer.com/

                          Backup and Restore - https://ninjatrader.com/support/help...p__restore.htm

                          Thanks everyone!
                          Last edited by NinjaTrader_Jim; 07-12-2018, 10:47 AM.
                          JimNinjaTrader Customer Service

                          Comment


                            #14
                            I had another user this morning with the same problem.

                            This is what I did:

                            (1) Open a chart with the test indicator. Text forecolor is black.
                            (2) Remove the test indicator.
                            (3) Add some text with the drawing tool.
                            (4) Change the font color of that text and save the new settings as default template.
                            (5) Add the test indicator again, which now displays correctly.

                            This confirms that the Default template - loacted under Documents -> NinjaTrader 8 -> templates -> DrawingTool -> Text contributes to the problem. I have attached

                            -> the Default.xml file prior to saving the new template (causing the test indicator to print black boxes)
                            -> the Default.xml file after the new font color had been saved (correctly printing green and red triangles)

                            There are only a few differences between the old and the new Default.xml file:


                            Excerpt of old Default.xml file (contributing to the problem):
                            <GlobalWorkspace>LR_OR_PP_VWAP_ZLO-backup</GlobalWorkspace>
                            <IsLocked>false</IsLocked>
                            <PanelIndex>1</PanelIndex>
                            <Tag>Text 5</Tag>
                            <ZOrderType>Normal</ZOrderType>
                            <Alignment>Left</Alignment>
                            <UseChartTextBrushSerialize>true</UseChartTextBrushSerialize>
                            <ManuallyDrawn>true</ManuallyDrawn>
                            <Anchor>
                            <SlotIndex>3186.724365234375</SlotIndex>
                            <DisplayName>Anchor</DisplayName>
                            <IsBrowsable>true</IsBrowsable>
                            <Time>2018-05-23T12:38:37.309</Time>
                            <Price>70.139194139194132</Price>

                            Excerpt of new Default.xml file (after saving the new font color and fixing the problem):
                            <GlobalWorkspace>LR_OR_IKH</GlobalWorkspace>
                            <IsLocked>false</IsLocked>
                            <PanelIndex>0</PanelIndex>
                            <Tag>Text</Tag>
                            <ZOrderType>Normal</ZOrderType>
                            <Alignment>Left</Alignment>
                            <UseChartTextBrushSerialize>false</UseChartTextBrushSerialize>
                            <ManuallyDrawn>true</ManuallyDrawn>
                            <Anchor>
                            <SlotIndex>3033</SlotIndex>
                            <DisplayName>Anchor</DisplayName>
                            <IsBrowsable>true</IsBrowsable>
                            <Time>2018-07-13T03:50:00</Time>
                            <Price>70.386937041156841</Price>
                            The most striking difference is between <UseChartTextBrushSerialize>true</UseChartTextBrushSerialize> and
                            <UseChartTextBrushSerialize>false</UseChartTextBrushSerialize>
                            Attached Files

                            Comment


                              #15
                              Thanks Harry,

                              I wanted to let you know that I have been able to reproduce by placing the test script, placing a user drawn text object, then saving the user drawn text as a template, and then reloading NinjaScripts. This will set UseChartTextBrush as the template default and the NinjaScript drawn text inherits this when we do not expect it to.

                              I have reported this for further review and I will update this post/thread as this develops.

                              EDIT: This issue with NS drawn objects inheriting the Default template has been confirmed as a bug and marked with Ticket ID NTEIGHT-13011. The ticket's number can be found in the Release Notes page of the Help Guide when a new release contains a fix for the issue.

                              Release Notes - https://ninjatrader.com/support/help...ease_notes.htm
                              Last edited by NinjaTrader_Jim; 07-23-2018, 10:11 AM.
                              JimNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by martin70, 03-24-2023, 04:58 AM
                              15 responses
                              114 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by The_Sec, Today, 02:29 PM
                              1 response
                              5 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by jeronymite, 04-12-2024, 04:26 PM
                              2 responses
                              31 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by Mindset, 05-06-2023, 09:03 PM
                              10 responses
                              265 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by michi08, 10-05-2018, 09:31 AM
                              5 responses
                              743 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Working...
                              X