Please see lines 138 through 142, and lines 145 through 158 in the ChartToolBarCustomMenuExample.
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
-
Hello Chelsea,
so I recreated your ChartToolBarCustomMenuExample. My goal was to create an indicator which will hide / show selected indicators when clicking "your" SubItem1 or SubItem2 (attached indicator can hide / show SMA and EMA). Now it works as expected with one limitation.
I open a new chart, I add indicators to it (SMA, EMA and ChartToolBarHideShowIndi) and everything works fine. When I add new tab and add the same indicators to it, than also everything works as expected. But when I get back to the first tab, than the Menu button disappears. I need to reload the chart to appear the Menu again. And the same when I go to tab 2 and so on.Could you be so kind please to advise me how to change the script to work it on more tabs without reloading a chart?
Thank you,
emunsAttached FilesLast edited by emuns; 10-08-2019, 08:40 AM.
Comment
-
Hello emuns,
I think i'm understanding you are wanting to apply the indicator to multiple tabs.
The check for the automationid is blocking this. That was to prevent multiple menus from appearing.
foreach (System.Windows.DependencyObject item in chartWindow.MainMenu)
if (System.Windows.Automation.AutomationProperties.Ge tAutomationId(item) == "ChartToolbarExampleMenu")
return;
That part would need to be removed.
Chelsea B.NinjaTrader Customer Service
Comment
-
Hello Chelsea and NinjaTrader gurus!
Thanks for those really useful samples, the prompt responses and the general awesomeness!
Currently the various samples appear limited to buttons and menus / combo-boxes. Is it possible to insert other controls such as edit fields, check-boxes or radio-buttons?
In particular in the 'NinjaTrader.Gui.Tools' namespace I see NumericTextBox and NTTextBlock...
Q1: Would the above work to provide a numeric input field and a string input field respectively?
Q2: Are radio-buttons and check-boxes provided as primitives?
Q3: Do the above work in all the contexts you can insert controls (on toolbar, on chart, in the 'Chart Trader' panel)
Q4: Any samples floating around where someone has been able to craft a collection of controls featuring the above controls?
Thanks again for the expert assistance!
Comment
-
Hello JPPoulin,
Yes, for the most part any WPF control can be used and it doesn't have to NinjaTrader tools. I generally use these where possible to try and match the rest of the theme.
NumericTextBox and NTTextBlock I haven't used but they may suit your purposes. I recommend you give them a try.
Radio buttons and checkboxes in WPF are Controls in System.Windows.Controls. Primitives are generally aspects of a control such as the popup of MenuItem.
Below is a public link to Microsoft's documentation on primitives.
https://docs.microsoft.com/en-us/dotnet/api/system.windows.controls.primitives?view=netframework-4.8Contains base classes and controls that are intended to be used as part of other more complex controls.
WPF can generally be inserted anywhere that doesn't cause a WPF error.
The AddonFrameWork basic has a lot of WPF work in it.
Chelsea B.NinjaTrader Customer Service
Comment
-
Awesome, thanks again for the prompt and useful response Chelsea.
I decided to automate Access instead so all instances of my strategy can pull from one form's controls and each instance pull its unique params from an Access table. I also push performance reports and very verbose logging into the many tables I'm designing. Works great!
Comment
-
Hi Chelsea, can you please help me fix an error I encountered. I downloaded (today) and installed your "ChartTraderCustomButtonsExample". Works great! But I wanted to have this button call an existing method in my indicator code when clicked.
I can Draw.Text from the method but get an error with Draw.Ray: "Unhandled exception: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name:index". To keep things simple, I get the same error when I add just one line of code to your indicator ChartTraderCustomButtonsExample. Here is the code snippet starting at line 60.
protected void Button2Click(object sender, RoutedEventArgs e)
{
Draw.TextFixed(this, "infobox", "Button 2 Clicked", TextPosition.BottomLeft, Brushes.DarkRed, new Gui.Tools.SimpleFont("Arial", 25), Brushes.Transparent,
Brushes.Transparent, 100);
Draw.Ray(this, "myRay",false, 5,3200,10,3200,Brushes.Lime, NinjaTrader.Gui.DashStyleHelper.Solid,1); //this is the line I added
ForceRefresh();
}
Any assistance is greatly appreciated.
Comment
-
Hi ChelseaB,
In your code for "ChartCustomSidePanelExample" you use the first buttonGrid for writing text. You made the height = 100 for the text.
Is there a way to update that text block realtime with either changes that I want to report on every bar close or every price change?
Thanks for your epic work with menu and buttons.
Comment
-
Hello ChelseaB,
Thanks for your response - I have the text doing what I wanted now.
One other thing. The panel and buttons are wider than I want, so if I could halve the width of the panel it would be much better for my use case.
I did make these changes to your code - changing the width in this statement from 125 to 60.
chartGrid.ColumnDefinitions.Insert((chartTraderStartColumn + 2), newSystem.Windows.Controls.ColumnDefinition() { Width = newGridLength(125) });
changing the width from 125 to 60 made the panel narrower but it looked like the buttons were not scaling down as if there was some other button width settings or some other scaling parameters.
Could you suggest the best approach for narrowing the right side panel.
Thanks again
Comment
-
Hi ChelseaB,
Please suggest the modifications I can make to your ChartCustomToolBarExample.cs that would only use the top menu item row and not include the left menu item. I don't need the left column menu items and it's currently shifting everything on the chart over by the column width which I want to reclaim. My efforts so far haven't been able to reclaim that left column space.
thanks
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by strategist007, Today, 07:51 PM
|
0 responses
2 views
0 likes
|
Last Post Today, 07:51 PM | ||
Started by StockTrader88, 03-06-2021, 08:58 AM
|
44 responses
3,967 views
3 likes
|
Last Post
by jhudas88
Today, 06:59 PM
|
||
Started by rbeckmann05, Today, 06:48 PM
|
0 responses
4 views
0 likes
|
Last Post
by rbeckmann05
Today, 06:48 PM
|
||
Started by rhyminkevin, Today, 04:58 PM
|
4 responses
55 views
0 likes
|
Last Post
by dp8282
Today, 06:13 PM
|
||
Started by iceman2018, Today, 05:07 PM
|
0 responses
6 views
0 likes
|
Last Post
by iceman2018
Today, 05:07 PM
|
Comment