Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

If order not filled

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

    If order not filled

    Hello,

    I want to ask please how I can code

    "if Target (iorder) not filled at target price"
    then do........

    and also

    "if entry (limitorder) not filled at limit price"
    then do

    Couldn´t find a thread about this in the forum.

    Thank you
    Tony

    #2
    Hello,
    Thank you for your post.
    You could do this by assigning a variable to your target price and limit price then checking in OnExexcution().

    For example:
    Code:
    #region Variables
        IOrder longEntry;
        IOrder longTarget;
        private double entryPrice = 0.0;
        private double targetPrice = 0.0;
    #endregion
    
    protected override void OnBarUpdate()
    {
        entryPrice = //desired entry price
        targetPrice = //desired entry price
        if (/ conditions to place entry /)
        {
            longEntry = EnterLongLimit(Price);
        }
    
        if (longEntry != null && longEntry.OrderState == OrderState.Working)
        {
            // entry is working
        }
        if (longTarget != null && longTarget.OrderState == OrderState.Working)
        {
            // target is working 
        }
    }
    
    OnExecution(IExecution execution)
    {
        If (execution.Order == longEntry)
        {
            longTarget = EnterLongLimit(Price);
        }
        if(execution.Order == longEntry && execution.Price != entryPrice)
        {
           //longEntry filled at different price than submission price
        }
        if(execution.Order == longTarget && execution.Price != targetPrice)
        {    
            //longTarget filled at different price than submission price
    }
    If we can be of any other assistance please let us know.
    Cody B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    109 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    59 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    37 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    40 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    78 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X