Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exit strategy

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

    Exit strategy

    hi, i would like to have a strategy that will close out my position when the unrealized profit on the trade reaches a certain cash value. how can i do that?

    your help is appreciated!

    EG

    #2
    Hello ericgood,

    There are a couple different ways to do this. You could use SetProfitTarget() method in the initialize section.


    You could also work with GetProfitLoss() method.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      thanks. is there a way to do this with the strategy wizard? or do you have to open the code and manually do it?

      Comment


        #4
        Hello Eric,

        The last page of the strategy wizard will allow you to set profit target and stop losses.

        You can set calculation mode to Currency.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          i went to the last page of the wizard and entered what you see below or in the attachment. But this did not work for me. is there something else i need to do?

          eric


          [IMG]file:///C:/DOCUME%7E1/Eric/LOCALS%7E1/Temp/moz-screenshot.png[/IMG]
          Attached Files

          Comment


            #6
            Hello Eric,

            You've set a profit target to exit after $300 in cash profit or $1500 in losses.

            What is it doing for you and what do you expect it to do?
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              i am expecting it to close all of my orders when either the profit target or stop loss is hit. and it does neither.

              thoughts?

              eg

              Comment


                #8
                Hi Eric,

                Lots of unknowns here. If you can provide a reproducible scenario for us we'll do our best to figure out what's going on.

                You can add Print() statements to your code to make sure the values are what you expect.

                You can add the statement TraceOrder = true; in the initialize section for some more debugging help.

                Ryan M.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

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