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

Working With Chart Buttons

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

    Working With Chart Buttons

    I downloaded a sample strategy from the forum which demonstrates how to create a chart button, and then depending on whether it is pressed or not, do something in the code.
    I tested it, (compiled and worked fine), then I did my best to use it to create two buttons, one to suppress the execution of longs, and one to suppress the execution of shorts.

    The code compiles without errors, and works with one problem. Of the two buttons, only one changes it's value when pressed, and when it does, it changes the value of both buttons. So one button doesn't work, and the other button changes the state of both buttons.

    I'm uploading both strategies, the orginal called "Chart Buttons", and my modified strategy called, "STPOTradeWithButtons".

    I'm sure I have some weird logic error but since I don't really know much about the ToolStripButton function and can't find any documentation on it in the help documentation, perhaps you can point me to a correction for this?

    Thanks

    DaveN
    Attached Files

    #2
    Hello daven,

    Thank you for your post.

    Change Line 169 to the following:
    Code:
    tsbtn2Short.Click += new EventHandler(tsbtn2Short_Click);
    You still had tsbtn1Long.Click in place.

    Comment


      #3
      I really appreciate the second set of eyes and intellect finding my bonehead mistake.
      That fixed it, works great now.
      Thanks
      DaveN

      Comment


        #4
        How do I open a new thread please?
        I want to ask a simple question about trendlines & can't find a way to do so?
        Please help, I am new & this forum is not so easy to navigate

        Comment


          #5
          Hello podge507,

          Thank you for your post and welcome to the NinjaTrader Support Forum!

          Please view the video at the following link for instructions on creating a new thread: http://screencast.com/t/lPXGTBWkor

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by bortz, 11-06-2023, 08:04 AM
          47 responses
          1,606 views
          0 likes
          Last Post aligator  
          Started by jaybedreamin, Today, 05:56 PM
          0 responses
          9 views
          0 likes
          Last Post jaybedreamin  
          Started by DJ888, 04-16-2024, 06:09 PM
          6 responses
          19 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by Jon17, Today, 04:33 PM
          0 responses
          6 views
          0 likes
          Last Post Jon17
          by Jon17
           
          Started by Javierw.ok, Today, 04:12 PM
          0 responses
          15 views
          0 likes
          Last Post Javierw.ok  
          Working...
          X