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 andrewtrades, Today, 04:57 PM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by chbruno, Today, 04:10 PM
    0 responses
    5 views
    0 likes
    Last Post chbruno
    by chbruno
     
    Started by josh18955, 03-25-2023, 11:16 AM
    6 responses
    436 views
    0 likes
    Last Post Delerium  
    Started by FAQtrader, Today, 03:35 PM
    0 responses
    7 views
    0 likes
    Last Post FAQtrader  
    Started by rocketman7, Today, 09:41 AM
    5 responses
    19 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X