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

Button on toolbar

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

    Button on toolbar

    I wrote this small indicator to create a button on the chart toolbar that allows you toggle show/hide plot executions on the chart.

    But I am having this issue where if NT crashes for any reason, the button does not disappear and when I restart NT there are now 2 buttons there. If I click the new one it works fine, if I click the old one then NT crashes again.

    Screenshot and source code attached.
    Attached Files

    #2
    traderji, unfortunately we could not assist in the debug process of the custom C# tool since it's outside of the scope we can support here - have you tried moving the Initialize() part to OnStartUp() instead?
    BertrandNinjaTrader Customer Service

    Comment


      #3
      traderji,

      In your OnTermination code, one problem I see is that you set your variables to null and then later
      the code refers to them again: toolStrip.Dispose().
      This will cause a NullPointerException in OnTermination which will definitely cause problems

      If changing that does not fix the problem, then I suggest adding print statements to verify you are even
      executing it:
      if (toolStripButton != null)
      {
      Print("Removing Button...");
      toolStrip.Items.RemoveByKey("PASButton");
      Print("Removed Button");
      }

      Also, move the add button logic to OnStartUp.

      -Gary

      Comment


        #4
        buttons Right Click?

        Thanks for button info.
        I'm also trying to use RightClick to control events, not just left click. Any easy way to do this? I did a quick google search, but its a bit over my head.
        Tx,
        SS

        Comment


          #5
          Solved

          I produced a toggle button to show executions without using the Toolbar at all. It is in the elite downloads section of BigMikeTrading Forum.

          Probably NT would want me to stress that this is all unsupported stuff.

          Comment


            #6
            How do we locate your file on BMT elite section?
            Do I just do a user name search with your NT screen name?
            Looking for "button creating" functionality on NT charts....preferrably in C#.
            Trying to design a very cool app for NT, so anyone please let me know.
            Last edited by SpyderTrader; 10-03-2012, 01:02 PM. Reason: adding something

            Comment


              #7
              There are several posts here with sample code.

              I might have then bookmarked at home.


              Originally posted by SpyderTrader View Post
              How do we locate your file on BMT elite section?
              Do I just do a user name search with your NT screen name?
              Looking for "button creating" functionality on NT charts....preferrably in C#.
              Trying to design a very cool app for NT, so anyone please let me know.

              Comment


                #8
                link

                if you are an elite member its located here
                Last edited by Mindset; 10-04-2012, 03:33 AM.

                Comment


                  #9
                  Yup, I love the stuff on BMT, been a member for a while.
                  Thanks, I'll check it out.

                  Comment


                    #10
                    Indicator Show / Hide Toggle

                    Hi,


                    Been using this great utility, which uses a moving average and places a toggle button on the toolbar to show / hide. It is a feature sorely missed on NT7 (hopefully NT8 will put that right).

                    In the meantime could anyone help with using this toggle to control other indicators. Not really sure if it's a "one size fits all" bit of coding but I have not been able to get it to work?

                    Any help would be appreciated !

                    kiteflyer
                    Attached Files

                    Comment


                      #11
                      Originally posted by kiteflyer View Post
                      Hi,


                      Been using this great utility, which uses a moving average and places a toggle button on the toolbar to show / hide. It is a feature sorely missed on NT7 (hopefully NT8 will put that right).

                      In the meantime could anyone help with using this toggle to control other indicators. Not really sure if it's a "one size fits all" bit of coding but I have not been able to get it to work?

                      Any help would be appreciated !

                      kiteflyer
                      You should be able to use the code to do the same for any indicator. The class merely makes the Plots transparent on demand.

                      Comment


                        #12
                        Can this type of button be used on a strategy?

                        Comment


                          #13
                          Yes this type of button can be used in a strategy. I tried it and it works just fine.

                          Comment


                            #14
                            digdigdig

                            Sorry for digging this one out again. Can anybody share the code for this kind of button? I found this one, http://www.ninjatrader.com/support/f...p=15&keyid=447

                            thinking a physical button will be better. Thanks.

                            Originally posted by traderji View Post
                            I wrote this small indicator to create a button on the chart toolbar that allows you toggle show/hide plot executions on the chart.

                            But I am having this issue where if NT crashes for any reason, the button does not disappear and when I restart NT there are now 2 buttons there. If I click the new one it works fine, if I click the old one then NT crashes again.

                            Screenshot and source code attached.

                            Comment


                              #15
                              Originally posted by kiteflyer View Post
                              Hi,


                              Been using this great utility, which uses a moving average and places a toggle button on the toolbar to show / hide. It is a feature sorely missed on NT7 (hopefully NT8 will put that right).

                              In the meantime could anyone help with using this toggle to control other indicators. Not really sure if it's a "one size fits all" bit of coding but I have not been able to get it to work?

                              Any help would be appreciated !

                              kiteflyer
                              Thanks for this utility.
                              I have adapted it for an indicator and it compiles, but my indicator does not show the plot, I use it jut to show some DrawText. I have the button on my taskbar, but it does not currently toggle on and off the DrawText. I think I need to adjust the section of the code below. Any ideas how I should adjust it for DrawText? Thanks!

                              Code:
                              //For toggle
                              			private void hideshow(object s, EventArgs e)
                              			{
                              				if ( show == false ) 
                              				{
                              					Plots[0].Pen = new Pen(Color.Transparent);
                              					show = true;
                              					button.ForeColor = Color.Silver;
                              				}
                              				else
                              				{
                              					Plots[0].Pen = new Pen (PlotColor,1);
                              					show = false;
                              					button.ForeColor = Color.Blue;
                              				}
                              				
                              				ChartControl.ChartPanel.Refresh();
                              				
                              			}

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by cre8able, Today, 03:20 PM
                              1 response
                              9 views
                              0 likes
                              Last Post cre8able  
                              Started by fiddich, Today, 05:25 PM
                              0 responses
                              3 views
                              0 likes
                              Last Post fiddich
                              by fiddich
                               
                              Started by gemify, 11-11-2022, 11:52 AM
                              6 responses
                              804 views
                              2 likes
                              Last Post ultls
                              by ultls
                               
                              Started by ScottWalsh, Today, 04:52 PM
                              0 responses
                              4 views
                              0 likes
                              Last Post ScottWalsh  
                              Started by ScottWalsh, Today, 04:29 PM
                              0 responses
                              7 views
                              0 likes
                              Last Post ScottWalsh  
                              Working...
                              X