• 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

Chart Drawing created from AddOn doesn't redraw after Reload All Historical Data

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

    Chart Drawing created from AddOn doesn't redraw after Reload All Historical Data

    Hi there,

    I have created an AddOn that creates a drawing in the chart using an indicator I created. The indicator is very simple and I just use it to refresh the chart after adding the drawing, and as the owner of the drawing.

    I have attached a very simple AddOn/Indicator to demonstrate the issue.

    Replication Steps:
    1. Import AddOn.
    2. Open chart.
    3. Add "Test_Indicator" to chart.
    4. Press "Create Drawing" button in add-on panel .
    5. Right click on chart and select "Reload All Historical Data" from the context menu.


    You will see after doing this the drawing disappears and is not redrawn.
    This also happens when a data connection is made too. Like if you create the drawing using the Create Drawing button before NT connects to its data source, then when it does the drawing will disappear.

    This behavior does not happen with user drawn chart objects. If you follow the steps above, but instead of creating the drawing using the AddOn button, you use the X Region drawing tool, the drawing does not disappear.

    How can I prevent drawings created with the AddOn from disappearing when the chart data is reloaded.

    Thanks for your time.
    Attached Files
    Last edited by codeowl; 01-14-2017, 01:53 AM. Reason: Added some more detail

    #2
    Hello codeowl,

    As a chart is reloaded, any indicators added to the chart would recalculate and then re-draw the drawing objects.
    Any manually drawn objects are saved by the NinjaTrader core and then redrawn.

    In your addon, you would need to detect that the chart was reloaded and then re-draw the drawing objects.
    I'm not aware of any trigger or flag that would detect this, however, you may keep a collection of the drawing objects in the addon and check with a timer to see if these are still on the chart.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      ChelseaB,

      Thanks for the response mate. Instead of a timer, what about if I just put some code in the OnStateChange event of the indicator.
      I have done a test and when I do a reload of historical data or disconnect and reconnect to a datasource the following two states get raised in the following order:

      DataLoaded - All data series have been loaded
      Transition - Finished processing historical data

      Would there be an advantage to redrawing my drawings in one of these states over the other?

      I was thinking DataLoaded as it happens first, is there any reason I should use Transition instead?

      Thanks for your time.
      Last edited by codeowl; 01-17-2017, 02:49 AM. Reason: fixed typo

      Comment


        #4
        Hi codeowl,

        I'm not certain that I understand. Are you moving all drawing to an indicator?
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Vincere, Today, 03:08 AM
        0 responses
        3 views
        0 likes
        Last Post Vincere
        by Vincere
         
        Started by curious, Today, 02:17 AM
        2 responses
        10 views
        0 likes
        Last Post curious
        by curious
         
        Started by pmmkm, Yesterday, 11:13 PM
        0 responses
        3 views
        0 likes
        Last Post pmmkm
        by pmmkm
         
        Started by pulpiwapi, 03-04-2019, 11:18 PM
        11 responses
        152 views
        0 likes
        Last Post music_p13  
        Started by indy73, 06-25-2019, 10:52 PM
        3 responses
        22 views
        0 likes
        Last Post sledge
        by sledge
         
        Working...
        X