Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

unable to change textbox value in addon from triggered event

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

    unable to change textbox value in addon from triggered event

    This is my first attempt at an addon. I want the add on to change the value of a text box after a trade is completed. I started with the NT AddonFramework and modifying it as needed.

    I am able to change the text without issue if I attach the assignment command to a button. In the snippet below, you can see that I'm trying to change the textbox.text whenever a position change results in "flat". The PrintTo works every time as intended. The myPositionSize.Text assignment command works, but ONLY when I'm NOT using an ATM. This is weird because the ATM will print to the output window, it just won't change the text box. There is nothing else in the source set to overwrite the text and there is no default text set in the xaml file. Why would the textbox not change after an ATM flattens the position, but changes the text if I close the position using a market order button?

    private void OnPositionUpdate(object sender, PositionEventArgs e)
    {
    if(e.MarketPosition==MarketPosition.Flat){
    NinjaTrader.Code.Output.Process(nextPositionQty, PrintTo.OutputTab1);
    myPositionSize.Text="test";
    }
    .
    .
    .
    .


    #2
    Hello Chippy,

    Is the condition evaluating as true?

    Is myPositionSize null?

    Are you properly using a Dispatcher to invoke async into the UI thread from the Account.PositionUpdate event thread?
    Chelsea B.NinjaTrader Customer Service

    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