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 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.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by bortz, 11-06-2023, 08:04 AM
    47 responses
    1,607 views
    0 likes
    Last Post aligator  
    Started by jaybedreamin, Today, 05:56 PM
    0 responses
    9 views
    0 likes
    Last Post jaybedreamin  
    Started by DJ888, 04-16-2024, 06:09 PM
    6 responses
    19 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by Jon17, Today, 04:33 PM
    0 responses
    6 views
    0 likes
    Last Post Jon17
    by Jon17
     
    Started by Javierw.ok, Today, 04:12 PM
    0 responses
    16 views
    0 likes
    Last Post Javierw.ok  
    Working...
    X