• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

open window from strategy

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

    open window from strategy

    Hi,

    i want a strategy to open a window, which contains several tabpages which are supposed to contain several controls when the strategy is applied to a chart.

    what whould be the most practical way to do this, should i prefer to code the window inside the code or should i load an xaml?
    if using a xaml, how and where do i create that, i found some examples of loading xamls, but i could not figure out how those where created.

    could you please give me an example of how i whould do that, opening a window with tabs including items e.g. a button on a tab page when the strategy is being applied and add a short explanation.

    thanks
    Last edited by keepsimple; 03-14-2016, 03:18 AM.

    #2
    Hi keepsimple,

    Thanks for your note.

    I've made an example addon that loads a xaml file.

    Xaml would be the preferred way to go as creating tons of new controls would need a lot more c# code than xaml tags.
    Attached Files
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi, Chelsea,

      first of all thanks for your effort, the window with the tabs and controls is exactly what i was looking for.
      as I want this to be part of strategy, do you want me to call this fromout the strategy code? and is it possible for this to interact with the running strategy?
      sorry for my maybe a little "stupid" questions, but this is for me mostly new territory.

      regards

      Comment


        #4
        Hi keepsimple,

        Where the example I have provided creates a menu item in the New menu that when clicked will launch the window, in your script you add the button to the chart and then trigger the same code to show the window.

        As far as modifying the strategy from the addon, you may be able to pass the instance of the strategy to the to addon when creating a new instance of the addon. The addon will need a property to hold your strategies class. After the new instance of the addon class is made, set the property to the strategy class instance (this).
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          thanks chelsea,

          i will work with that. if have any additional questions, i will post back.

          Comment


            #6
            Hello,

            I've updated this recently to ensure it works with the latest version.

            An important change is using the dispatcher with .InvokeAsync() instead of .BeginInvoke() to prevent thread locking.
            Attached Files
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hello,

              A common question appears to be how to create an addon that does not have a tabs.

              Tabs are created by a TabControl that is added as the Content of the AddonShellWindow.

              In the AddonShell_NT8 this happens on line 110:
              Content = tabControl;

              To remove the tabs the Content of the window should be set to a different wpf control like a Page instead of the TabControl object.

              Attached is the previous version as well as a version that removes the tab control.
              Attached Files
              Last edited by NinjaTrader_ChelseaB; 10-16-2017, 08:53 AM.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Hello NT Community,

                I've created a script that demonstrates opening an Addon window from an indicator, setting a value in the new Addon window, and returning that value to the indicator.

                (edit)
                Updated to load the xaml after the Loaded event has triggered, allowing time for the TargetIndicator to be set should the target's values be used to populate controls in the addon window.

                I've also added an example that loads these values in a property grid instead allowing for a whole class to be passed back and forth.
                Attached Files
                Last edited by NinjaTrader_ChelseaB; 06-12-2017, 12:17 PM.
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Guru73, Yesterday, 02:47 AM
                4 responses
                29 views
                0 likes
                Last Post marcus2300  
                Started by Guru73, Today, 01:35 AM
                0 responses
                1 view
                0 likes
                Last Post Guru73
                by Guru73
                 
                Started by Maxwell123, Today, 12:34 AM
                0 responses
                3 views
                0 likes
                Last Post Maxwell123  
                Started by esquissa, Yesterday, 11:59 PM
                0 responses
                2 views
                0 likes
                Last Post esquissa  
                Started by i2w8am9ii2, Yesterday, 04:41 PM
                1 response
                9 views
                0 likes
                Last Post Lancer
                by Lancer
                 
                Working...
                X