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

Chart Refresh

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

    Chart Refresh

    Hi,

    I saw from another post that if i need to refresh a chart, i could use the below 2 methods:

    1) The object being added and removed is only a step to cause the refresh, because the chart is looking for an object to be removed this would cause a refresh.

    The syntax could be as simple as the following:
    Code:
    Draw.Dot(this, "dummy_dot", false, 0, 0, Brushes.Transparent);
    RemoveDrawObject("dummy_dot");

    OR

    2) using ForceRefresh()
    ---------------------------------------------------------------------------

    Can I check if
    1) I have an active trade running on a strategy and I perform either of the above methods to refresh the chart, will it affect my active trade (meaning disable my strategy)?
    I asked because if I have an active trade running on a strategy and I manually clicked on the "Reload all historical data" to refresh the chart, it would prompt me that my strategy would be disabled.

    Thanks.

    #2
    Hello,
    Thanks for your post.

    You are correct. The OnRender() method frequently runs once the State has reached State.Realtime. There are several events that will cause OnRender() to be re-queued to run again. These events include:

    • OnBarUpdate() event
    • OnConnectionStatusUpdate() event
    • User clicks on the chart
    • Drawing object(s) have been removed from the chart
    • Strategy enabled/disabled on chart
    • ChartTrader enabled/disabled

    You may also use the ForceRefresh() method to re-queue OnRender() again. Although, it should be noted that if one of the above events has occurred since the last call to OnRender(), it would not be necessary to force a refresh. Forcing a refresh when it is not needed can impact your platforms performance, so please be mindful of that when using the ForceRefresh() method.

    Neither using ForceRefresh() or RemoveDrawObject() will cause your strategy to be disabled.

    I am including a link to our help guide documentation for ForceRefresh(), for your convenience.

    ForceRefresh()
    https://ninjatrader.com/support/help...rcerefresh.htm

    Please let me know if you have any further questions.
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      Hi JoshG,

      Thanks for all the information.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by rajendrasubedi2023, Today, 09:50 AM
      1 response
      10 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by geotrades1, Today, 10:02 AM
      0 responses
      3 views
      0 likes
      Last Post geotrades1  
      Started by ender_wiggum, Today, 09:50 AM
      0 responses
      4 views
      0 likes
      Last Post ender_wiggum  
      Started by bmartz, Today, 09:30 AM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_Erick  
      Started by geddyisodin, Today, 05:20 AM
      3 responses
      24 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Working...
      X