Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Chart Trader List Checkbox

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

    Chart Trader List Checkbox

    Hi i have this checklist in chart trader, the code for checbox in the grid is this

    checkBox1 = new System.Windows.Controls.CheckBox()
    {
    Margin = new Thickness(5,0,5,0),
    Content = "1. Asia Ended",
    FontSize = 12,
    Foreground = Brushes.Black,
    //IsChecked = true,
    };

    I cant find the way to check when state changes, and save the state, some idea?

    Thanks a lot​



    Click image for larger version

Name:	ChartTrader.jpg
Views:	397
Size:	35.5 KB
ID:	1312328

    #2
    Hello mjairg,

    Assign an event handler method to the .IsEnabledChanged event.

    checkBox1.IsEnabledChanged += CheckBox1_IsEnabledChanged;

    private void CheckBox1_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
    {

    }​
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello mjairg and/or Chelsea,

      I'm looking for sample code to create check boxes to my chart trader. The button part I could manage with the code samples available, but sofar the check boxes not yet. Would you be so kind to share the full example code you created to get the check boxes from above? Thanks a lot.

      Comment


        #4
        Hello Ducman_nl,

        There wasn't any script or sample code created for the answer in post # 2.

        This was a direct answer to the question.

        That said, the AddonShell example uses a checkbox you may find helpful.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi Chelsea,

          I have a hard time translating the Addon-Shell sample to some code which adds the check boxes to my Strategy chart Trader. That's why I was looking for an example. A bit like the sample code "SampleWPFModifications" that describes adding the buttons to the chart.

          Comment


            #6
            Hello Ducman_nl,

            Unfortunately, there isn't an example of this I can provide.

            However, similar to adding a button in the SampleWPFModifications example, you can create a new CheckBox object and add this to the ChartTraderGrid ("ChartWindowChartTraderControl").
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hi Chesea,

              Worked it out, thanks for your help.

              Comment


                #8
                Although I got the check boxes on my chart now, I experience the issue that the event handler is not being triggered. This is how I'm testing it:

                protected void CreateWPFControls()
                {
                for (int i = 0; i < 6; i++) chartTraderCustomCheckBoxesArray[i].IsEnabledChanged += ChartTraderCheckBoxMenu_IsEnabledChanged;
                }

                protected void ChartTraderCheckBoxMenu_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
                {
                CheckBox checkBox = sender as CheckBox;
                if (checkBox == chartTraderCustomCheckBoxesArray[0])
                {

                Draw.TextFixed(this, "infobox", "Chart trader custom Check Box 1", TextPosition.BottomLeft, Brushes.Green, new SimpleFont("Arial", 25), Brushes.Transparent, Brushes.Transparent, 100);
                if (checkBox.IsEnabled) Print("checkBox.IsEnabled = " + checkBox.IsEnabled);
                }
                }

                Comment


                  #9
                  Hello Ducman_nl,

                  Are you certain the event is not running?

                  Are you certain the issue is the condition is not evaluating as true?

                  Add print to the top of the event handler logic block.

                  Does the print appear in the output window?

                  Note, to use any series related objects, methods, or properties from a non-data-driven method (like a checkbox .IsEnabledEvent or button .Click event) it is necessary to call TriggerCustomEvent() first. This includes Draw methods which draw over a price series.
                  Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.

                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    Chelsea, I'm quite sure the event is not being triggered. I have put the Print() and Draw() actions at the higest level but nothing happens. I just copied the structure of the Buttons example. Where the Buttons click triggers the Button event, nothing happens when checking or unchecking the CheckBoxes. Maybe you can do a trial?

                    Comment


                      #11
                      Hello Ducman_nl,

                      Thanks for your patience.

                      The IsEnabledChanged is indeed incorrect. The Checked event is actually correct.
                      CheckBoxCheckedTest_NT8.zip
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        Chelsea, thanks a lot. This works as a charme

                        Comment


                          #13
                          Hi mjairg​,
                          Can you share here please the complete code for this checlist for to show in your chart Trader Panel, please.
                          I need the same for checklist in my code.
                          Thank you!!

                          Comment


                            #14
                            Hello gustavobp,

                            Unfortunately, in the support department at NinjaTrader it is against our policy to create, debug, or modify, code or logic for our clients. Further, we do not provide C# programming education services or one on one educational support in our NinjaScript Support department. This is so that we can maintain a high level of service for all of our clients as well as our associates.

                            Through email or on the forum we are happy to answer any specific questions you may have about NinjaScript if you decide to code this yourself. We are also happy to assist with finding resources in our help guide as well as simple examples, and we are happy to assist with guiding you through the debugging process to assist you with understanding unexpected behavior.

                            You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like a list of affiliate consultants who would be happy to create this script or any others at your request or provide one on one educational services.​


                            The test script in post # was intended to demonstrate the CheckBox.Checked event. The test script adds the checkbox to chart trader.
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #15
                              How would i go about changing the check box parameters?
                              If one of my alerts triggered then it checked a certain box

                              thankyou

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              574 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              333 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              101 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              553 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              551 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X