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!
See more
See less

Partner 728x90

Collapse

How to determine signal names of open position?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • NinjaTrader_ChelseaB
    replied
    Hello stantenlee,

    I'm not sure I'm understanding your inquiry.

    However, if you are using multiple exit orders for the same entry order, this could result in both orders filling causing an overfill.


    Trying to call an exit order and an entry order at the same time will also result in an overfill.

    Leave a comment:


  • stantenlee
    replied
    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:


  • NinjaTrader_ChelseaB
    replied
    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:


  • stantenlee
    replied
    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:


  • NinjaTrader_ChelseaB
    replied
    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:


  • fx.practic
    replied
    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:


  • NinjaTrader_ChrisL
    replied
    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:


  • NinjaTrader_ChrisL
    replied
    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:


  • fx.practic
    started a topic How to determine signal names of open position?

    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;
        
            
    EnterLong1"Signal_1" );
            
    EnterLong1"Signal_2" );
            
    EnterLong1"Signal_2" );

    How can I determine entries names ("Signal_1", "Signal_2", "Signal_3") from which the position is composed?

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 Leafcutter  
Started by WHICKED, Today, 12:45 PM
2 responses
19 views
0 likes
Last Post WHICKED
by WHICKED
 
Started by Tim-c, Today, 02:10 PM
1 response
9 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by Taddypole, Today, 02:47 PM
0 responses
5 views
0 likes
Last Post Taddypole  
Started by chbruno, 04-24-2024, 04:10 PM
4 responses
52 views
0 likes
Last Post chbruno
by chbruno
 
Working...
X