Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Tradestation - passing in Account Numbers

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

    Tradestation - passing in Account Numbers

    The interface testing between Tradestation and IB has been working nicely.

    However today I added a parameter to my ELS code to pass in an account number. Initially I made it = "Sim101".

    When an order fired in Tradestation, the ATI did not process the order at all. There was an entry in the log for the order that said it was "processing" but it never actually did process it.

    Why would passing in the account number as explained above cause this error ?

    Thanks


    #2
    imported post

    Here is a modified NTSample strategy which worked fine by the test I just did. Note: I only replaced the "default" account by "Sim101".

    You may tweak it according your requirements:

    Code:
    { Copyright (c) 2005, NinjaTrader LLC [email][email protected][/email] }
    inputs: FastLength(9), SlowLength(18) ;
    variables: FastAvg(0), SlowAvg(0), Success(0);
    
    if LastBarOnChart and NTConnected(1) then begin
    	if NTMarketPosition("Sim101") = 0 then begin
    		{ place an order, if there is no position yet }
    		if AverageFC(Close, FastLength) > AverageFC(Close, SlowLength) then begin
    			Success = NTCommand("Place", "Sim101", "Buy", 1, "Market", 0, 0, "", "", "MyOrderId", "", "");
    		end else begin
    			Success = NTCommand("Place", "Sim101", "Sell", 1, "Market", 0, 0, "", "", "MyOrderId", "", "");
    		end;
    	end else begin
    		{ print some information on the current position and order }
    		Print("Position size: " + NumToStr(NTMarketPosition("Sim101"), 0));		
    		Print("AvgEntryPrice: " + NumToStr(NTAvgEntryPrice("Sim101"), 2));
    		Print("OrderStatus: " 	+ NTOrderStatus("MyOrderId"));
    		Print("Filled #: " 		+ NumToStr(NTFilled("MyOrderId"), 0));
    		Print("AvgFillPrice: " 	+ NumToStr(NTAvgFillPrice("MyOrderId"), 2));
    	end;
    end;

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by pvincent, 06-23-2022, 12:53 PM
    14 responses
    238 views
    0 likes
    Last Post Nyman
    by Nyman
     
    Started by TraderG23, 12-08-2023, 07:56 AM
    9 responses
    382 views
    1 like
    Last Post Gavini
    by Gavini
     
    Started by oviejo, Today, 12:28 AM
    0 responses
    1 view
    0 likes
    Last Post oviejo
    by oviejo
     
    Started by pechtri, 06-22-2023, 02:31 AM
    10 responses
    125 views
    0 likes
    Last Post Leeroy_Jenkins  
    Started by judysamnt7, 03-13-2023, 09:11 AM
    4 responses
    59 views
    0 likes
    Last Post DynamicTest  
    Working...
    X