Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Modifications to chart WPF elements and tab considerations

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • NinjaTrader_ChelseaB
    replied
    Hello Goldy,

    Thank you for reporting the behavior.

    I was able to reproduce and I am taking a look.

    Leave a comment:


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


    Click image for larger version

Name:	NT8_Sample WPF Modifications_2020-12-08_150645.jpg
Views:	2347
Size:	136.9 KB
ID:	1131261

    Leave a comment:


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

    Leave a comment:


  • Mindset
    replied
    Originally posted by NinjaTrader_ChelseaB View Post
    Hello 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.
    Hi Chelsea

    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?

    Leave a comment:


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

    Leave a comment:


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

    Leave a comment:


  • amul_shail2020
    replied
    Originally posted by NinjaTrader_ChelseaB View Post
    Hello 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)
    Hi Chelsea,

    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.

    Leave a comment:


  • Unsuitable
    replied
    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!

    Leave a comment:


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

    Leave a comment:


  • Unsuitable
    replied
    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)

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello Unsuitable,

    I do not know how to remove that space.

    I recommend that you try asking on a website for programming C# questions and WPF questions like StackOverflow.

    Leave a comment:


  • Unsuitable
    replied
    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;
    Talking about this specfic space for the icon, https://i.imgur.com/TyuVvD7.png

    Thanks

    Leave a comment:


  • kkc2015
    replied
    Thank you Chelsea. This is the most thorough and useful sample indicator on custom buttons / menu.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello Community,

    Moving forward this will be maintained in the Desktop SDK reference samples and no longer maintained on the forum.
    Desktop SDK: Creating Chart WPF (UI) Modifications from an Indicator


    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 Desktop SDK reference samples and no longer maintained on the forum.
    Desktop SDK: Creating Chart WPF (UI) Modifications from an Indicator
    Attached Files
    Last edited by NinjaTrader_ChelseaB; 08-01-2022, 11:58 AM.

    Leave a comment:


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

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by cmoran13, 04-16-2026, 01:02 PM
0 responses
51 views
0 likes
Last Post cmoran13  
Started by PaulMohn, 04-10-2026, 11:11 AM
0 responses
31 views
0 likes
Last Post PaulMohn  
Started by CarlTrading, 03-31-2026, 09:41 PM
1 response
165 views
1 like
Last Post NinjaTrader_ChelseaB  
Started by CarlTrading, 04-01-2026, 02:41 AM
0 responses
100 views
1 like
Last Post CarlTrading  
Started by CaptainJack, 03-31-2026, 11:44 PM
0 responses
160 views
2 likes
Last Post CaptainJack  
Working...
X