Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
UnManaged Approach and SetProfitTarget
Collapse
X
-
UnManaged Approach and SetProfitTarget
Ok so I understand the the Set() will not work in the UnManaged Approach. Is there a comparable idea with the UnManaged Approach that will exit a position at a profit target without turning off the CalculateOnBarClose property? ThanksTags: None
-
I hope you can again forgive my ignorance. I'm still trying to understand this Unmanaged Approach. This is what I have so far for a Profit target. It works if the market takes off immediately. If the market turns against me the order comes back null. I'm not sure why it's doing that. If someone could take a look at it I'd be very grateful.
if (BullQuickI != null )
{
PrintOrder("BullQuickI Exit (ProfitTarget)", BullQuickI);
BullIProfitTarget = SubmitOrder(0,OrderAction.SellShort, OrderType.Limit, 1, BullQuickI.AvgFillPrice + 15 * TickSize, 0, "BullQuickI", "BullIProfitTarget");
BullQuickI = null;
PrintOrder("BullQuickI Exit (ProfitTarget) Order", BullQuickIExit);
}
Thanks
Comment
-
The snippet you posted is missing critical parts for management of order objects. Unmanaged is reserved for experienced programmers, and a lot of the concepts of our advanced order framework are applicable and necessary to properly work into an unmanaged strategy.If the market turns against me the order comes back null.
If you are having trouble with unmanaged code, you may want to first tackle these concepts in a managed framework. These samples can get you started managing IOrders and working with advanced handlers. The first one linked shows exactly how you can monitor for a filled order state on an entry order and then submit protective orders.
The OnOrderUpdate() and OnExecution() methods are reserved for experienced programmers. Instead of using Set() methods to submit stop-loss and profit target orders, you can submit and update them manually through the use of IOrder and IExecution objects in the OnOrderUpdate() and OnExecution() methods. The OnOrderUpdate()
When using NinjaTrader's Enter() and Exit() methods, the default behavior is to automatically expire them at the end of a bar unless they are resubmitted to keep them alive. Sometimes you may want more flexibility in this behavior and wish to submit orders as live-until-cancelled. When orders are submitted as live-until
An overview of advanced event handlers is here:
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
649 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
370 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
109 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
574 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
576 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|
Comment