Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unmanaged Events

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

    Unmanaged Events

    I think the code shown here is unmanaged?

    if I SubmitOrderUnmanaged(0, OrderAction.Buy, OrderType.Limit, qty, limit, 0, "", "myLimitOrder");

    how do I cancel this order

    and how do I get the Cancel or Accept event confirmation using

    private void OnAccountStatusUpdate(object sender, AccountStatusEventArgs e)
    or
    private void OnAccountItemUpdate(object sender, AccountItemEventArgs e)

    #2
    Hello,

    Thank you for the question.

    The code shown at the provided link is only the Account class and Event handler subscriptions to aid in seeing Execution events from that account in an Addon.

    Managed and Unmanaged modes strictly apply to a strategy and how it places orders, the provided link is not specific to a strategy but is instead listed in the "AddOn" section of the help guide. This code is intended to be used in an Addon specifically to subscribe to Executions events from the Account you select not specific to a single strategy.

    To submit orders in an addon, you can see the help guide section here: http://ninjatrader.com/support/helpG...-us/submit.htm

    SubmitOrderUnmanaged is specific to a Strategy and you can find its documentation in the Strategy section here: http://ninjatrader.com/support/helpG...d_approach.htm

    To cancel an order you submit unmanaged, you would need to store its Order object for later use and call CancelOrder() and provide the stored Order object to cancel.

    The order object from OnExecutionUpdate or OnOrderUpdate can also be used with CancelOrder so long as it is not already filled or canceled.


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      "The code shown at the provided link is only the Account class and Event handler subscriptions to aid in seeing Execution events from that account in an Addon"

      I'm sorry I don't understand?

      does that mean I can't use the code in a strategy script?

      I'm trying to work directly with an account.
      Last edited by delTik; 06-07-2016, 10:43 AM.

      Comment


        #4
        Hello,

        The link provided has nothing to do with Unmanaged orders specifically but is instead a description and example of the Class named "Account". the "Account" class holds Account specific information and is also where you can Subscribe to Account event handlers. If you are unsure what event handlers are, MSDN has an accurate description as this is a general C# term. https://msdn.microsoft.com/en-us/library/ms366768.aspx

        Regarding your initial concern, if you are creating a Addon and not a strategy, the results of the event handlers are the "e" object, depending on the handler a different object will be passed. There is a good example showing the object in use for ExecutionUpdate here: http://ninjatrader.com/support/helpG...utionEventArgs. In the example, if the Account has an Execution event, the Addon would be able to see that execution. Again this is not specific to a strategy but is specific to an addon.

        In a strategy, you could instead just store the Order object and call CancelOrder(myOrderObject) to cancel the order, there would be no need to subscribe to the account unless you were using an Addon and needed to observe the account.

        You can see an example of the use of Order objects and how to Cancel those orders here: http://ninjatrader.com/support/forum...ad.php?t=18890

        In this sample the Managed approach is used, but you could use the Unmanaged approach as well, SubmitOrder returns an Order object, the same as EnterLong would return in the example.

        Code:
        Order myOrder = SubmitOrderUnmanaged(0, OrderAction.Buy, OrderType.Limit, qty, limit, 0, "", "myLimitOrder");
        
        CancelOrder(myOrder);
        you can also find a example of using Order objects in the CancelOrder page: http://ninjatrader.com/support/helpG...ancelorder.htm

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by GussJ, 03-04-2020, 03:11 PM
        11 responses
        3,221 views
        0 likes
        Last Post xiinteractive  
        Started by andrewtrades, Today, 04:57 PM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by chbruno, Today, 04:10 PM
        0 responses
        6 views
        0 likes
        Last Post chbruno
        by chbruno
         
        Started by josh18955, 03-25-2023, 11:16 AM
        6 responses
        436 views
        0 likes
        Last Post Delerium  
        Started by FAQtrader, Today, 03:35 PM
        0 responses
        9 views
        0 likes
        Last Post FAQtrader  
        Working...
        X