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

Time Controls in Strategy Builder

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

    Time Controls in Strategy Builder

    Hi. I'm looking to create a set of time controls in the Strategy Builder that look something like this:

    Click image for larger version

Name:	image.png
Views:	85
Size:	17.4 KB
ID:	1288244
    Is this possible and is there a tutorial specific to doing this?

    Thanks, Mitch​

    #2

    Hello mmenigma,

    You can do that in the builder. You would need to use the builders inputs and variables page to define Time inputs. When you add inputs there is a Type selector, you can find Time in the list of available options.

    JesseNinjaTrader Customer Service

    Comment


      #3
      Thanks for the reply. I had previously added all the times I needed as you have indicated. However, I need help organizing them as seen in the image I posted. I'd like to have the check box to select the time like there is for Time_1, Time_2 etc.

      Comment


        #4
        Hello mmenigma,

        To make checkboxes you can use a bool user input. You wouldn't be able to put them in a separate category like that image as that would require manual coding. You can order them like the image though, you would add a bool user input first, then the two time inputs and repeat that for the number of times and checkboxes you wanted.

        JesseNinjaTrader Customer Service

        Comment


          #5
          Thanks for the info, I was able to create the times and the check box.
          Click image for larger version

Name:	image.png
Views:	71
Size:	4.7 KB
ID:	1288293


          However, I tried adding them to my ​Conditions as a group, but I don't think it's working correctly as I get the same results in the Analyzer no matter if a time is set or not. Did I add them correctly and in the right place?
          Click image for larger version

Name:	image.png
Views:	73
Size:	10.0 KB
ID:	1288292

          Comment


            #6
            Hello mmenigma,

            It looks like you selected the input for both the left and right side of the condition. On the left side of the condition builder select Time -> Time series and on the right side of the condition select User Input -> YourInputName.
            JesseNinjaTrader Customer Service

            Comment


              #7
              Hi Jesse, I think I did what you instructed but now when I compile, I get a "can't compile" error message. Here's screen shot of what I did.

              ​​Click image for larger version  Name:	image.png Views:	0 Size:	30.5 KB ID:	1288330

              When I view the code in the NinjaScript editor, I have this error message:
              Click image for larger version  Name:	image.png Views:	0 Size:	20.6 KB ID:	1288332
              I deleted TimeSet1 and tried again (On the left side of the condition builder select Time -> Time series and on the right side of the condition select User Input -> YourInputName) and now I get this error.

              Click image for larger version

Name:	image.png
Views:	63
Size:	3.6 KB
ID:	1288335​​

              As an FYI, here's mt input settings:

              Click image for larger version  Name:	image.png Views:	0 Size:	18.9 KB ID:	1288331
              Last edited by mmenigma; 01-26-2024, 07:21 PM.

              Comment


                #8
                Hello mmenigma,

                That is different that what I had suggested. In the image from post 5 you compare the user input time against itself which is why that did not work. You still have that in the new image as well so you still need to fix that.

                To make a time condition you need to compare the current time against your input time.

                In the new image you are trying to compare the current time against your bool which is not valid, you need to select true or false for a bool comparison. To make a bool comparison with an input you would need to select the bool user input on the left of the condition and then select Misc -> True on the right side to know that the user input was true.
                JesseNinjaTrader Customer Service

                Comment


                  #9
                  Thanks Jesse,

                  Is this correct?

                  Click image for larger version

Name:	image.png
Views:	45
Size:	10.1 KB
ID:	1289087

                  Comment


                    #10
                    Hello mmenigma,

                    It looks like you corrected the bottom two conditions but the first condition is still incorrect. You are checking the user input against its self.

                    To check if the user input is true you would need to select the bool user input on the left of the condition and then select Misc -> True on the right side
                    JesseNinjaTrader Customer Service

                    Comment


                      #11
                      I think I get it. Then this should be correct.
                      Click image for larger version

Name:	image.png
Views:	44
Size:	10.0 KB
ID:	1289097

                      Thank you so much for your help. I'm smart in a lot of areas really, but programming, I'm a total idiot.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by jxs_xrj, 01-12-2020, 09:49 AM
                      4 responses
                      3,281 views
                      1 like
                      Last Post jgualdronc  
                      Started by Option Whisperer, Today, 09:55 AM
                      0 responses
                      5 views
                      0 likes
                      Last Post Option Whisperer  
                      Started by geddyisodin, 04-25-2024, 05:20 AM
                      8 responses
                      58 views
                      0 likes
                      Last Post NinjaTrader_Gaby  
                      Started by halgo_boulder, 04-20-2024, 08:44 AM
                      2 responses
                      22 views
                      0 likes
                      Last Post halgo_boulder  
                      Started by mishhh, 05-25-2010, 08:54 AM
                      19 responses
                      6,189 views
                      0 likes
                      Last Post rene69851  
                      Working...
                      X