Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Working With SetProfitTarget
Collapse
X
-
Working With SetProfitTarget
I'm a newbie, so please excuse me if my question is trivial or has been answered many times in the past. Let's say that I want to enter two separate long trades using EnterLong(), both for the same instrument. The first one is associated with a SetProfitTarget() which is set in Initialize(). Both orders however are subject to a general exit condition which is computed in OnBarUpdate() each time for a new bar. If the exit condition is hit before the Profit Target is reached, then both trades are closed. If the Profit Target is reached first, then the first trade will be automatically closed, and the second one remains open until the general exit condition is met. My question is, when the general exit condition is met, if I don't know whether or not the first trade was closed due to the profit target being reached, I would not know whether or not I need to close that trade as well. How do I know whether or not the profit target was reached for the first trade, and that it is therefore no longer an active trade?Tags: None
-
Thank you, but if all goes well with the trade, one of the trades will close out due to the profit target being hit, but the second trade will still be active. When time comes to close that second trade, due to the general exit condition being met, would I do the wrong thing by trying to exit the first trade which has already been closed previously? If I would, then how do I know that that trade has already been closed, and that I should not be trying to close it again?
Comment
-
Hello ronharrow,
Thanks for your reply.
In addition to checking for a marketposition/direction you can also test for quantity: http://ninjatrader.com/support/helpG.../?quantity.htm
Most exit methods will ignore if a position does not exist.
Please review the helpguide on managed approach: http://ninjatrader.com/support/helpG...d_approach.htm
And then check the helpguide on each of the exit methods you are using: http://ninjatrader.com/support/helpG...er_methods.htm
Comment
-
Part of the whole point of using managed orders is that you do not need to know this level of detail. When your first trade is closed by exiting at target, its associated Stop Loss order is automatically closed, so the question that you raise is moot.Originally posted by ronharrow View PostI'm a newbie, so please excuse me if my question is trivial or has been answered many times in the past. Let's say that I want to enter two separate long trades using EnterLong(), both for the same instrument. The first one is associated with a SetProfitTarget() which is set in Initialize(). Both orders however are subject to a general exit condition which is computed in OnBarUpdate() each time for a new bar. If the exit condition is hit before the Profit Target is reached, then both trades are closed. If the Profit Target is reached first, then the first trade will be automatically closed, and the second one remains open until the general exit condition is met. My question is, when the general exit condition is met, if I don't know whether or not the first trade was closed due to the profit target being reached, I would not know whether or not I need to close that trade as well. How do I know whether or not the profit target was reached for the first trade, and that it is therefore no longer an active trade?
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
578 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
334 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
554 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
551 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment