Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Programmatically Trigger ATM Strategy Selection

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

    Programmatically Trigger ATM Strategy Selection

    Hello,

    I'm developing an AddOn for NinjaTrader 8 that adds a custom button panel to the ChartTrader interface. The panel displays ATM strategy templates (from My Documents\NinjaTrader 8\templates\AtmStrategy), and my goal is to programmatically trigger the ATM strategy change when a button is clicked.

    Here's what I've tried so far:
    • Reflection: I use reflection to access the ChartTrader control and set its SelectedAtmStrategyTemplate property.
    • UI Event Simulation: I then search the ChartTrader visual tree for the ATM strategy dropdown (a ComboBox/Selector) and attempt to simulate a user selection by setting its SelectedIndex and raising a SelectionChanged event.
    Although I can update the dropdown's selection, the internal logic that applies the ATM strategy isn’t triggered—orders continue to use the default strategy.

    Has anyone found a supported method or workaround to programmatically trigger the ATM strategy change (perhaps by simulating the required UI event or calling an internal method) so that the selected strategy is fully applied?

    Thanks in advance for any guidance!

    #2
    Hello laithsinawi,

    Have you tried simply setting the SelectedAtmStrategy property on the picker control?

    ChartTrader chartTrader = Window.GetWindow(ChartControl.Parent).FindFirst("C hartWindowChartTraderControl") as ChartTrader;

    ​NinjaTrader.Gui.NinjaScript.AtmStrategy.AtmStrate gySelector selector = chartTrader.FindFirst("ChartTraderControlATMStrate gySelector") as NinjaTrader.Gui.NinjaScript.AtmStrategy.AtmStrateg ySelector;

    selector.SelectedAtmStrategy = "strategy name";

    Comment


      #3
      Hi Jesse,

      Thanks for your suggestion. I attempted to set the SelectedAtmStrategy property as recommended using your code sample. However, I encountered a couple of issues:

      Read-Only Property:
      The SelectedAtmStrategy property appears to be read-only, so I couldn’t assign a new value directly. I’ve tried various workarounds (e.g. using reflection to access a nonpublic setter or backing field) but have not been able to trigger the full internal update.

      Internal State Not Updating:
      Even when simulating a selection change (e.g. raising SelectionChanged events and forcing layout updates), the control’s internal state doesn’t persist the new selection as it does when a user makes a selection through the UI. For example, when I select a strategy via my custom add-on, the strategy briefly appears selected, but it reverts or doesn’t apply to order execution.

      Could you please clarify if there’s a supported way to programmatically update the ATM strategy selection so that the internal state is fully updated (and remains active) similar to a manual selection? Any additional details or recommended approaches would be greatly appreciated.

      Thanks for your help.

      Regards,
      Laith​
      Last edited by laithsinawi; 03-28-2025, 04:34 PM.

      Comment


        #4
        Hello laithsinawi,

        After further research it looks like that is currently unsupported. The ATM selector in the platform is designed in a specific way and does not receive input. You could use a string property instead and build a custom type converter to list the ATM template directory, there is a sample of that concept here: https://forum.ninjatrader.com/forum/...es#post1053755

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        557 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        324 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        545 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        547 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X