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

How to exit trades at set day of week and time

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

    How to exit trades at set day of week and time

    Just trying to use the Strategy Builder to say exit all open trades on Friday's at 9:45

    #2
    Hello demo166130
    Thanks for your post.

    You could create a time filter and then exit your positions when the time is reached. There is a sample of how to create a time filter inside the Strategy Builder located in our help guide.

    https://ninjatrader.com/support/help...ateTimeFilters

    Even though you are creating this strategy in the Strategy Builder, it may be of help to look at the following code sample. This sample demonstrates how to limit trading hours with a time filter.

    https://ninjatrader.com/support/help...to_limit_t.htm

    Let me know if you have any questions.

    Josh G.NinjaTrader Customer Service

    Comment


      #3
      Thankyou mate

      Comment


        #4
        I'm having a few issues. I've attached what I've done so far, please take a look and let me know your thoughts.
        Attached Files

        Comment


          #5
          demo166130,

          Nothing stands out from what I see here. What seems to be the issue?
          Josh G.NinjaTrader Customer Service

          Comment


            #6
            I watched a trade which entered on a Friday and carried over the weekend meaning the logic hasn't had the intended effect

            Comment


              #7
              demo166130,

              I looked at your screenshots again and I see that your condition that tests for Friday is never going to be true. It looks like you may be comparing Friday to a Time Series instead of a Date Series.

              It should look something like my screenshot to create a condition for Friday.
              Josh G.NinjaTrader Customer Service

              Comment


                #8
                I changed this and it still made no difference. I decided to try and exit trades during lots of times of day and it also made zero difference. The chances that I'm doing something wrong here are far far more likely than there's some weird error in the system. I've attached another image, curious to see what you think.
                Attached Files

                Comment


                  #9
                  demo166130,

                  The field from your screenshot is there because you added another data series.

                  Are you testing this in the Strategy Analyzer?
                  Josh G.NinjaTrader Customer Service

                  Comment


                    #10
                    Yes, is what you just saw looking correct?

                    Comment


                      #11
                      Do I need to use a signal name here?

                      Comment


                        #12
                        demo166130,

                        You do not need to include the signal name in this case.

                        Can you post the .cs file for your strategy here?
                        Josh G.NinjaTrader Customer Service

                        Comment


                          #13
                          Sure, where abouts is the strategy cs file located? I will get it over to you

                          Comment


                            #14
                            demo166130 ,

                            That would be in your \Documents\NinjaTrader 8\bin\Custom\Strategies\ folder
                            Josh G.NinjaTrader Customer Service

                            Comment


                              #15
                              Here you go.
                              Attached Files

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by algospoke, Yesterday, 06:40 PM
                              2 responses
                              18 views
                              0 likes
                              Last Post algospoke  
                              Started by ghoul, Today, 06:02 PM
                              3 responses
                              14 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by jeronymite, 04-12-2024, 04:26 PM
                              3 responses
                              44 views
                              0 likes
                              Last Post jeronymite  
                              Started by Barry Milan, Yesterday, 10:35 PM
                              7 responses
                              20 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by AttiM, 02-14-2024, 05:20 PM
                              10 responses
                              180 views
                              0 likes
                              Last Post jeronymite  
                              Working...
                              X