![]() |
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
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Feb 2009
Posts: 16
Thanks: 0
Thanked 0 times in 0 posts
|
Hi All,
Does an OCO order submited thanks to the NTCommand function has to be linked with an ATMStrategy ? I want to use OCO orders but not the SuperDOM is this possible ? I have this in my code : Success = NTCommand("PLACE", AccountID, "SELL", TG1Qty, "LIMIT", PivotLevel + TicksTarget1, 0, "DAY", "StopLong1" & "_" & SymbolID & "_" & StrategyID & "_" & StratSubID & "_" & OrderID, "TargetLong1" & "_" & SymbolID & "_" & StrategyID & "_" & StratSubID & "_" & OrderID, "", ""); I don't have any error message, NT is processing, but nothing happen there is no order placed in the market : 01/04/2009 14:50:38;ATI;AT, 'PLACE;Sim101;FESXM09;BUY;1;LIMIT;1961;0;DAY;StopS hort1_FESXM09_NT_Cassure_v1_A_14:50:31;TargetShort 1_FESXM09_NT_Cassure_v1_A_14:50:31;;' processing ; Regards. |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
|
Hi, you don't have to call an ATM strategy template with the Command function however when you do this the stop and target will be linked via OCO. So you don't see a limit order 'Working' under the orders tab with your command?
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Feb 2009
Posts: 16
Thanks: 0
Thanked 0 times in 0 posts
|
Correct I don't see neither the limit order nor the stop order working under th orders tab.
I don't know why, is something wrong with my NTCommand (I use TradeStation for signal generation) ? |
|
|
|
|
|
#4 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
sebastienb,
Just to be clear, the way you place OCO orders for stops and targets is you need to call NTCommand() twice and place in a stop order and a target order. Then you want to be sure that on the OCO parameter for the NTCommand() that you use the same OCO id for both the stop and target orders.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Feb 2009
Posts: 16
Thanks: 0
Thanked 0 times in 0 posts
|
What's surprising is that it looks like that what I did is correct.
Here is the NTCommand that I use in my TS code : Success = NTCommand("PLACE", AccountID, "SELL", TG1Qty, "LIMIT", PivotLevel + TicksTarget1, 0, "DAY", "StopLong1" & "_" & SymbolID & "_" & StrategyID & "_" & StratSubID & "_" & OrderID, "TargetLong1" & "_" & SymbolID & "_" & StrategyID & "_" & StratSubID & "_" & OrderID, "", ""); Success = NTCommand("PLACE", AccountID, "SELL", TG1Qty, "STOP", 0, PivotLevel - TicksStop1, "DAY", "TargetLong1" & "_" & SymbolID & "_" & StrategyID & "_" & StratSubID & "_" & OrderID, "StopLong1" & "_" & SymbolID & "_" & StrategyID & "_" & StratSubID & "_" & OrderID, "", ""); |
|
|
|
|
|
#6 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Are you still experiencing difficulties?
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Feb 2009
Posts: 16
Thanks: 0
Thanked 0 times in 0 posts
|
Still experiencing difficulties. I'm currently using the Sim Mode does this have an impact on OCO orders placement ?
|
|
|
|
|
|
#8 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
|
No, the orders would then only be placed on the Sim101 internally. Are you connected to live data in NinjaTrader when you try your code?
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#9 |
|
Junior Member
Join Date: Feb 2009
Posts: 16
Thanks: 0
Thanked 0 times in 0 posts
|
Yes I'm connected to the TradeStation live date feed.
I tried to use the NTCommand to change on order and had the same problem, processing but nothing happen : Success = NTCommand("CHANGE", "", "", RemainingPos_TBT, "", 0, PrixTheorique, "", "", "StopLong1" & "_" & SymbolID & "_" & StrategyID & "_" & StratSubID & "_" & OrderID, "", ""); I didn't have any error message but my order wasn't changed and in the log tab I have this : 03/04/2009 18:04:25;ATI;AT, 'Cancel;;FESXM09;;0;;0;0;;;EnterLong_FESXM09_NT Color Switch_A_17:55:22;;' processing ; I don't understand where is my mistake |
|
|
|
|
|
#10 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
|
sebastienb, please contact me at support at ninjatrader dot com Attn Bertrand with your log and trace files and the TS code you used, I will then review this and get back to you - Thanks!
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#11 |
|
Junior Member
Join Date: Feb 2009
Posts: 16
Thanks: 0
Thanked 0 times in 0 posts
|
Ok thanks Bertrand I will send to you the code.
I have another question I have this in my strategy : If PositionLive_TBT < 0 then begin Success = NTCancel("TargetShort1" & "_" & SymbolID & "_" & StrategyID & "_" & StratSubID & "_" & OrderID); Success = NTCancel("TargetShort2" & "_" & SymbolID & "_" & StrategyID & "_" & StratSubID & "_" & OrderID); Success = NTCancel("StopShort1" & "_" & SymbolID & "_" & StrategyID & "_" & StratSubID & "_" & OrderID); Success = NTSellMarket("ExitShortOnReverse" & "_" & SymbolID & "_" & StrategyID & "_" & StratSubID & "_" & OrderID, RemainingPos_TBT); End; The SellMarket is correctly send in the but orders "TargetShort1" and TargetShort", "Stopshort1" are not canceled I'm not sure to understand why ? ManyThanks, Sebastien |
|
|
|
|
|
#12 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
|
Thanks I will have a look at the code and comment - do you get an error for the order id not being found, I suspect and issue there, can you try with a simple one to verify like the "MyOrderId" used in the NTSample TS code?
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#13 |
|
Junior Member
Join Date: Feb 2009
Posts: 16
Thanks: 0
Thanked 0 times in 0 posts
|
Bertrand I'm not sure to understand what you want me to do, to replace
Success = NTCancel("TargetShort1" & "_" & SymbolID & "_" & StrategyID & "_" & StratSubID & "_" & OrderID); by something simpler like (is my original order ID to long ?) Succes = NTCancel("MyOrderId") Or to do something like this : MyOrderID = "TargetShort1" & "_" & SymbolID & "_" & StrategyID & "_" & StratSubID & "_" & OrderID Succes = NTCancel(MyOrderId) Regards, Sebastien |
|
|
|
|
|
#14 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
|
Hi Sebastien - yes I was suggesting simplifying your code to track down the issue and then work up from there. Did you already send me your code to support at ninjatrader dot com? Then I can have a look...Thanks!
Bertrand
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| OCO orders | stefy | Strategy Development | 6 | 03-01-2010 03:53 AM |
| IOrder and OCO | CashCache | Strategy Development | 5 | 01-11-2010 08:17 AM |
| OCO Bracket Bid/Ask | rtj4201 | Automated Trading | 2 | 01-13-2009 12:42 PM |
| OCO support? | adrian | Strategy Development | 2 | 04-11-2008 12:36 PM |
| Overiding OCO | jlm0@infionline.net | General Programming | 5 | 09-13-2007 08:19 AM |