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

Stop entry after stop loss

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

    Stop entry after stop loss

    Hello
    I could use some assistance regarding using Strategy Builder to stop my strategy from re-entering a trade on the same bar that a stop loss exited the trade on. Thank you.

    #2
    Hello jhjhawkins,

    Thank you for your post.

    You could create a condition group in your entry conditions that checks whether or not it's been at least 1 bar since the last exit:

    Click image for larger version

Name:	2021-12-03_12-47-29.png
Views:	253
Size:	21.5 KB
ID:	1180437

    This will check whether it's either been at least 1 bar since the last exit or that no exits have been submitted yet from the strategy. You can find Bars Since Exit in the Misc folder in the condition builder. Adding this to your conditions for entry would keep the entry from being fired off on the same bar as the prior exit.

    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      BarsSinceExecution = -1, that was what had me. Thank you very much. Just out of curiosity is there a way to make this apply to only Stop Loss exits?

      Comment


        #4
        Hello jhjhawkins,

        Thank you for your reply.

        You can add the Signal Name "Stop loss" for the Bars Since Exit Signal name to tie it to those specific executions if you're using SetStopLoss to make the stop. If a profit target closes the position that'll be more than 1 bar from a Stop Loss anyway.

        Please let us know if we may be of further assistance to you.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Kate View Post
          Hello jhjhawkins,

          Thank you for your reply.

          You can add the Signal Name "Stop loss" for the Bars Since Exit Signal name to tie it to those specific executions if you're using SetStopLoss to make the stop. If a profit target closes the position that'll be more than 1 bar from a Stop Loss anyway.

          Please let us know if we may be of further assistance to you.
          Hi Kate,

          I'm trying the same thing and probably not entering the right things.

          1. Use startegy analyzer and trailing stop.
          2. I want to not enter another trade for 3 bars only when stop loss triggers.
          3. I tried the signal loss name in both long exit condition group as above and condition using the same name in trailing stop

          Would you mind helping on how to match entry condition with trailing stop? Thanks.
          Attached Files

          Comment


            #6
            Hello rocketstock,

            Thank you for your inquiry.

            I see that you have put "StopLoss" as the entry signal in your Trailing Stop order. This field could be left blank like in the screenshot below:



            The "From entry signal" field for the Trailing Stop is described as "The entry signal name. This ties the trail stop exit to the entry and exits the position quantity represented by the actual entry. Using an empty string will attach the exit order to all entries." This field is optional, however, if you do choose to use an entry signal make sure it matches the entry signal attached to your entry order (if one was used). The value you put here is not attached to the BarsSinceExitExecution() in your condition at all.

            Additionally, a Trailing Stop has a different signal name than a Stop Loss; if you use the signal name "Trail stop" this should work properly with BarsSinceExitExecution(). This is mentioned as the final bullet point under "Tips" on the help guide page here:



            Here is an example of how you would want to set up the condition group on your entry order to make sure an entry is not submitted unless 3 bars have passed since your Trailing Stop was filled:



            For additional information on BarsSinceExitExecution(), please refer to the page here:



            Please let us know if we may be of further assistance.
            Emily C.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by MarianApalaghiei, Today, 10:49 PM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by love2code2trade, Yesterday, 01:45 PM
            4 responses
            28 views
            0 likes
            Last Post love2code2trade  
            Started by funk10101, Today, 09:43 PM
            0 responses
            8 views
            0 likes
            Last Post funk10101  
            Started by pkefal, 04-11-2024, 07:39 AM
            11 responses
            37 views
            0 likes
            Last Post jeronymite  
            Started by bill2023, Yesterday, 08:51 AM
            8 responses
            46 views
            0 likes
            Last Post bill2023  
            Working...
            X