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

Bars Since Entry/Exit

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

    Bars Since Entry/Exit

    When I am using Bars Since Entry/Exit with a numeric value like 2 or 3 in Strategy Builder, the strategy does not take any trades. Why? Isn't Bars since Entry/Exit supposed to prevent it from taking a trade if it is less than number of bars specified?
    Thanks.

    #2
    Hello Trader17,

    This would depend on the condition you created. Can you provide an image of what you have created so I can estimate what the condition should be doing?

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      I just realized it and was about to post an image. Not sure what values I fill on the left. So I left both at zero.
      Thanks.
      Attached Files

      Comment


        #4
        Hello Trader17,

        It is likely the SignalName not being present that is preventing this from working. Did you use an exit order from a condition or the stops and targets section?

        If you used the stops and target sections, you need to fill in the "SignalName" with what you see in the control center order tab name column. A stop loss would need to be "Stop loss" with the same capitalization as what you see in the control center.

        If you used an exit order, you need to specify the same signal name as you did with the exit.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          I did not use stops or targets. Just the opposite signal closing and opening in new direction basically. What is supposed to be filled in the 3 boxes on the left?
          Thank you.

          Comment


            #6
            Hello Trader17,

            The items to fill in can be left at 0's unless you want to use BarsSinceExitExecution in a more advanced way. You can find descriptions of all the items you see here in the help guide. https://ninjatrader.com/support/help...=barssinceexit

            The signal name is what I had explained in the last post. You need to specify which exit you are referring to with the Signal Name. If you had used the set stops and targets or reversed your position, there are specific names for those orders otherwise this is something you customize when you submit the exit. In the control center orders tab, if you look for your exit order and then look in the Name column that will be the name to use here. For a reversal you should see Close position, so you would use Close position matching the capitalization in the Name column exactly.

            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment


              #7
              Got it. I did not fill that name in as I did not know what to put in there.
              Thank you.

              Comment


                #8
                I added the exit name "Close position" to "Bars Since Exit" as seen as seen under the Orders Tab and the strategy took no trades for some reason.
                Thanks.

                Comment


                  #9
                  This is the message I saw in the image. I have plenty of bars on the chart but still got the message. Also if I use Bars since Entry then I use Buy or Sell short and Bars since Exit I will use Close position in the space for exit, correct?
                  Thank you.
                  Attached Files

                  Comment


                    #10
                    Hello Trader17,

                    This is a normal message, this just indicates that your strategy tried to trade before the BarsRequiredToTrade. Bars Required To Trade is a property you set when configuring the strategy in the user interface and defaults to 20 bars. This is found in the "Set up" properties of your strategy when you apply it.

                    Were you able to see the strategy working past the 20 first bars in that test? If the condition is still not working, could you provide an image of what you updated the builder to? Also were your other entries/exits working and could you see that on the chart?

                    I look forward to being of further assistance.

                    JesseNinjaTrader Customer Service

                    Comment


                      #11
                      For some reason even after naming it correctly it did not take any trades.
                      Thanks.

                      Comment


                        #12
                        Hello Trader17,

                        Was that due to the strategy trying to place trades before the 20 bars? That warning would indicate your conditions became true in that test and it was submitting orders. If no orders were submitted and then exited after the 20 bars the BarsSinceExit wouldnt apply to anything.

                        You may try changing the entry condition to be more specific or ensure it occurs after the BarsRequiredToTrade to ensure a entry and exit occur.


                        I look forward to being of further assistance.

                        ​​​​​​​
                        JesseNinjaTrader Customer Service

                        Comment


                          #13
                          I am using On Close of bar and not per tick or trade. Could that be the issue? Also I have way more than 20 bars. I think I test on like a month of data at least. Can you please make a video with a sample strategy and add it in there and see if it works?
                          Thank you.

                          Comment


                            #14
                            Hello Trader17,

                            The Calculate setting will change how the script calculates, but in historical data this has no effect so this would not be related to your problem. This would only affect the strategy in realtime.

                            The warning you had seen in post 9 tells me that your conditions are becoming true but they did so right away before 20 bars. If you are looking at a chart, bar 0 is the leftmost bar and where your script starts processing data. Your conditions became true before the 20th bar which is the reason for that warning. This has nothing to do with the total number of bars you have but when your conditions became true specifically. If they did not become true again after that point, your BarsSinceExitExecution would have nothing to reference as there should be no exits.

                            In regard to a video, because you are also having difficulty with getting any trades at all, we have a video that covers creating a full strategy here: https://youtu.be/HCyt90GAs9k

                            I would suggest starting with creating a basic strategy that enters and exits trades or reverses trades like the video. Once you have a strategy that produces trades beyond the 20 first bars on the chart, you could expand on that with other logic such as BarsSinceExitExecution. Having the entry and exit logic working will be an important requirement before moving to exit based logic. If the exit does not happen that will make it very difficult to debug what is happening further down the line in your logic.

                            Please let me know if I may be of additional assistance.
                            JesseNinjaTrader Customer Service

                            Comment


                              #15
                              Let me try a different simple strategy and see if it works. Will get back to you.
                              Thanks.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by swestendorf, Today, 11:14 AM
                              2 responses
                              5 views
                              0 likes
                              Last Post NinjaTrader_Kimberly  
                              Started by xiinteractive, 04-09-2024, 08:08 AM
                              4 responses
                              12 views
                              0 likes
                              Last Post xiinteractive  
                              Started by Mupulen, Today, 11:26 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post Mupulen
                              by Mupulen
                               
                              Started by Sparkyboy, Today, 10:57 AM
                              1 response
                              5 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by TheMarlin801, 10-13-2020, 01:40 AM
                              21 responses
                              3,917 views
                              0 likes
                              Last Post Bidder
                              by Bidder
                               
                              Working...
                              X