• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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:

              http://stackoverflow.com/questions/4...item-shortcuts

              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 saeed, Today, 12:32 PM
                3 responses
                23 views
                0 likes
                Last Post NinjaTrader_PatrickG  
                Started by motog4, Today, 11:42 AM
                3 responses
                12 views
                0 likes
                Last Post NinjaTrader_PatrickG  
                Started by derivtrader, Today, 11:20 AM
                5 responses
                26 views
                0 likes
                Last Post derivtrader  
                Started by TAJTrades, Today, 10:34 AM
                1 response
                7 views
                0 likes
                Last Post NinjaTrader_ChrisL  
                Started by timcjpfx, Today, 10:20 AM
                1 response
                6 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Working...
                X