Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Add items to chart menu

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

    Add items to chart menu

    In NT7 I used:
    this.ChartControl.ContextMenuStrip.Items.Insert(id , item);
    To add ToolStripMenuItem to the chart context menu

    Any hint to get this ported to NT8?
    Attached Files

    #2
    Hello,

    I have attached a sample showing one way to do this.

    In this case I have used

    Code:
    ChartControl.ContextMenu.Items
    I look forward to being of further assistance.
    Attached Files
    JesseNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      In this case I have used

      Code:
      ChartControl.ContextMenu.Items
      I look forward to being of further assistance.

      How would you do this for the ContextMenu of a selected drawobject and/or indicator plot?


      -=Edge=-
      NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

      Comment


        #4
        Excellent question.

        It appears that the collection used for the ChartControl.Context.Items is being changed depending on what is selected.

        I am gathering further clairfication on the specifics on the dynamic context menu and what collections etc are being used to populate the items.

        There is likely a better way to add items to specific context menus through the platform with further clarification on where these collections are.

        I look forward to being of further assistance,
        JesseNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Jesse View Post
          Excellent question. I am gathering further clairfication on the specifics on the dynamic context menu and what collections etc are being used to populate the items.,

          Thanks.. Patiently await your solution..


          -=Edge=-
          NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

          Comment


            #6
            Hello,

            It looks like because of the nature of the context menus and how they are being dynamically built, more logic was needed to determine what is being clicked and to subscribe to the ContextMenuOpened and ContextMenuClosed events.

            I have provided a sample below, to test this you would need to do the following:
            • Create a chart
            • Apply the SMA and EMA indicators on the chart.
            • Apply the SampleMultiContextMenu indicator to the same chart.


            Now right click on the chart control and notice no difference, Then right click on each of the indicators lines, you should see that the EMA and SMA both have separate custom context menu items that are added.

            This is simply checking the Type of the first found selected item on the chart which in theory should be what you are clicking, then the type is used as the comparison to determine what menu item is added in the opening event.

            I look forward to being of further assistance.
            Attached Files
            Last edited by NinjaTrader_Jesse; 12-20-2017, 08:42 AM. Reason: updated for 8.0.11.1
            JesseNinjaTrader Customer Service

            Comment


              #7
              Connect hot key to the custom menu item

              Hi

              Code SampleContextMenu.zip work good

              Want to connect hot key to the menu, following:



              seem need to add to Window.InputBindings
              Not sure how this map to the indicator code,

              Any hint will be appreciated

              Comment


                #8
                Hello,

                Thank you for the question.

                Currently there are no documented approaches at adding custom Hotkeys from script as this is currently managed with the Hotkey manager. There is currently a feature request in for further hotkey support in NinjaScript specifically.

                I will look into the sample to see if there is anyway to do what you had provided without using xaml as this example does not utilize xaml. If I can locate anything I will reply back here.


                I look forward to being of further assistance.
                JesseNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by xiinteractive, 04-09-2024, 08:08 AM
                3 responses
                11 views
                0 likes
                Last Post NinjaTrader_Erick  
                Started by Johnny Santiago, 10-11-2019, 09:21 AM
                95 responses
                6,193 views
                0 likes
                Last Post xiinteractive  
                Started by Irukandji, Today, 09:34 AM
                1 response
                3 views
                0 likes
                Last Post NinjaTrader_Clayton  
                Started by RubenCazorla, Today, 09:07 AM
                1 response
                5 views
                0 likes
                Last Post RubenCazorla  
                Started by TraderBCL, Today, 04:38 AM
                3 responses
                25 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Working...
                X