Thanks.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Stop and Limit Orders
Collapse
X
-
Hello GibbsB613,
Thanks for opening the thread.
You could loop through your orders and find information about any current orders. You could for example find out if an Order has a FromEntrySignal assigned to it. This is technically finding the opposite of what you are requesting, but you could follow the same approach to then deduce which orders have FromEntrySignals (Profit Targets and Stop Losses.)
Here is a loop that will Print out any orders that are associated with an FromEntrySignal:
It is generally good practice to use Order objects in your strategy with appropriate names and signal names so you can manage your orders without having to loop through to find the orders you are looking for.Code:foreach (Order o in Orders) { if (o.FromEntrySignal != null) Print(o.Name + " is attached to " + o.FromEntrySignal); }
For reference, here is the documentation on the Order class: https://ninjatrader.com/support/help...-us/?order.htm
Please let me know if I may be of further assistance.
-
So I have this in my code for the stop and limit, how and when do I set the signal names for my orders?
else if (State == State.Configure)
{
SetProfitTarget(@"", CalculationMode.Pips, 250);
SetStopLoss("", CalculationMode.Pips, 50, false);
}
Thanks!Last edited by GibbsB613; 06-16-2017, 02:27 PM.
Comment
-
Hello GibbsB613,
Thanks for the additional question.
You can set the signal names using the appropriate overload for your Order Entry Methods.
Here are a couple examples:
SetProfitTarget()
EnterLong()Code:SetProfitTarget(string fromEntrySignal, CalculationMode mode, double value)
For an example on how to write a strategy that uses Order objects for order management, I would suggest to take a look at the SampleOnOrderUpdate example and its relevant documentation.Code:EnterLong(string signalName)
You can reference all overloads for Order Entry methods in the relevant sections in the help guide.
SetProfitTarget() - https://ninjatrader.com/support/help...ofittarget.htm
EnterLong() - https://ninjatrader.com/support/help.../enterlong.htm
SampleOnOrderUpdate - http://ninjatrader.com/support/forum...ead.php?t=7499
If you have any additional questions, please don't hesitate to ask.
Comment
-
Hello GibbsB613,
Yes. The Order methods take a string as an argument for the entry signal, and you could create your own string and pass it through if you want.
I suggest to try out these sort of inquiries when experimenting with your code so you know what you can and cannot do.
Please let me know if I can be of further help.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Today, 05:17 AM
|
0 responses
38 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
124 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
64 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
41 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