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 SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    50 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    22 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    16 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    22 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    23 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X