Go Back   NinjaTrader Support Forum > Historical Beta Archive > Version 8 Beta

Version 8 Beta Historical archive for NinjaTrader 8 beta.

NinjaTrader
Reply
 
Thread Tools Display Modes
Old 03-13-2016, 07:49 AM   #1
keepsimple
Senior Member
 
Join Date: May 2014
Posts: 118
Thanks: 8
Thanked 5 times in 5 posts
Default 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 at 04:18 AM.
keepsimple is offline  
Reply With Quote
Old 03-14-2016, 09:19 AM   #2
NinjaTrader_ChelseaB
NinjaTrader Customer Service
 
NinjaTrader_ChelseaB's Avatar
 
Join Date: Dec 2012
Location: Denver, CO
Posts: 6,885
Thanks: 113
Thanked 1,459 times in 1,385 posts
Default

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
File Type: zip AddonShell_NT8B8.zip (3.3 KB, 28 views)
NinjaTrader_ChelseaB is offline  
Reply With Quote
The following user says thank you to NinjaTrader_ChelseaB for this post:
Old 03-14-2016, 10:38 AM   #3
keepsimple
Senior Member
 
Join Date: May 2014
Posts: 118
Thanks: 8
Thanked 5 times in 5 posts
Default

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
keepsimple is offline  
Reply With Quote
Old 03-14-2016, 11:51 AM   #4
NinjaTrader_ChelseaB
NinjaTrader Customer Service
 
NinjaTrader_ChelseaB's Avatar
 
Join Date: Dec 2012
Location: Denver, CO
Posts: 6,885
Thanks: 113
Thanked 1,459 times in 1,385 posts
Default

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).
NinjaTrader_ChelseaB is offline  
Reply With Quote
Old 03-14-2016, 12:10 PM   #5
keepsimple
Senior Member
 
Join Date: May 2014
Posts: 118
Thanks: 8
Thanked 5 times in 5 posts
Default

thanks chelsea,

i will work with that. if have any additional questions, i will post back.
keepsimple is offline  
Reply With Quote
Old 09-13-2016, 08:01 AM   #6
NinjaTrader_ChelseaB
NinjaTrader Customer Service
 
NinjaTrader_ChelseaB's Avatar
 
Join Date: Dec 2012
Location: Denver, CO
Posts: 6,885
Thanks: 113
Thanked 1,459 times in 1,385 posts
Default

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
File Type: zip AddonShell_NT8B13.zip (3.3 KB, 20 views)
NinjaTrader_ChelseaB is offline  
Reply With Quote
The following user says thank you to NinjaTrader_ChelseaB for this post:
Old 10-03-2016, 08:29 AM   #7
NinjaTrader_ChelseaB
NinjaTrader Customer Service
 
NinjaTrader_ChelseaB's Avatar
 
Join Date: Dec 2012
Location: Denver, CO
Posts: 6,885
Thanks: 113
Thanked 1,459 times in 1,385 posts
Default

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_NT8B13 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
File Type: zip AddonShell_NT8B13.zip (3.3 KB, 39 views)
File Type: zip AddonShellNoTabs_NT8B13.zip (2.2 KB, 42 views)
NinjaTrader_ChelseaB is offline  
Reply With Quote
Old 01-25-2017, 04:37 PM   #8
NinjaTrader_ChelseaB
NinjaTrader Customer Service
 
NinjaTrader_ChelseaB's Avatar
 
Join Date: Dec 2012
Location: Denver, CO
Posts: 6,885
Thanks: 113
Thanked 1,459 times in 1,385 posts
Default

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.
Last edited by NinjaTrader_ChelseaB; 06-12-2017 at 01:17 PM.
NinjaTrader_ChelseaB is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
NT Window Won't Open iamthacheese210 Platform Technical Support 2 04-17-2012 11:20 PM
open chart window from strategy script? greg814 Strategy Development 3 06-10-2010 07:11 AM
Open the alert window on alerts! Elliott Wave Suggestions And Feedback 1 04-10-2008 04:56 PM
Open Window to pass information to strategy Folls General Development 1 06-20-2007 02:38 PM
found a way to crash strategy trader - leave output window open in optimizer scriabinop23 Platform Technical Support 2 06-06-2007 12:27 AM


All times are GMT -6. The time now is 04:26 PM.

Futures, foreign currency and options trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing ones financial security or lifestyle. Only risk capital should be used for trading and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results. View Full Risk Disclosure.

CFTC Rules 4.41 - Hypothetical or Simulated performance results have certain limitations, unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, such as lack of liquidity. Simulated trading programs in general are also subject to the fact that they are designed with the benefit of hindsight. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.

This website is hosted and operated by NinjaTrader, LLC (“NT”), a software development company which owns and supports all proprietary technology relating to and including the NinjaTrader trading platform. NT is an affiliated company to NinjaTrader Brokerage (“NTB”), which is a NFA registered introducing broker (NFA #0339976) providing brokerage services to traders of futures and foreign exchange products. This website is intended for educational and informational purposes only and should not be viewed as a solicitation or recommendation of any product, service or trading strategy. No offer or solicitation to buy or sell securities, securities derivative or futures products of any kind, or any type of trading or investment advice, recommendation or strategy, is made, given, or in any manner endorsed by any NT affiliate and the information made available on this Web site is not an offer or solicitation of any kind. Specific questions related to a brokerage account should be sent to your broker directly. The content and opinions expressed on this website are those of the authors and do not necessarily reflect the official policy or position of NT or any of its affiliates. 

Vendors along with their websites, products and services, collectively referred to as (“Vendor Content”), are independent persons or companies that are in no manner affiliated with NT or any if its affiliates. NT or any of its affiliates are not responsible for, do not approve, recommend or endorse any Vendor Content referenced on this website and it’s your sole responsibility to evaluate Vendor Content. Please be aware that any performance information provided by a vendor should be considered hypothetical and must contain the disclosures required by NFA Rule 2-29(c). If you are interested in learning more about, or investigating the quality of, any such Vendor Content you must contact the vendor, provider or seller of such Vendor Content. No person employed by, or associated with, NT or any of its affiliates is authorized to provide any information about any such Vendor Content. Visit the CFTC resources for education regarding the industry and signs of fraud.