Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Different behavior when enabling strategy through chart vs control center

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

    Different behavior when enabling strategy through chart vs control center

    I have a working strategy that I usually load through the chart panel. Once I have loaded and configure the strategy, I then have two choices to enable it:
    1) In the strategy's configuration window, select the Enable property and then click Apply in the configuration window
    2) Exit the strategy's configuration window without enabling the strategy. Then go to the Strategy tab in the Control Center and click the enable column for row that pertains to the strategy in question

    I have created a string that displays certain parameters and outputs then using Draw.TextFixed(). Since the logic only need to be executed one time, I have added the code to the (State == State.Configure) section.

    If I enable the strategy using option 1, the TextFixed gets displayed for a second but once the strategy is up and running the text gets removed. If I enable the strategy using option 2, the TextFixed gets displayed correctly and it never leaves the chart until I disable the strategy.

    Is there a different behavior for option1 and 2? From what I can tell with option 1, there seems to be two renderings; in the first one I can see the text, but before the strategy gets activated 100% there is a second rendering that deletes my text. Again, this behavior is only specific to option 1.

    #2
    Hello GARZONJ,

    Thanks for your post.

    Between items 1 and 2, there will be a difference in behavior as the script's lifecycle will transverse through State.SetDefaults and State.Configure again when the Strategies dialog is opened on the chart.

    The lifecycle can be observed more closely by printing the State in OnStateChange.

    I recommend using State.DataLoaded for tasks that should be performed once, just before the script starts if you would like these behaviors to be more consistent.

    LifeCycle - https://ninjatrader.com/support/help...fecycle_of.htm

    Please let me know if I can be of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    41 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    124 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    64 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    41 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X