Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

IOrder Query

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

    IOrder Query

    Hi NT Support,

    It might be a stupid question, I'm running a strategy that makes use of IOrders, I declaire the following variables in the script:

    Code:
    	
    private IOrder entryOrderLong 	= null;
    private IOrder stopOrderLong 	= null
    private IOrder takeProfitOrderLong = null;
    that I then correctly manage in the OnExecution() and OnOrderUpdate() sections.

    However now I have the need to use also an Exit Strategy at Market, usually I would use
    Code:
    ExitLong(0,stopOrderLong.Quantity,"ExitLong","Long");
    My question is:
    Do I need to declare a variable such as exitOrderLong = null; and then use:
    ExitLong(0,stopOrderLong.Quantity,"ExitLong","Long ");

    or isn't this necessary because it doesn't make sense?

    #2
    Hi,

    No, you do not need to assign an IOrder object. Unless you wish to check various order properties as you're doing on OnExecution, etc. If you just want to exit the long position, you can just call the ExitLong() method as you're doing without having to declare the object.
    MatthewNinjaTrader Product Management

    Comment

    Latest Posts

    Collapse

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