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

Exit Conditions

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

    Exit Conditions

    Hi,

    I've built a strategy using strategy builder and tested successfully with fixed target and stop.

    I'd like to add an exit condition as per the below logic. Any idea how do I add to the existing code? Appreciate the help

    Close Buy: If 3 POSITIVE MACD histogram bars close. One closes, then the next closes
    lower, then the next closes lower.

    Close Sell: If 3 NEGATIVE MACD histogram bars close. One closes, then the next closes
    higher, then the next closes higher

    #2
    Hello ark321,

    Thanks for your post.

    In a new set(s) in your strategy, you would add the condition that checks for the market position being long or short. Reference: https://ninjatrader.com/support/help...ionComparisons

    In addition, you would check the Macd.diff plot for the 3 bars. I've added a screenshot of what the long side would look like. Note that you have to select the "Diff" for the value plot each time and note that you have to set the "Bars ago" . For your understanding, bars ago of 0 is the current bar, 1 is the previous bar and 2 is the bar before that.
    For the exit order, you could select Order Management> Exit long position under the do the following section.

    Click image for larger version

Name:	ark321-1.PNG
Views:	361
Size:	58.1 KB
ID:	1169155
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      This helps! Thanks a lot.

      Comment


        #4
        btw, do you enter the entry conditions and exit conditions in two separate tabs (Set1, Set 2 )?

        Comment


          #5
          Hello ark321,

          Thanks for your reply.

          Typically yes you would have entry conditions and entry method in one set and another set with exit conditions and the exit method.

          Paul H.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by futtrader, 04-21-2024, 01:50 AM
          4 responses
          41 views
          0 likes
          Last Post futtrader  
          Started by Option Whisperer, Today, 09:55 AM
          1 response
          11 views
          0 likes
          Last Post bltdavid  
          Started by port119, Today, 02:43 PM
          0 responses
          7 views
          0 likes
          Last Post port119
          by port119
           
          Started by Philippe56140, Today, 02:35 PM
          0 responses
          7 views
          0 likes
          Last Post Philippe56140  
          Started by 00nevest, Today, 02:27 PM
          0 responses
          7 views
          0 likes
          Last Post 00nevest  
          Working...
          X