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, 04: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.

    Post #7
    Last edited by NinjaTrader_ChelseaB; 08-27-2020, 04:02 PM.
    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.

            Post #7
            Last edited by NinjaTrader_ChelseaB; 08-27-2020, 04:02 PM.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hello NT Community,

              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.

              (Update September 1st, 2020 - Implemented IWorkspacePersistence to save the inputs with a workspace)

              (Update March 10th, 2021 - Added event handlers for checkboxes and radio buttons)

              AddonShell_NT8.zip
              Last edited by NinjaTrader_ChelseaB; 11-01-2022, 02:06 PM.
              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, 01:17 PM.
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by WeyldFalcon, 08-07-2020, 06:13 AM
                11 responses
                1,422 views
                0 likes
                Last Post jculp
                by jculp
                 
                Started by RubenCazorla, Today, 09:07 AM
                0 responses
                4 views
                0 likes
                Last Post RubenCazorla  
                Started by BarzTrading, Today, 07:25 AM
                2 responses
                29 views
                1 like
                Last Post BarzTrading  
                Started by devatechnologies, 04-14-2024, 02:58 PM
                3 responses
                21 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Started by tkaboris, Today, 08:01 AM
                0 responses
                6 views
                0 likes
                Last Post tkaboris  
                Working...
                X