Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Moving my Buy,OrderType.StopMarket?

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

    Moving my Buy,OrderType.StopMarket?


    I'm trying to move my Buy,order,stop in the strategy but keep getting error


    'AtmStrategyChangeEntryOrder' method error: Order ID '69f59d1d064346ef8c780e4157dfc6c9' does not exist

    the strategy is generating the order I believe under a different ID ?Please see attached pics as my reference

    this is how I'm trying to move it


    if (orderId.Length > 0)
    {

    if (GetAtmStrategyMarketPosition(atmStrategyId) == MarketPosition.Flat)
    AtmStrategyChangeEntryOrder(GetCurrentAsk(0) + (25 * (TickSize * 10)),0, orderId);



    #2
    Hello oz187,

    The error indicates that a different ID was passed than the order in question or that this was called when the order was not yet working. This could also happen if the order in question was not submitted from this strategy such as a manually submitted ATM order.

    You would need to look at what id was generated here and how you are setting the atmStrategyId variable. The sample strategy SampleATMStrategy shows the general approach at setting the ID so you can compare with that to make sure your logic is correct.


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

    Comment


      #3
      Sorry if I sound stupid But would I be correct in saying

      shortOrderId2 = GetAtmStrategyUniqueId();
      shortAtmId2 = GetAtmStrategyUniqueId();

      would generate the OrderId ID and AtmId ID and

      AtmStrategyCreate(OrderAction.Sell, OrderType.StopMarket,0,(GetCurrentAsk(0) - (25 * (TickSize * 10))),TimeInForce.Day, shortOrderId2, "OzATMS51P2", shortAtmId2, (atmCallbackErrorCode, atmCallBackId) =>

      Places the order. if so would I use my OrderId ID or AtmId ID to move the order that is placed on chart ?

      Comment


        #4
        Hello oz187,

        To answer this question I would suggest looking at the SampleATMStrategy as that is a working example of creating ATM's and has this code in it.

        The ID's how you have assigned them is the same as the sample so that is correct.

        The AtmStrategyCreate would use the atmStrategyId:

        Code:
        atmStrategyId = GetAtmStrategyUniqueId();
        orderId = GetAtmStrategyUniqueId();
        AtmStrategyCreate(OrderAction.Buy, OrderType.Limit, Low[0], 0, TimeInForce.Day, orderId, "AtmStrategyTemplate", [B]atmStrategyId[/B], (atmCallbackErrorCode, atmCallBackId) => {
        //check that the atm strategy create did not result in error, and that the requested atm strategy matches the id in callback
        if (atmCallbackErrorCode == ErrorCode.NoError && atmCallBackId == atmStrategyId)
        isAtmStrategyCreated = true;
        });
        After that any of the methods which require the atmStrategyId use atmStrategyId and not the order id.

        I look forward to being of further assistance.
        Last edited by NinjaTrader_Jesse; 08-20-2020, 11:46 AM.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CortexZenUSA, Today, 12:53 AM
        0 responses
        1 view
        0 likes
        Last Post CortexZenUSA  
        Started by CortexZenUSA, Today, 12:46 AM
        0 responses
        1 view
        0 likes
        Last Post CortexZenUSA  
        Started by usazencortex, Today, 12:43 AM
        0 responses
        5 views
        0 likes
        Last Post usazencortex  
        Started by sidlercom80, 10-28-2023, 08:49 AM
        168 responses
        2,265 views
        0 likes
        Last Post sidlercom80  
        Started by Barry Milan, Yesterday, 10:35 PM
        3 responses
        12 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Working...
        X