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

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 PaulMohn, Today, 12:36 PM
    1 response
    14 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by yertle, Yesterday, 08:38 AM
    8 responses
    36 views
    0 likes
    Last Post ryjoga
    by ryjoga
     
    Started by rdtdale, Today, 01:02 PM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Started by alifarahani, Today, 09:40 AM
    3 responses
    17 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by RookieTrader, Today, 09:37 AM
    4 responses
    19 views
    0 likes
    Last Post RookieTrader  
    Working...
    X