Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
multiple profit targets
Collapse
X
-
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!Tags: None
-
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.
-
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
-
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?
Comment
-
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
-
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
Comment
-
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
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
126 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
65 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
42 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
46 views
0 likes
|
Last Post
|

Comment