Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Assistance with Creating a Two-Stage Take Profit in Strategy Builder

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

    Assistance with Creating a Two-Stage Take Profit in Strategy Builder

    Hello NinjaTrader Support Forum,

    I am working on developing a trading strategy using the Strategy Builder in NinjaTrader and need some guidance on setting up a two-stage take profit condition. Here is the scenario I am trying to achieve:

    I want the strategy to initiate a take profit order in two stages:
    1. First, the RSI indicator should cross above a predefined threshold, which I've set as an entry point for the take profit condition.
    2. Following that, the strategy should wait for the price to cross below a specific moving average before executing the take profit order.

    The objective is to capture the initial momentum as indicated by the RSI and then secure profits when the price starts to retrace below the moving average.

    My question is, how can I set up this two-stage take profit logic within the Strategy Builder without delving into custom scripting? Is there a way to use the Strategy Builder's graphical interface to define such a condition that requires the second stage to occur after the first, potentially across different bars?

    I would appreciate any advice or guidance on how to configure this using the Strategy Builder, or if it's necessary to use NinjaScript for this level of complexity.

    Thank you for your assistance.

    #2
    Hello Hezi100,

    Thanks for your notes.

    You could consider trying to use a bool to control the logic of a script.

    A bool variable (initially set to false) could be created on the Inputs and Variables screen of the Strategy Builder.

    You could create the first RSI condition in one set and flip the bool variable to true. Then, in a separate Set, you could set up your cross below condition and also check if the bool variable is true in that same Set, followed by calling your Exit order action to exit the position.

    By doing so, once the first RSI condition becomes true, the bool would be flipped to true. The other Set would check if the cross below condition occurs and checks if that bool is true (indicating the first condition occurred) and then the Exit order would be placed to exit the position.

    You could consider setting the bool back to false when you are in a flat market position or after calling the Exit order to exit the position.

    See the help guide documentation below for more information.

    Strategy Builder screens: https://ninjatrader.com/support/help...er_screens.htm
    Conditions: https://ninjatrader.com/support/help...on_builder.htm
    Actions: https://ninjatrader.com/support/help...t8/actions.htm
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3


      Thank you for your previous guidance on using a boolean variable to control the logic of a two-stage take profit strategy. I have successfully created a bool variable and set up the first RSI condition to flip the bool to true.

      However, I need further assistance on the second part. Specifically, how do I configure the Strategy Builder to set the bool variable back to false when the market position is flat or after executing the take profit exit order? Is there a specific action or condition in the Strategy Builder that I can use to reset this variable automatically under these circumstances?

      Comment


        #4
        Thank you for your previous guidance on using a boolean variable to control the logic of a two-stage take profit strategy. I have successfully created a bool variable and set up the first RSI condition to flip the bool to true.

        However, I need further assistance on the second part. Specifically, how do I configure the Strategy Builder to set the bool variable back to false when the market position is flat or after executing the take profit exit order? Is there a specific action or condition in the Strategy Builder that I can use to reset this variable automatically under these circumstances?

        Comment


          #5
          Hello Hezi100,

          Thanks for your notes.

          You will need to create the logic in the script for flipping the bool back to false.

          You could consider creating the second condition that checks for the cross below condition and checks if the bool is true. Then, in the actions ('Do the following") section of that Set, you could call your Exit order method to place the order to exit the position and also set the bool to false (Misc folder > Set "bool variable name" > uncheck the bool property to set it to false).

          Or, you could create a separate Set that checks if Position.MarketPosition (Strategies folder > Current market position) is Equal to MarketPosition.Flat (Strategies folder > Market position > Flat) and then set the bool to false in the actions section of that Set.
          <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Yesterday, 05:17 AM
          0 responses
          63 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          139 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          75 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          45 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          50 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X