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!
See more
See less

Partner 728x90

Collapse

Add a button to a second toolstrip

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

    Add a button to a second toolstrip

    I realise this may not be answerable by Ninja staff but perhaps some kind C# programmer could assist...

    I have successfully added a second toolstrip to my chart and can add all manner of buttons, dropdowns, combis, you name it, no problem.

    What I would like to do is to add the toolstrip by a Base Indicator, then add buttons etc by adding other indicators to the chart (Indicator 1, 2 etc)

    In Indicator 1 I can find the custom toolstrip created by the Base Indicator by cycling through the Chartcontrol.Controls, check if the toolstrip name exists and if it doesn't I will add it. That works great.

    However if it does already exist then I can't figure out how to grab that existing toolstrip so that I can add items via XYZToolStrip.Items.Add(button) .

    Can anyone help please.

    tia

    #2
    Hello I_Quant,
    Thanks for writing in and I am happy to assist you.

    Unfortunately it’s beyond what we could support however you can refer to this post http://ninjatrader.com/support/forum...84&postcount=5

    Please use the control name of the toolstrip which you are using.

    Please let me know if I can assist you any further.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      well JoyDeep I am really upset ....

      that (a) I hadn't figured that out myself or (b) that I didn't discover that post either !

      thanks for (not) helping me :-)

      it works a treat now.

      many thx

      Comment


        #4
        Hello I_Quant,
        Glad to know it works fine now.
        Please let me know if I can assist you any further.
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          I_Quant,

          I'm trying to do something very similar to you. Is there any example code that you can point me to? Ultimately, I want to create my own toolbar, then create custom drawing tools... I'm not sure what's possible and what's not.

          Another question, what's a good way to keep it from adding a new Toolbar each time I refresh the indicator?

          Thanks!
          Daniel

          Comment


            #6
            Hello neoikon,
            It is possible to add another toolbar in the chart window but unfortunately this is beyond what we could support. However you can refer to these posts for further reference:




            To perform any onetime task during start-up of the indicator/strategy we recommend using the OnStartUp event http://www.ninjatrader.com/support/h.../onstartup.htm

            Please let me know if I can assist you any further.
            JoydeepNinjaTrader Customer Service

            Comment


              #7
              Joydeep, thank you for your response.

              I managed to create the ToolStrip, buttons, etc. as I was hoping. (To those reading, make sure you remove these items in the Dispose() function, so not to keep re-adding them when you refresh the indicator)

              Next, I'm looking to initiate a drawing tool from one of these buttons. For example, I'd love to initiate a "line" (F2) with a given Tag, Start Time, and Start Y. How do I do this?

              Also, are there any events I can trigger off of such as when a line is selected or a line is changed?

              Thanks!
              Daniel

              Comment


                #8
                Hello neoikon,
                In NinjaTrader 7 we recommend to use the OnTermination() event to clean up your code instead of using the Dispose() event.


                You can use the DrawLine method to draw a line. http://www.ninjatrader.com/support/h...l?drawline.htm

                However if you are trying to replicate the F2 shortcut key then you can use the SendKeys command. http://msdn.microsoft.com/en-us/libr....sendkeys.aspx But unfortunately this is beyond what could support as it is more of a C# query.

                There may be events in objects of the unsupported ChartControl class which lets you detect changes.

                Please let me know if I can assist you any further.
                JoydeepNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by usazencort, Today, 01:16 AM
                0 responses
                1 view
                0 likes
                Last Post usazencort  
                Started by kaywai, 09-01-2023, 08:44 PM
                5 responses
                603 views
                0 likes
                Last Post NinjaTrader_Jason  
                Started by xiinteractive, 04-09-2024, 08:08 AM
                6 responses
                23 views
                0 likes
                Last Post xiinteractive  
                Started by Pattontje, Yesterday, 02:10 PM
                2 responses
                22 views
                0 likes
                Last Post Pattontje  
                Started by flybuzz, 04-21-2024, 04:07 PM
                17 responses
                230 views
                0 likes
                Last Post TradingLoss  
                Working...
                X