Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw.TextFixed (?other Draw commands?) has an issue when run from State.Configure.

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

    Draw.TextFixed (?other Draw commands?) has an issue when run from State.Configure.

    There seems to be an issue when one tries to draw from State.Configure, as one would do for example, in order to present a warning and instructions to a user who makes a mistake when loading the indicator. The drawing does not show on the chart when the indicator is first loaded, but does show up if the chart is refreshed while the indicator is already loaded on the chart.

    I have attached a file which demonstrates the issue.

    Here is how to demonstrate the issue.
    1. Attempt to load the indicator. You will notice that the chat indicator panel remains blank.
      If you look in the NinjaTrader Output window, you will see that State.Configure did run (I output a message), the coded Exception was triggered, and the code block that includes the Draw command was run. Yet, the drawing is not on the chart.
    2. Refresh the chart window by hitting F5, and you will see that the Draw.TextFixed() output now appears on the chart.
    I tried it with only Draw.TextFixed() texts, because that was what I was using when I had the problem. I have not tested any of the other Draw() commands.
    Attached Files

    #2
    Hello koganam,

    Thanks for the post.

    That would be expected based on the help guide comment, Drawing objects should not be called from OnStateChange: https://ninjatrader.com/support/help...t8/drawing.htm

    3. Draw methods will not work if they are called from the OnStateChange() method.
    I understand there are some system indicators that do not follow this and use OnStateChange such as the BarTimer, you can try to follow its direction however I would just suggest to use OnBarUpdate here.

    Code:
    if(someCondition)
    {
        Draw.Text()
    } else {
       //run my code
    }

    Please let me know if I may be of additional assistance.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by rjbtrade1, 11-30-2023, 04:38 PM
    2 responses
    75 views
    0 likes
    Last Post DavidHP
    by DavidHP
     
    Started by Stanfillirenfro, Today, 07:23 AM
    3 responses
    12 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by FitSpressoHonest, Today, 09:14 AM
    0 responses
    3 views
    0 likes
    Last Post FitSpressoHonest  
    Started by Davide999, 05-18-2023, 03:55 AM
    4 responses
    557 views
    1 like
    Last Post kcwasher  
    Started by rexsole, Today, 08:39 AM
    2 responses
    8 views
    0 likes
    Last Post NinjaTrader_Erick  
    Working...
    X