Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ChangeOrder method not found?

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

    ChangeOrder method not found?

    In my indicator I want to change the SL order.
    But the ChangeOrder method 'doesn't exist in the current context'.
    Why?
    How can I manage my SL order in my indicator?

    https://ninjatrader.com/support/help...hangeorder.htm

    #2
    Already found it, but it doesn't work.
    I use:

    Code:
    Order sl = account.Orders.FirstOrDefault(o => o.OrderState==OrderState.Accepted && o.Name=="Stop1");
    Print("SL = " + sl );
    if (sl!=null) {
        double newsl = IsFirstTickOfBar ? Open[1] : Open[0];
        Print("SL = " + sl + " newprice: " + newsl);
    // sl.StopPrice = sl.LimitPrice = newsl;
        sl.GetOwnerStrategy().ChangeOrder(sl, sl.Quantity, newsl, newsl);
    }
    The SL order is found and the newprice is calculated, but the order doesn't change.
    Print says:
    SL = orderId='d70b9a67b9a14b979b3005ba4bb8ade5' account='Sim101' name='Stop1' orderState=Accepted instrument='ES 12-20' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=3422.25 quantity=1 tif=Gtc oco='19b69d7920b34fb3bce537b3d5a8b225' filled=0 averageFillPrice=0 onBehalfOf='' id=33713 time='2020-10-22 12:07:20' gtd='2099-12-01' statementDate='2020-10-22'

    I started the order using an ATM strategy.

    Comment


      #3
      Hello wjadevries,

      To clarify ChangeOrder is for NinjaScript Strategies, you can find that in the strategy section of the help guide. For Indicators you would need to use the Addon section of the help guide anytime you want to access orders or account related details.

      To change an order using the addon approach you would need to use the Change method from the account. You won't be using the strategy or its methods at all in this situation and keep in mind making changes or other modifications to NinjaScript strategy based orders from outside the strategy will likely cause it ti disable.

      https://ninjatrader.com/support/help...nt8/change.htm

      Please let me know if I may be of further assistance.
      JesseNinjaTrader Customer Service

      Comment


        #4
        Thanks Jesse.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by davidoazak, Today, 01:04 AM
        0 responses
        5 views
        0 likes
        Last Post davidoazak  
        Started by biolifeketofr, Today, 12:25 AM
        0 responses
        3 views
        0 likes
        Last Post biolifeketofr  
        Started by biolifeketofr, Today, 12:24 AM
        0 responses
        3 views
        0 likes
        Last Post biolifeketofr  
        Started by hlwwith, Today, 12:01 AM
        0 responses
        3 views
        0 likes
        Last Post hlwwith
        by hlwwith
         
        Started by nordic, Yesterday, 11:29 PM
        0 responses
        5 views
        0 likes
        Last Post nordic
        by nordic
         
        Working...
        X