Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to detect naked positions

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

    How to detect naked positions

    Hello guys,

    Now Im aware that I can use Position.MarketPosition to know if my strategy is flat, long or short.

    How can I detect when I have a naked position? Meaning that Im short or long, but I dont have active exit orders... no stop, no target.

    Thank you!

    #2
    Hello facuevasm,

    That would generally involve using logic of your own to know that. If your strategy submits an order and it fills that will enter into a position however there are no specific events to signal that no targets were submitted.

    If you want to know for sure if there are targets active or working you could use order objects. We have a sample that shows finding a stoploss order, the same type of logic could be used to monitor or know if any target is working. If the object is null you would know there is not currently an order so you could do the logic to put targets up. The order events like OnOrderUpdate or OnExecutionUpdate can be used to monitor the orders once they are submitted or store them to variables to make the variable not null (the order now exists).



    the above sample uses a list to collect orders, that is not necessarily a great way to see how the orders can be used. I would also suggest looking at how this sample uses its Order variables in its logic: https://ninjatrader.com/support/help...and_onexec.htm


    I look forward to being of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    47 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    23 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    33 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    51 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Working...
    X