Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Prevent order placement

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

    Prevent order placement

    I'm writhng an addon for NT8 that will monitor all orders placed in the system. Depending on circumstances, I'd like to be able to prevent order from being placed.
    To achieve that I am subscribing to account.OrderUpdate:
    Code:
    account.OrderUpdate += OnOrderUpdate;
    and

    Code:
            private void OnOrderUpdate(object sender, OrderEventArgs e)
            {
                if (e.OrderState == OrderState.Initialized)
                    e.Order.Account.Cancel(new[] { e.Order });
            }
    That works, but the problem is that notification message pops up


    Is there any method to prevent order from being placed without such a message?

    Thanks

    #2
    Hello,

    Thank you for the question.

    There would be no way to disable the error boxes in this case, any log level error would be displayed as an error box.

    I have put in a feature request to direct the error to the output instead of a popup as an option.

    There is also an undocumented and unsupported item that was brought to my attention called QueueCancel(e.Order); if you choose to use it we could have you report back here any details of using this.

    I have attached a sample script that was provided to me that demonstrates this.


    I look forward to being of further assistance.
    Attached Files
    Last edited by NinjaTrader_Jesse; 12-21-2015, 04:40 PM.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by argusthome, Yesterday, 10:06 AM
    0 responses
    20 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    18 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    14 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    9 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    38 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X