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.

Reply
 
Thread Tools Display Modes
Old 09-14-2007, 11:31 AM   #1
HelloHello
Member
 
Join Date: Aug 2007
Posts: 83
Thanks: 0
Thanked 0 times in 0 posts
Default Type of limit orders place

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?
HelloHello is offline  
Reply With Quote
Old 09-14-2007, 11:36 AM   #2
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
Default

Please check out your "Time in Force" property on the properties dialog for the strategy and you'll see.
NinjaTrader_Dierk is offline  
Reply With Quote
Old 09-14-2007, 12:24 PM   #3
HelloHello
Member
 
Join Date: Aug 2007
Posts: 83
Thanks: 0
Thanked 0 times in 0 posts
Default

thank you dierk
HelloHello is offline  
Reply With Quote
Old 09-14-2007, 03:20 PM   #4
HelloHello
Member
 
Join Date: Aug 2007
Posts: 83
Thanks: 0
Thanked 0 times in 0 posts
Default

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 is offline  
Reply With Quote
Old 09-14-2007, 03:29 PM   #5
HelloHello
Member
 
Join Date: Aug 2007
Posts: 83
Thanks: 0
Thanked 0 times in 0 posts
Default

I ended up going to interactive brokers and and clicking their time inforce option. Now we're on the same page

Thanks!
HelloHello is offline  
Reply With Quote
Old 09-17-2007, 08:22 AM   #6
HelloHello
Member
 
Join Date: Aug 2007
Posts: 83
Thanks: 0
Thanked 0 times in 0 posts
Default

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","", "");
HelloHello is offline  
Reply With Quote
Old 09-17-2007, 08:39 AM   #7
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

Sorry if I overlooked but I am unsure what your question is?
NinjaTrader_Ray is offline  
Reply With Quote
Old 09-17-2007, 09:25 AM   #8
HelloHello
Member
 
Join Date: Aug 2007
Posts: 83
Thanks: 0
Thanked 0 times in 0 posts
Default

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
HelloHello is offline  
Reply With Quote
Old 09-17-2007, 10:35 AM   #9
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

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.
NinjaTrader_Ray is offline  
Reply With Quote
Old 09-17-2007, 12:51 PM   #10
HelloHello
Member
 
Join Date: Aug 2007
Posts: 83
Thanks: 0
Thanked 0 times in 0 posts
Default

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.
HelloHello is offline  
Reply With Quote
Old 09-17-2007, 01:27 PM   #11
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

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.
NinjaTrader_Ray is offline  
Reply With Quote
Old 09-17-2007, 02:51 PM   #12
HelloHello
Member
 
Join Date: Aug 2007
Posts: 83
Thanks: 0
Thanked 0 times in 0 posts
Default

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
HelloHello is offline  
Reply With Quote
Reply

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
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


All times are GMT -6. The time now is 08:40 AM.