Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ProfitTarget

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

    ProfitTarget

    Hallo,

    I need help with the use of SetProfitTarget for my strategy:

    The basics are:
    Buy one a unit
    buy a second unit on a stop order
    Buy a third unit on a stop order
    Then, when I have three units, set a ProfitTarget.

    This goes both for long and short. I am really having trouble.
    Shall I use SetPrfotTarget under Initilize()??

    If not, i have to reset the Target in a few places in the code and something is not working (see the pic attached)

    Any help welcome!!
    Attached Files

    #2
    Yes, you can use SetProfitTarget() in Initialize()
    RayNinjaTrader Customer Service

    Comment


      #3
      Any ideas what does it happens with the picture? Why does it close only two contracts and leave a third open?

      Comment


        #4
        Also,

        If I set the ProfitTarget in the Initialize() method, how do I do it?

        Let´s say I want a 5% profit over the price of the FIRST contract I buy, regardless of the price i get for the 2nd and 3rd.

        How do I state that?

        Comment


          #5
          Post #3 - No idea, you would have to debug and simplify your strategy to get an idea what may be happening

          Post #4 - SetProfitTarget(CalculationMode.Percent, 0.05);

          See here for more information - http://www.ninjatrader-support.com/H...fitTarget.html

          I believe 0.05 is 5%...you will have to verify.
          RayNinjaTrader Customer Service

          Comment


            #6
            POst #4:

            But that does not seem to work well when adding more contracts...
            It should use the entry price of the first contract but it does not seem so... actually there are no exits named ProfitTarget..

            Comment


              #7
              Oh, now I see it!

              Sorry! It does work, BUT...

              I add up to three contracts and I want all 3 to exit on the same price (5% over the FIRST contract entry price). I mean:

              First at 600. Target: 5% (30 points). Exit price 630
              Second at 610: Exit price still at 630
              Third at 620. Exit price at 630.

              How I do that?

              Thanks for the help!!

              Comment


                #8
                Do not provide any signal names for your entries. That should work.
                RayNinjaTrader Customer Service

                Comment


                  #9
                  If that does not work or you or already doing this, then there is no easy option apart from coding something more elaborate where you capture the first execution price via OnExecution() and then calculate the target and submit targets via ExitLongLimit() for example in the OnExecution() method. We will be posting a reference sample on this shortly.
                  RayNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

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