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

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 bmartz, 03-12-2024, 06:12 AM
          5 responses
          32 views
          0 likes
          Last Post NinjaTrader_Zachary  
          Started by Aviram Y, Today, 05:29 AM
          4 responses
          13 views
          0 likes
          Last Post Aviram Y  
          Started by algospoke, 04-17-2024, 06:40 PM
          3 responses
          28 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by gentlebenthebear, Today, 01:30 AM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by cls71, Today, 04:45 AM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X