Thanks.
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
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:
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.JimNinjaTrader Customer Service
-
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()
Code:SetProfitTarget(string fromEntrySignal, CalculationMode mode, double value)
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.JimNinjaTrader Customer Service
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.JimNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by PaulMohn, Today, 03:49 AM
|
0 responses
7 views
0 likes
|
Last Post
by PaulMohn
Today, 03:49 AM
|
||
Started by inanazsocial, Today, 01:15 AM
|
1 response
9 views
0 likes
|
Last Post Today, 02:18 AM | ||
Started by rocketman7, Today, 02:12 AM
|
0 responses
10 views
0 likes
|
Last Post
by rocketman7
Today, 02:12 AM
|
||
Started by dustydbayer, Today, 01:59 AM
|
0 responses
4 views
0 likes
|
Last Post
by dustydbayer
Today, 01:59 AM
|
||
Started by trilliantrader, 04-18-2024, 08:16 AM
|
5 responses
23 views
0 likes
|
Last Post Today, 12:32 AM |
Comment