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
How to determine signal names of open position?
Collapse
X
-
how about if i set two ways to flat my position either by trailingstop or by indicator --exit position, i always found that the position get reverse which meansit get flat and one more position(when i long at start, it hit the stop by indicator and trailstop at same time so that i got one long position flattened and one short position created
Leave a comment:
-
Hello stantenlee,
If the entries making up a position have different signal names, each exit order using the from entry signal would only exit the quantity of the entry with that signal name.
Leave a comment:
-
NinjaTrader does not provide the orders that have contributed to the current position.
Can any signal entry name that form the current position be called so that I can just flat that position due to that signal initiated position??
Leave a comment:
-
Hello fx.practic,
Unfortunately, NinjaTrader does not provide the orders that have contributed to the current position.
This would need to be stored yourself in a custom coded object such as an array, list, dictionary, etc.
You would need to add the Order object from OnOrderUpdate() when the order fills, and remove the object when an opposing order using the same fromEntrySignal fills.
I will submit a feature request on your behalf for the NinjaTrader Development to consider providing a collection of orders that have contributed to the Position.
Once I have a tracking ID for this request I will post in this thread for future reference.
antrux,
I am moving your inquiry to a new thread, as this is unrelated to the current topic.
Leave a comment:
-
Thank You.
I think about this way, but hope it can be done using Position object.
More logic, more places for great bugs.
While internally NT still know signals names of opened position.
Leave a comment:
-
Hello fx.practic,
Thank you for your patience.
To find a signal name, you will need to save your entries as an Order object. The order object has two properties: Name and FromEntrySignal.
You would access you signal names like so:
Order anOrder = EnterLong( 1, "Signal_1" );
Print(anOrder.Name);
Print(anorder.FromEntrySignal);
More on the Order object here:
If we may be of any further assistance, please let us know.
Leave a comment:
-
Hello fx.practic,
Thank you for the post.
I am reviewing your inquiry and will be back with a reply shortly.
I look forward to assisting further.
Leave a comment:
-
How to determine signal names of open position?
Hello.
Say, I have position, opened by 3 orders with different names:
PHP Code:
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Calculate = Calculate.OnBarClose;
IsUmanaged = false;
EntriesPerDirection = 10;
EntryHandling = EntryHandling.AllEntries;
}
}
protected override void OnBarUpdate()
{
if( State != State.Realtime ) return;
EnterLong( 1, "Signal_1" );
EnterLong( 1, "Signal_2" );
EnterLong( 1, "Signal_2" );
}
Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by GussJ, 03-04-2020, 03:11 PM
|
16 responses
3,279 views
0 likes
|
Last Post
by Leafcutter
Today, 04:14 PM
|
||
Started by WHICKED, Today, 12:45 PM
|
2 responses
19 views
0 likes
|
Last Post
by WHICKED
Today, 03:36 PM
|
||
Started by Tim-c, Today, 02:10 PM
|
1 response
9 views
0 likes
|
Last Post Today, 02:52 PM | ||
Started by Taddypole, Today, 02:47 PM
|
0 responses
5 views
0 likes
|
Last Post
by Taddypole
Today, 02:47 PM
|
||
Started by chbruno, 04-24-2024, 04:10 PM
|
4 responses
52 views
0 likes
|
Last Post
by chbruno
Today, 02:38 PM
|
Leave a comment: