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 Javierw.ok, Today, 04:12 PM
    0 responses
    4 views
    0 likes
    Last Post Javierw.ok  
    Started by timmbbo, Today, 08:59 AM
    2 responses
    10 views
    0 likes
    Last Post bltdavid  
    Started by alifarahani, Today, 09:40 AM
    6 responses
    40 views
    0 likes
    Last Post alifarahani  
    Started by Waxavi, Today, 02:10 AM
    1 response
    18 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Started by Kaledus, Today, 01:29 PM
    5 responses
    15 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X