NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > Application Technical Support > Automated Trading

Automated Trading Support for automated trading systems using NinjaScript. Support for our ATI (Automated Trading Interface) used to link an external application such as TradeStation and eSignal to NinjaTrader.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 12-02-2007, 04:50 PM   #1
arbifox
Member
 
Join Date: Jul 2007
Posts: 92
Thanks: 0
Thanked 0 times in 0 posts
Default Translating DynaOrder to NT in EFS

I am trying to convert an existing EFS script to use NT instead of DynaOrder, just to understand what I am doing is correct. Can someone from NT just verify if my logic below is accurate?

In DO:
orderid=dots5.call("BuyMarket","ER2","FUT",contrac t_exp,"",0,"GLOBEX","",contract_num);

This function returns an orderid from DynaOrder, the "BuyMarket" function is declared as the following:

function doInit() {

dots5.addFunction ("BuyMarket", DLL.INT, DLL.STDCALL, "BUYMARKET", DLL.STRING, DLL.STRING, DLL.STRING, DLL.STRING, DLL.FLOAT, DLL.STRING, DLL.STRING, DLL.SHORT);

}

I omitted a bunch of other functions for ease of reading.

Using NT, the orderid must be predeclared:

myOrderId=1;

At some point, the following function is defined:

function NTBuyMarket(orderId, quantity) {
return NTCommand("Place", "", "Buy", quantity, "Market", 0, 0, "", "", orderId, "", "");
}

I understand that you place the following in preMain:

function preMain()
{
setPriceStudy(true);
setStudyTitle("NT Sample");
dll.addFunction("AvgEntryPrice", DLL.DOUBLE, DLL.STDCALL, "AvgEntryPrice", DLL.STRING, DLL.STRING);
dll.addFunction("AvgFillPrice", DLL.DOUBLE, DLL.STDCALL, "AvgFillPrice", DLL.STRING, DLL.STRING);
dll.addFunction("Command", DLL.INT, DLL.STDCALL, "Command", DLL.STRING, DLL.STRING, DLL.STRING, DLL.STRING, DLL.INT, DLL.STRING, DLL.DOUBLE,
DLL.DOUBLE, DLL.STRING, DLL.STRING, DLL.STRING, DLL.STRING, DLL.STRING);
dll.addFunction("Connected", DLL.INT, DLL.STDCALL, "Connected");
dll.addFunction("Filled", DLL.INT, DLL.STDCALL, "Filled", DLL.STRING, DLL.STRING);
dll.addFunction("GetDouble", DLL.DOUBLE, DLL.STDCALL, "GetDouble", DLL.STRING);
dll.addFunction("GetInt", DLL.INT, DLL.STDCALL, "GetInt", DLL.STRING);
dll.addFunction("GetString", DLL.STRING, DLL.STDCALL, "GetString", DLL.STRING);
dll.addFunction("MarketPosition", DLL.INT, DLL.STDCALL, "MarketPosition", DLL.STRING, DLL.STRING);
dll.addFunction("NewOrderId", DLL.STRING, DLL.STDCALL, "NewOrderId");
dll.addFunction("Orders", DLL.STRING, DLL.STDCALL, "Orders", DLL.STRING);
dll.addFunction("OrderStatus", DLL.STRING, DLL.STDCALL, "OrderStatus", DLL.STRING, DLL.STRING);
dll.addFunction("SetUp", DLL.INT, DLL.STDCALL, "SetUp", DLL.STRING, DLL.INT);
dll.addFunction("Strategies", DLL.STRING, DLL.STDCALL, "Strategies", DLL.STRING);
dll.addFunction("StrategyPosition", DLL.INT, DLL.STDCALL, "StrategyPosition", DLL.STRING);
dll.addFunction("TearDown", DLL.INT, DLL.STDCALL, "TearDown");
}

I could then place the order by the following command in my script:

NTBuyMarket("MyOrderId", 1);

What I am having a hard time understanding is what to expect back from the functions in terms of status codes. I control all of my order management through successive status code settings, so I just need to understand how these are mapped.

Is there one example that can be posted to follow the lifeline of just placing a market order? The steps I am looking for is placing the order, getting the state of the order in terms of has it been executed, and then the fill price.

Just as an example from your documentation:

// Get the current status of an order.
function NTOrderStatus(orderId) {
return dll.call("OrderStatus", orderId, account);
}

I know if I place the following command:

myOrderStatus=NTOrderStatus(myOrderId);

I could get the status back, but without a mapping of the return codes, this proves difficult. Is there some documention I am missing?

Regards,

Thomas
arbifox is offline  
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Just downloaded NT, translating from TS Januson General Programming 2 05-17-2007 01:23 PM


All times are GMT -6. The time now is 01:39 PM.