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

Unable to change order using NTChange fucntion

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

    Unable to change order using NTChange fucntion

    I don't seem to be able to change the stop price with this code:
    Code:
    var:
    intrabarpersist string NTOID("");
    
    if getappinfo(airealtimecalc) = 1 then begin
    print("NTOID = ",NTOID);
    if NTOID <> "" and NTOrderStatus(NTOID) = "Accepted" then begin
    value1 = NTChange(NTOID,0,0,low);
    print(value1:0:0," ",NTOrderStatus(NTOID));
    end;
    if NTOID = "" then begin
    NTOID = string.format("{0:000000}",random(100000));
    value1 = NTCommand("PLACE","Sim101","Sell",1,"StopMarket",l ow - 10,0,"Day","",NTOID,"","");//STOP LOSS
    end;
    
    end;
    This is the print:
    NTOID =
    NTOID = 041173
    0 Accepted
    NTOID = 041173
    0 Accepted
    NTOID = 041173
    0 Accepted
    NTOID = 041173
    0 Accepted
    NTOID = 041173
    0 Accepted
    NTOID = 041173
    0 Accepted

    Seems like I must be missing something obvious, but I can't see it. I've been using this code for a long time.​

    I have recently started using the C2 platform transmit and I believe it is related to that.
    Last edited by Atomic; 02-16-2023, 09:50 AM.

    #2
    Hello Atomic,

    Thanks for your post.

    So I may accurately assist, please answer all of the questions below.
    • What version of NinjaTrader are you using (8.0.X.X)? Please provide the full version number found in the Help > About window.
    • Are you using the NTDirect.dll in an external application to interface with NinjaTrader?
    • The code you shared seems like it might be EasyLanguage code. Is this correct?
    • Does the NTCommand() method in the other platform call the Command() method in the NTDirect.dll?
    I look forward to assisting further.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_BrandonH View Post
      Hello Atomic,

      Thanks for your post.

      So I may accurately assist, please answer all of the questions below.
      • What version of NinjaTrader are you using (8.0.X.X)? Please provide the full version number found in the Help > About window.
      • Are you using the NTDirect.dll in an external application to interface with NinjaTrader?
      • The code you shared seems like it might be EasyLanguage code. Is this correct?
      • Does the NTCommand() method in the other platform call the Command() method in the NTDirect.dll?
      I look forward to assisting further.
      I am using NT 8. I send orders from the Tradestation platform using Easylanguage and the NtDirect.dll functions, which I have used for a long, long time. The help guide says that for a change command, you can pass zero for the quantity or price if you don't want to change it, and that has been the way it always seemed to work. However, in doing a test just now, it would not execute a change unless I put a non-zero value for the quantity.

      value1 = NTChange(NTCurrentOrderIDsTL[0],1,NewPrice,0);
      I had to change the above from zero to one (after the orderID before it would do a change).

      Comment


        #4
        Hello Atomic,

        Thanks for your note.

        That is correct. From the CHANGE command documentation linked below: "Pass in zero (0) values for price and quantity if you do not wish to change these order parameters."



        So that I may accurately assist, please answer ALL of the questions asked in my previous post (listed below) that you did not answer.
        • What version of NinjaTrader are you using (8.0.X.X)? Please provide the full version number found in the Help > About window.
        • Are you using the NTDirect.dll in an external application to interface with NinjaTrader?
        Thanks in advance; I look forward to your reply.
        Brandon H.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_BrandonH View Post
          Hello Atomic,

          Thanks for your note.

          That is correct. From the CHANGE command documentation linked below: "Pass in zero (0) values for price and quantity if you do not wish to change these order parameters."



          So that I may accurately assist, please answer ALL of the questions asked in my previous post (listed below) that you did not answer.
          • What version of NinjaTrader are you using (8.0.X.X)? Please provide the full version number found in the Help > About window.
          • Are you using the NTDirect.dll in an external application to interface with NinjaTrader?
          Thanks in advance; I look forward to your reply.
          I am using NT 8.0.26.1 and I send orders from a Tradestation platform using the NtDirect dll.
          I may have done something to cause this problem. Do not worry about it unless I post back to confirm that there is a problem.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by geddyisodin, Today, 05:20 AM
          1 response
          11 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by Max238, Today, 01:28 AM
          3 responses
          33 views
          0 likes
          Last Post Max238
          by Max238
           
          Started by timko, Today, 06:45 AM
          2 responses
          13 views
          0 likes
          Last Post NinjaTrader_ChristopherJ  
          Started by habeebft, Today, 07:27 AM
          0 responses
          6 views
          0 likes
          Last Post habeebft  
          Started by Tim-c, Today, 03:54 AM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Working...
          X