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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    43 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    30 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    49 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    38 views
    0 likes
    Last Post CarlTrading  
    Working...
    X