Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to check if a position exists?

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

    How to check if a position exists?

    Hi,
    for crying out load I can't find any information how to check if a position has been entered and is still active. I enter a postition with
    EnterLong(
    1,"Entry"+i);
    and later want to check if a specific position - for instance Entry1 in this case - is open and has not been stopped out. Currently I'm resetting stop levels and getting lots of 'This was an exit order but no position exists to exit' messages which makes me feel rather stupid...
    Thanks for some guidance!


    #2
    Gwaihir, you would be using the Position object for those checks :



    For a specific order state check, the IOrder objects would be needed for finer control / reporting :

    Comment


      #3
      Thank you for the fast reply. I did look at those but I couldn't figure out how they might help with my problem so some more information from you will be much appreciated. If I check the position I can't trace the status of a single entry. For instance Entry1 might be stopped out but Entry2 is still active so the position is long. With the IOrder object I can see that that order has been filled but how do I see whether the related position is still in existance?

      Comment


        #4
        You would to check the IOrders for your stops and if the stop IOrder FromEntrySignal X filled, then you know the position is stopped for example.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        37 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, Yesterday, 02:41 AM
        0 responses
        17 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        25 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        40 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        34 views
        0 likes
        Last Post CarlTrading  
        Working...
        X