Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to Stop Market and Take Profit with unmanaged approach in NT8?
Collapse
X
-
Hello Mykhailo,
When using the unmanaged approach you need to use the SubmitOrderUnmanaged to submit orders. If you want to submit a stop market order you would need to define the order type as OrderType.StopMarket. Profit targets are generally submitted as limit type orders.
https://ninjatrader.com/support/helpGuides/nt8/submitorderunmanaged.htm
Comment
-
Thank you for your reply. So you mean, for Buy order action, how to add functions. Here is my code. it will be thankful if you check it and send me feedback.
if( StopLoss > 0)
{
var stopPriceTarget = averageFillPrice - Position.Instrument.MasterInstrument.TickSize * StopLoss;
entryOrderStop = SubmitOrderUnmanaged(0, OrderAction.Sell, OrderType.StopMarket, Quantity, stopPriceTarget, stopPriceTarget, oco, "Stop");
Print("Enter Sell Stop order to price " + stopPriceTarget + " with oco of " + oco);
}
if (TakeProfit > 0)
{
var profitTarget = averageFillPrice + Position.Instrument.MasterInstrument.TickSize * TakeProfit;
entryOrderProfit = SubmitOrderUnmanaged(0, OrderAction.Sell, OrderType.Limit, Quantity, profitTarget, profitTarget, oco, "Profit");
Print("Take Sell order to price " + profitTarget + " with oco of " + oco);
}
Comment
-
Hello Mykhailo,
I am not sure I understand what you are asking with how the question was phrased. The order action used needs to match what you are trying to do, if you wanted to sell you would use the order action sell, to buy you would use the order action buy. The order type is what I had commented on which is how you choose which type of order is submitted like a stop market or limit.
If you want to know if the code you created works the best way to check that would be to run the script on a demo or sim account in realtime and utilize the prints you added in addition to the chart to verify the orders were submitted and at the correct prices.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
571 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
331 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
549 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
550 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment