![]() |
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
|
|||||||
| 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 |
|
|
#1 |
|
Member
Join Date: Aug 2007
Posts: 83
Thanks: 0
Thanked 0 times in 0 posts
|
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? |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
|
Please check out your "Time in Force" property on the properties dialog for the strategy and you'll see.
Dierk
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Aug 2007
Posts: 83
Thanks: 0
Thanked 0 times in 0 posts
|
thank you dierk
|
|
|
|
|
|
#4 |
|
Member
Join Date: Aug 2007
Posts: 83
Thanks: 0
Thanked 0 times in 0 posts
|
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 |
|
|
|
|
|
#5 |
|
Member
Join Date: Aug 2007
Posts: 83
Thanks: 0
Thanked 0 times in 0 posts
|
I ended up going to interactive brokers and and clicking their time inforce option. Now we're on the same page
Thanks! |
|
|
|
|
|
#6 |
|
Member
Join Date: Aug 2007
Posts: 83
Thanks: 0
Thanked 0 times in 0 posts
|
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) Code:
Attempted_Entry = true; OrderName = "LX1" + NumToSTr(CreateOrderName, 0);
value2 = NTCommand("PLACE", symbol, "buy", 25, "LIMIT", LimitPriceL, LimitPriceL,"GTC", "", "OrderName","", "");
|
|
|
|
|
|
#7 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
Sorry if I overlooked but I am unsure what your question is?
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#8 |
|
Member
Join Date: Aug 2007
Posts: 83
Thanks: 0
Thanked 0 times in 0 posts
|
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 |
|
|
|
|
|
#9 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
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.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#10 |
|
Member
Join Date: Aug 2007
Posts: 83
Thanks: 0
Thanked 0 times in 0 posts
|
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>>
Last edited by HelloHello; 09-17-2007 at 01:07 PM.
|
|
|
|
|
|
#11 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
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.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#12 |
|
Member
Join Date: Aug 2007
Posts: 83
Thanks: 0
Thanked 0 times in 0 posts
|
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 |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Cannot place orders to MB Trading | MMS | Connecting | 18 | 01-28-2009 12:43 PM |
| Limit orders - book position kept when new orders are generated | Fabrice | Automated Trading | 6 | 10-13-2007 03:16 PM |
| Stop orders in DOM not triggering in IB/TWS as specified trigger type | JangoFolly | Miscellaneous Support | 8 | 12-13-2006 06:59 AM |
| Can't place orders in 2nd IB account that is connected 2nd | Merv | Connecting | 2 | 12-12-2005 12:39 AM |
| Negative Limit - Stop Limit Entry Orders | biswar | Automated Trading | 1 | 10-18-2005 12:58 AM |