• 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

  • keepsimple
    started a topic open window from strategy

    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.

  • NinjaTrader_ChelseaB
    replied
    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.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    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, 09:53 AM.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    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

    Leave a comment:


  • keepsimple
    replied
    thanks chelsea,

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

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    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).

    Leave a comment:


  • keepsimple
    replied
    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

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    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

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by Johnny Santiago, Today, 04:50 AM
1 response
5 views
0 likes
Last Post NinjaTrader_ChrisSch  
Started by rickyblah12, Yesterday, 08:17 PM
1 response
11 views
0 likes
Last Post NinjaTrader_PaulH  
Started by jamarc, Today, 02:30 AM
0 responses
4 views
0 likes
Last Post jamarc
by jamarc
 
Started by mrlucky1x, Yesterday, 08:07 PM
1 response
4 views
0 likes
Last Post NinjaTrader_PaulH  
Started by uday12, Yesterday, 07:21 PM
0 responses
5 views
0 likes
Last Post uday12
by uday12
 
Working...
X