Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exit a trade based on a condition

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

    Exit a trade based on a condition

    Good Day

    I have 2 questions

    Question 1: I would like to exit a trade when DEMA 9 on the bar that the trade opened on is equal to DEMA 9 of the previous bar. In the attached screenshot on the right the period is 9. I am not sure if the conditions under 'Misc' is correctly configured.

    Question 2: I have a set of conditions defined to enter the trade in the same box I placed the above condition, and you know the box below I have the order management condition to enter the trade, either long or short. How does the logic read when you have some conditions to enter a trade and then another condition to exit a trade. I looked through and searched the documentation and I am unclear as to how I configure these. Basically I have say 6 conditions to enter the trade, and then the one condition to exit the trade. All I am missing is how I would exit the trade? To confirm everything is in the same set. Is this possible? Would you be able to advise please. Many thanks.

    #2
    Hello lorimar,

    Select DEMA on the left with Period set to 9, in the center select Equal, on the right select DEMA with Period set to 9 and set Bars ago to 1.

    Each condition set is evaluated independently and in order.
    You will not want to submit an exit order and an entry order on the same bar as this will cause an overfill or will double the position in the opposite direction.


    The exit should be in a separate condition set and should be checking for the position to be long to submit a long exit or checking the position to be short to submit a short exit.

    To submit a long exit market, in the Actions window select Order management > Exit long position with a market order.

    Below I am providing a link to a support article with helpful resources on getting started with C# and NinjaScript.


    Please be sure to watch the 'Automate Your Trading with NinjaTrader's Strategy Builder' training video.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    48 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    126 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    66 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    42 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X