Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Closing positions using limit order

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

    Closing positions using limit order

    Hi,

    I have Interactivebrokers live brokerage connected to ninjatrader.

    If I want to close positions using limit order at ask price for long position, I would imagine that I need the bid/ask price of the instruments.

    Sometimes, for large portfolio, we cannot enter each instruments into the instrument manager all the time... is there any way to do this or we don't even need to know the bid/ask prices?

    For example:

    for (int i=0;i<=NinjaTrader.Cbi.Globals.Accounts.Count-1;i++)

    {

    if (NinjaTrader.Cbi.Globals.Accounts[i].Name == accName)

    {

    a = NinjaTrader.Cbi.Globals.Accounts[i];

    }

    }

    if (a != null)

    {

    Order o = a.CreateOrder(........) // how to implement this?

    o.Submit();

    }

    #2
    Hello,

    Thank you for the question.

    For this item, I would unfortunately not have a suggestion as this is not a documented item so I could not provide any relevant information on this. It would not be suggested to submit orders outside of the documented approaches as there would be no way to determine if something is going wrong as there is no expectations related to that syntax.

    This thread will remain open in the case any other users have come across this before or used this specific syntax for the given purpose.

    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
    142 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    81 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    125 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    120 views
    1 like
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    98 views
    0 likes
    Last Post CarlTrading  
    Working...
    X