Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

"blending" trades

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

    "blending" trades

    Hello,
    I have certain trades in which I would like to change the exit conditions during the trade according to market conditions. So I have two trading ideas x & y. I enter a trade with idea x and price continues to move in my direction until the entry condition for idea y is triggered. Instead of a new entry I'd like to "blend" idea x into idea y and use idea y's exit conditions. Any suggestions on how that would be accomplished? Thanks.

    #2
    CaptainAmericaXX,

    Thank you for your post.

    If I am following you correctly, you should be able to accomplish this by using a different stop strategy with each condition.

    Here is some pseudo code to help you get started...

    if (MyXCondition)
    //doMyXExit

    if (MyYCondition)
    //doMyYExit

    As long as your Y condition is true, it will use the Y exit.
    MatthewNinjaTrader Product Management

    Comment


      #3
      So if I understand you correctly your saying that if I'm in x trade and the conditions for y become true, the y trade will not fire and the x trade exit conditions will be automatically disregarded in favor of the y exit?
      In my experience both trades will fire independently with the separate exit working as well. If there are unique names for the conditions one exit will not recognize the other.

      Comment


        #4
        CaptainAmericaXX,

        When you have both statements both are used. The logic would not be a "one or the other" type of logic. If you want one or the other you would need to use an if-else statement, not two if-statements like in Matthew's code.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          So I would need to say something like:
          if(x trade == true)
          Exit conditions
          else(x trade == true
          && y conditions == true)
          Exit(with y condition)
          is this correct?

          Comment


            #6
            Assuming you are going long...

            Code:
            // In variables section above Initialize()
            private bool useYExits = false;
            
            // In OnBarUpdate()
            if (x trade entry conditions == true)
                 EnterLong();
            
            if (Position.MarketPosition == MarketPosition.Long)
            {
                 if (y entry conditions == true)
                      useYExits = true;
            
                 if (useYExits == false && x exit conditions == true)
                      ExitLong();
                 else if (useYExits == true && y exit conditions == true)
                      ExitLong();
            }
            
            if (Position.MarketPosition == MarketPosition.Flat && useYExits == true)
                 useYExits = false;
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Sweet!
              Thanks Josh and thank you to everyone at NT. A year ago I had absolutely no clue how to program.(I"m still very green) The staff at NT has been a huge help to me. Thanks for everything! I don't know how else to send a "Thank you" card. I know I'll still need a lot of help before my ideas materialize, but I wanted to take a moment and thank you all.

              Comment


                #8
                You're welcome. Glad to be able to help.
                Josh P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                569 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                330 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                101 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                548 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                548 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X