Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NTSample to send order from TS to NT

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

    NTSample to send order from TS to NT

    Hi guys,

    Everything is working fine if I use NTSample to send order from tradestation to ninjatrader. However, if I make a small change, I can not send order to NT since log file has nothing of order. my code is very simple as below. Thanks very much for help in advance.

    ccl3093

    1). stragety:
    vars: myPosition(0), Success(0);
    if LastBarOnChart and NTConnected(1) then begin
    myPosition = NTMarketPosition("Sim101");
    print (myPosition);
    if myPosition = 0 and close > open then begin
    Success = FC_NTAction("Sim101", "Buy", "MyOrderId", 1, "ST1");
    end;

    if myPosition > 0 and close < open then begin
    Success = FC_NTAction("Sim101", "Sell", "MyOrderId", 1, "ST1");
    end;
    end;

    2). FC_NTAction:
    inputs: myAccount(string), myAction(string), OrderId(string), Quantity(numericsimple), myStrategy(string);
    FC_NTAction = NTCommand("Place", myAccount, myAction, Quantity, "Market", 0, 0, "", "", OrderId, "", myStrategy);
    Last edited by ccl3093; 12-09-2016, 10:03 AM.

    #2
    It seems like that accountName passing to NTCommand must be empty string. otherwise, the order will NOT be sent out. I don't understand the reason.
    1). this one working
    Success = NTCommand("Place", "", "Buy", 1, "Market", 0, 0, "", "", "MyOrderId", "", "");
    2). this one not working since having accountname.
    Success = NTCommand("Place", "Sim101", "Buy", 1, "Market", 0, 0, "", "", "MyOrderId", "", "");

    Please help me on this basic issue.

    ccl3093

    Comment


      #3
      Hello ccl3093,

      Thank you for your post.

      There should be an error reporting in the case the Account string cannot be recognized.
      Please send me your log and trace files so that I may look into what occurred. You can do this by going to the Control Center-> Help-> Mail to Platform Support. Please list 'ATTN: Patrick H' in the subject line and reference this thread in the body of the email.

      Comment


        #4
        I did it.

        Thank you Patrick for help!

        ccl3093

        Comment


          #5
          NTCommand could not recognize the strategy string either.

          Thanks,

          ccl3093

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          558 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          324 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          545 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          547 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X