• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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, 03:40 PM.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by YevhenShynkarenko, Today, 02:55 AM
    0 responses
    39 views
    0 likes
    Last Post YevhenShynkarenko  
    Started by pjsmith, Today, 02:20 AM
    0 responses
    11 views
    0 likes
    Last Post pjsmith
    by pjsmith
     
    Started by faisamtrader, Yesterday, 10:03 PM
    0 responses
    8 views
    0 likes
    Last Post faisamtrader  
    Started by johnnybegoode, Yesterday, 08:11 PM
    0 responses
    4 views
    0 likes
    Last Post johnnybegoode  
    Started by Bionian, Yesterday, 02:47 PM
    2 responses
    29 views
    0 likes
    Last Post Bionian
    by Bionian
     
    Working...
    X