Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

multiple profit targets

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

    multiple profit targets

    Hello. I'm trading 3 YM contracts. I've built a strategy to execute a trade but would like to set a profit target for 2 contracts and leave the final contract as a runner. I've searched the forum but am unable to see how best to do this. I've set up conditions to breakeven and would like the breakeven stop trail my runner. I am new to Strategy Builder but am keen to learn more. I can provide screenshots as needed. Please advise. Thank you!

    #2
    Hello vmalankar,

    For break even logic you can see the following example for the strategy builder. That goes over the required logic to do a break even movement while using the builder There is also a trail example that shows how to make an order trail. Those two concepts would be what you need to do if you wanted to control an order based on conditions in the strategy builder.



    Comment


      #3
      Thank you so much! Is there any existing documents or pictures around how to set up multiple profit targets?

      Comment


        #4
        Hello vmalankar,

        I am not aware of any content for that specifically, if you wanted to make stationary profit targets you only need to make multiple targets in the stops and targets page. If you are trying to control the targets using conditions you would need to use similar logic to the samples I had linked. That sample shows what is needed for a single stop order to be moved, if you wanted multiple orders you would have to essentially duplicate the logic that the sample uses for a second order to be controlled independently.

        Comment


          #5
          Hello Jesse,

          Attached are screenshots from my builder, where I try to set up a long entry for 3 contracts. I set a profit target for 2 contracts and leave 1 as a runner. You'll see some commands for breakeven execution as well. My issues are (1) the breakeven command doesn't activate when the price reaches the defined breakeven target variable and (2) the 1 runner isn't working. Could you review and advise on how to address these issues?
          Attached Files

          Comment


            #6
            Hello Jess - I couldn't attach more than 5 pics to my last post so I'm attaching the final two here for your review. Thank you so much for your help!
            Attached Files

            Comment


              #7
              Hello vmalankar,

              From the images I see a few issues.

              The first is that on the stops and targets age you need to remove the trail stop's. You are already submitting the stops from the sets so that is where you need to control trailing if that is what you want to do. I highly suggest that you use the logic from the trail sample in the link that I provided, that shows how to submit the stop order and trail by X distance at Y amounts of profit frequencies.

              The other issue is that you should consolidate where you call ExitLongStopMarket, for example the break even sample just uses the last set to submit the order based on the TriggerState. You control the price of the order in the sets before the last so that you can do actions like break even or trailing.

              The breakeven sample sample in the linked form post uses a int variable to make a "state" which would be helpful for what you are trying to do. Instead of using a bool you can use a int variable and set that to different values based on what you want the strategy to do. For example if you want it to trail at first then later break even that would be a good way to control the variables for prices being used and also tell the sets when to work.



              Comment


                #8
                Thank you Jesse - is there a video where I can see how these zip files can be imported and used in the Strategy Builder? I'm new to this and a little lost on how to best leverage the files you have shared. Thank you so much!

                Comment


                  #9
                  Hello vmalankar,

                  There is not a video for importing, you can use the control center Tools -> Import -> NinjaScript menu to import zip files. They will then appear in the strategies list or NinjaScript editor if source code was imported.

                  Comment


                    #10
                    Thank you for your help! Do you have any existing scripts for setting multiple profit targets and one runner?

                    Comment


                      #11
                      Hi Jesse - I reviewed the scripts you provided and they were very helpful. I tried modifying them for my purposes and took your guidance into account. Attached are screenshots of what I have. I am still not able to achieve a breakeven action nor does the breakeven stop trail the price as it increases. Please advise on any fixes I can reflect. Thank you so much
                      Attached Files

                      Comment


                        #12
                        Hello vmalankar,

                        I am not aware of a specific script like the one you described, most sample scripts that we can link to explain a single concept at a time. Those samples are generally intended to teach how to do a process so you can later re create that logic in your own scripts.

                        Regarding the images you provided it looks like that was changed quite a bit from what the breakeven sample shows. If you are looking at the breakeven sample all 5 sets are required and need to be coded exactly like the sample shows in the same order. In your images set 1 and 2 are different which will cause the strategy to not perform the same as the sample.

                        The sample uses set 1 to reset the TriggerState so the strategy can start over and produce additional trades. set 2 is used to produce the entry when TriggerState is 0 and then moves TriggerState to 1. Set 3 checks that you are now in a position and that TriggerState is 1, if so calculate the starting price for the stop. Set 4 checks that an initial stop price was set and also if the current price has moved beyond the breakeven trigger price, if so a new price is set to breakeven for the order. Set 5 submits the order every bar while you are long, the order will be changed to break even once set 4 becomes true.



                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by NullPointStrategies, Today, 05:17 AM
                        0 responses
                        44 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
                        65 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