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 RubenCazorla, 08-30-2022, 06:36 AM
    3 responses
    77 views
    0 likes
    Last Post PaulMohn  
    Started by f.saeidi, Yesterday, 12:14 PM
    9 responses
    23 views
    0 likes
    Last Post f.saeidi  
    Started by Tim-c, Today, 03:54 AM
    0 responses
    3 views
    0 likes
    Last Post Tim-c
    by Tim-c
     
    Started by FrancisMorro, Today, 03:24 AM
    0 responses
    4 views
    0 likes
    Last Post FrancisMorro  
    Started by Segwin, 05-07-2018, 02:15 PM
    10 responses
    1,772 views
    0 likes
    Last Post Leafcutter  
    Working...
    X