Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Simple data input form

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

    Simple data input form

    Hi,
    I have an indicator that create a button on the toolbar of chart panel. I have already the method on click().
    I want that when i press the button, ninjatrader show me a simple pop-up/form with a textbox and a datetimepicker and a button, so i can insert data and store it into variables when i click "OK" button on this last form.

    Please, I have no idea how to do that, can you provide a generic sample?

    Thanks

    #2
    Hello Davide999,

    Thanks for your post.

    My colleague Chelsea has posted an example script you could view called SetIndicatorValueFromAddOnWindowExample_NT8 on the forum thread linked below that demonstrates returning information from an addon window to an indicator.

    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Hi,
      I tried; all is fine and works but when i click OK button on the WPF forms to terminate the work, i obtain this error: " Error - calling thread cannot access this object because a different thread owns it"

      Can you check my code and let me know? I tried multiple ways reading on this forum but i can't able to see where is the calling error (i'm using a dispatcher.invoke())

      Thanks
      Attached Files

      Comment


        #4
        Hello Davide999,

        To confirm, are you getting this error with the SetIndicatorValueFromAddOnWindowExample?

        In your script, I am not seeing a dispatcher used to access the ChartControl in the RetreiveValues() method.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hello,
          Yes; so everything is working but when i click OK on the windows form to update a txt files, i obtain this error. txt files is updated but on ninjatrader i get this error a few seconds before that the form is closing because the function is endend at this point.
          How can i use a dipatcher to access the chart control?

          thanks

          Comment


            #6
            Hello Davide999,

            Below is a link to the help guide with sample code.


            Code:
            ChartControl.Dispatcher.InvokeAsync(() =>
            {
            NinjaTrader.Gui.Tools.NTMessageBoxSimple.Show(Window.GetWindow(ChartControl.OwnerChart as DependencyObject),
            "Date succesfully updated into file " + path, "UpdateStartDeltaDate", MessageBoxButton.OK, MessageBoxImage.Information);​
            });
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by CaptainJack, 05-29-2026, 05:09 AM
            0 responses
            213 views
            0 likes
            Last Post CaptainJack  
            Started by CaptainJack, 05-29-2026, 12:02 AM
            0 responses
            126 views
            0 likes
            Last Post CaptainJack  
            Started by charlesugo_1, 05-26-2026, 05:03 PM
            0 responses
            145 views
            0 likes
            Last Post charlesugo_1  
            Started by DannyP96, 05-18-2026, 02:38 PM
            1 response
            229 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 05-11-2026, 05:56 AM
            0 responses
            190 views
            0 likes
            Last Post CarlTrading  
            Working...
            X