View Full Version : Type of limit orders place
HelloHello
09-14-2007, 11:31 AM
When you buy BuyLimit('qqq', 500); what type of limit order is this?
What I'm wondering is if I place a buy limit order at 3:59 EST yesterday will the order still be good for tomorrow? So basically is this a good till cancel order?
NinjaTrader_Dierk
09-14-2007, 11:36 AM
Please check out your "Time in Force" property on the properties dialog for the strategy and you'll see.
HelloHello
09-14-2007, 12:24 PM
thank you dierk
HelloHello
09-14-2007, 03:20 PM
Dierk,
I'm not sure where this properties thing is? You talk about the strategy... I'm not using a Ninja Script strategy, my strategies are written in trade station
HelloHello
09-14-2007, 03:29 PM
I ended up going to interactive brokers and and clicking their time inforce option. Now we're on the same page
Thanks!
HelloHello
09-17-2007, 08:22 AM
I'm trying to use the following function to place an buy limit order. I have no errors when I compile.
int NTCommand(string command, string account, string action, int quantity, string orderType, double limitPrice, double stopPrice,
string timeInForce, string oco, string orderId, string strategy, string strategyId)
Attempted_Entry = true; OrderName = "LX1" + NumToSTr(CreateOrderName, 0);
value2 = NTCommand("PLACE", symbol, "buy", 25, "LIMIT", LimitPriceL, LimitPriceL,"GTC", "", "OrderName","", "");
NinjaTrader_Ray
09-17-2007, 08:39 AM
Sorry if I overlooked but I am unsure what your question is?
HelloHello
09-17-2007, 09:25 AM
Basically what I'm trying to do is place a GTC limit order. Normally I place a limit order by using this function
int NTBuyLimit(string orderId, int quantity, double limitPrice)
value1 = NTBuyLimit("anorder", 1000, 100.25);
That function places day limit orders. I went to IB and changed the default setting "to always place GTC orders" The function still places day orders.
So I'll have to use the
int NTCommand(string command, string account, string action, int quantity, string orderType, double limitPrice, double stopPrice,
string timeInForce, string oco, string orderId, string strategy, string strategyId) function to place my Buy Limit GTC order.
I replaced the code "value1 = NTBuyLimit("anorder", 1000, 100.25);"
with:
" value2 = NTCommand("PLACE", symbol, "buy", 25, "LIMIT", LimitPriceL, LimitPriceL,"GTC", "", "OrderName","", "");
// symbol is a string, LimitPriceL is type double.
// there is a spot for limitprice and stop price. I only want to use the limit
// price, but I filled int he stop price anyway, hope that's okay
The order is not being generated. Can you see an error in my function call?
Thanks
NinjaTrader_Ray
09-17-2007, 10:35 AM
Looks fine to me, have you checked your log tab for any errors? Is Automated Trading Interface enabled via the "File" menu? Make sure you use unique orderId values.
HelloHello
09-17-2007, 12:51 PM
Automated trading is enabled and I'm connected to IB.
9/17/2007 11:43OrderOrder='1163998991/Uxxxxx' Name='' New State=PendingCancel Instrument='AIG' Action=Sell Limit price=69.22 Stop price=0 Quantity=25 Type=Limit Filled=0 Fill price=0 Error=NoError Native error='
'9/17/2007 11:43OrderOrder='1163998990/Uxxxxx' Name='' New State=PendingCancel Instrument='AIG' Action=Buy Limit price=60.16 Stop price=0 Quantity=25 Type=Limit Filled=0 Fill price=0 Error=NoError Native error=''
Above is the following log when I use
value1 = NTBuyLimit(OrderName, NumShares, LimitPriceL);
value2 = NTSellLimit(OrderName, NumShares, LimitPriceS);
<<orders are placed correctly>>
9/17/2007 11:44ATIAT 'PLACE;Uxxxxx;AIG;sell;25;LIMIT;69.2076;69.2076;GT C;DUMMY;OrderName;D2;D3' processing
9/17/2007 11:44ATIAT PLACE;Uxxxxx;AIG;buy;25;LIMIT;60.1524;60.1524;GTC; DUMMY;OrderName;D2;D3' processing
Above is the following log when I use
value2 = NTCommand("PLACE", ACCOUNT_NUM, "buy", 25, "LIMIT", LimitPriceL, LimitPriceL,"GTC", "DUMMY", "OrderName","D2", "D3");
value2 = NTCommand("PLACE", ACCOUNT_NUM, "sell", 25, "LIMIT", LimitPriceS, LimitPriceS,"GTC", "DUMMY", "OrderName","D2", "D3");
This code not not place orders at all
however value2 is "0"
<<for all orders, a different order ID is created>>
NinjaTrader_Ray
09-17-2007, 01:27 PM
Several things -
- Use caps when passing in string params, should not be an issue though.
- OrderId values are not unique since the log output clearly shows "OrderName" as your id value as opposed to unique values.
- Do not pass in "DUMMY" as an OCO id, leave this blank. This should also be unique for each OCO pair should you want to use OCO orders.
Apart from that, I suggest using the OIF Builder accessible from Tools > Options, ATI tab. Create some OIF, have them process (through Sim101) account and see if it works. When you see that it does, take a look at the text to see exactly what you should be passing in.
HelloHello
09-17-2007, 02:51 PM
Thanks Ray,
yeah order OrderName is the string... I was passing "OrderName", I'll take a look and try on the SIM 101 account
Thanks