Thanks.
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Modifications to chart WPF elements and tab considerations
Collapse
X
-
Hi Chelsea, your "ChartToolBarCustomMenuExample" has been a great starting point from which we can build our own personalized indicators. Any chance you can help me extend its usefulness a bit? I am stuck trying to load the same indicator on two or more tabs of the same chart window (issue: the menu icon is only visible in toolbar of first tab to which indicator is loaded). It would also be helpful to be able to load same indicator two or more times in the same tab and have a separate menu icon corresponding to each.
Thanks.
-
Hello REI140205,
Possibly you could set and look for AutomationID's with strings that have a incremented value.. You could use string.Substring to match the first part of the string, parse the number on the second part of the string, and this would tell you how many times that control has been added to the wpf on that tab. Each time the is added and there is already one existing, you might change the color for the new object.
The ChartToolBarCustomMenuExample shows a little of finding and setting AutomationIds.Chelsea B.NinjaTrader Customer Service
Comment
-
Hello Community,
Moving forward this will be maintained in the help guide reference samples and no longer maintained on the forum.
Creating Chart WPF (UI) Modifications from an Indicator - https://ninjatrader.com/support/help...ui)-modifi.htm
I am uploading an updated version of these scripts that is combined into one example script, with concepts separated by regions.
There are some fixes with the right side panel grid-splitter, and with styling buttons and menus. There are also some important fixes for adding multiple instances to the same tab and to different tabs.
(Old versions can be found on post #1 of this thread)
Update 2020.12.29: changed detecting the current tab, still having errors with the custom DropMenu class setting the menu background color (Popup) when loading from xml
Update 2020.12.31: The ViewBox template was being accessed too early. Moved DropMenu popup border changes to the ViewBox.Loaded event using a WeakEventManager. This fixes the issues with rapidly reloading and when loading from xml. Still having an issue with the TabItems in the TabControl moving.
Update 2021.9.28: Moved CreateWPFControls() to State.Historical as State.DataLoaded is before the ChartControl is completely ready.
Update 2021.10.5: When closing a tab, the ChartControl could be null. Changed the TabSelected() method to return if ChartControl is null.
Update 2021.10.6: Last update on the forums.
!!! There has been a change to the namespace and folder which will cause a duplicate class error. The old version must be removed before attempting to import this new version !!!
(open NinjaScript Editor -> Indicators -> right-click SampleWPFModifications -> Remove)
Moving forward this will be maintained in the help guide reference samples and no longer maintained on the forum.
Creating Chart WPF (UI) Modifications from an Indicator - https://ninjatrader.com/support/help...ui)-modifi.htmAttached FilesLast edited by NinjaTrader_ChelseaB; 08-01-2022, 11:58 AM.Chelsea B.NinjaTrader Customer Service
- Likes 6
Comment
-
Hello ChelseaB,
It seemed relevant to ask the question in this thread. How does one remove the space for the icon for the NTBarMenu if it is not needed? Tried a few things, didn't work. Keep in mind the menuItemGroup is grabbing the mainMenuItemStyle, so we'd have to override the property that makes space for the icon.
Code:NinjaTrader.Gui.Tools.NTMenuItem menuItemGroup = new NinjaTrader.Gui.Tools.NTMenuItem() { Style = mainMenuItemStyle, Header = "Buttons" }; menuItemGroup.Margin = new Thickness(0); menuItemGroup.Padding = new Thickness(0); menuItemGroup.IconRightMarginMultiplier = 0;
Thanks
Comment
-
Did some digging and there may be a way of making a style and stuff. Or one can cheese a solution by setting a negative margin to the menuItem in question. -30 seems to be the right amount of pixels to remove. :P
Code:Margin = new Thickness(-30, 0, 0, 0)
- Likes 1
Comment
-
Although the solution works. the menu is shifted to the left where the icon would be. I asked a question on stack overflow and it got closed. Stackoverflow is a bunch of d!ck5, NinjaTrader development is a better and friendlier forum for questions. GEEZ
Comment
-
For anyone who's looking to make a custom icon using System.Windows.Media.Geometry icon = Geometry.Parse() for the NTMenuBar, that can be achieved by making a SVG file (Inksape or illustrator). By opening up the SVG file in a text editor such as NotePad++, one can grab the path data. Then use Geometry.Parse() to make the icon.
Hope this helps!
- Likes 2
Comment
-
Originally posted by NinjaTrader_ChelseaB View PostHello Community,
I am uploading an updated version of these scripts that is combined into one example script, with concepts separated by regions.
There are some fixes with the right side panel grid-splitter, and with styling buttons and menus. There are also some important fixes for adding multiple instances to the same tab and to different tabs.
Old versions can be found on post #1 of this thread)
Are you able to add a simple logic like (buy when 3 HH and 3HL) on how to place buy/sell orders using the selected ATM strategy from the chart trader when the newly added button is clicked. This would really help to make the example code usable in the real context (for newbie like myself) instead of just showing text printed on the chart when the buttons are clicked.
Looking forward to the updated example script.
Comment
-
Hello amul_shail2020,
Thank you for your post.
Please clarify the condition 'buy when 3 HH and 3HL'. Are you wanting to press a button and then wait for the HH condition to become true?
The SampleWPFModifications script is made simple so that you could use it as a starting point for anything you would like to add. For example, you can combine samples, but working with this level of development will require knowing C# well so you can learn from existing content.
See this forum post that contains a sample script that shows how to get the ATM selector and start a strategy - https://ninjatrader.com/support/foru...egy#post752775
Please note that managing an ATM in a NinjaScript might get pretty involved. You may want to start by looking at the SampleAddon script in the link below that has a full ATM example using the ATM selector WPF Control
SampleAddon - https://ninjatrader.com/support/help...t_overview.htm
Let us know if you have further questions.Brandon H.NinjaTrader Customer Service
Comment
-
That is correct. Go long when 3 bar HH and 3HL condition is met...note this is an example logic. I am more looking forward to getting a working example to submit order when the Button is clicked or when condition is met. The order type can be Buy/Sell Market order using a Profit target /Stop loss prices or pull the Profit Target / Stop loss directly from the ATM template selected from the Chart trader or Super Dom when the button is clicked. Hope this helps.
Comment
-
Originally posted by NinjaTrader_ChelseaB View PostHello Mindset,
Use prints to now when the method is being called, use TraceOrders to know when an order is being ignored or cancelled.
Below is a link to a forum post that demonstrates using prints and TraceOrders to understand behavior.
Enable TraceOrders, then print the time of the bar and all values used in the conditions that place orders.
Save the output to a text file.
Include this with your next post.
I am happy to assist with analyzing the output.
I tried adding TraceOrders as per the help file - I get that it does not exist in the current context?
Is it only available in strategies?
Comment
-
Hello Mindset,
TraceOrders is specific to Strategies and is not available to Indicators or Addons.
Through the addon approach orders would be submitted though Account.Submit().
It would be possible to assign an event handler method to the Account.OrderUpdate event and use NinjaTrader.Code.Output.Process() to print the order information to the output window.
Chelsea B.NinjaTrader Customer Service
Comment
-
Hello Chelsea,
thanks for the exellent work.
I have a problem with the indicator when I use it in window with more then one Tab.
If I restart NT8 there are two menus in the Top Menu from both Tabs.
After clicking the tab everything work fine.
(see attached screen print)
Can that be eliminated?
Thanks for your help in advance
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by rbeckmann05, Yesterday, 06:48 PM
|
1 response
12 views
0 likes
|
Last Post
by bltdavid
Today, 05:43 AM
|
||
Started by llanqui, Today, 03:53 AM
|
0 responses
6 views
0 likes
|
Last Post
by llanqui
Today, 03:53 AM
|
||
Started by burtoninlondon, Today, 12:38 AM
|
0 responses
10 views
0 likes
|
Last Post Today, 12:38 AM | ||
Started by AaronKoRn, Yesterday, 09:49 PM
|
0 responses
15 views
0 likes
|
Last Post
by AaronKoRn
Yesterday, 09:49 PM
|
||
Started by carnitron, Yesterday, 08:42 PM
|
0 responses
11 views
0 likes
|
Last Post
by carnitron
Yesterday, 08:42 PM
|
Comment