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 > NinjaScript Development Support > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 09-07-2010, 05:15 AM   #1
FireFly
Senior Member
 
Join Date: Apr 2007
Location: , ,
Posts: 150
Thanks: 0
Thanked 0 times in 0 posts
Default Using EnterShortStop() and EnterShortLimit() simultaneously

I have the following:

EnterShortStop(1, LTarget, "ShortL");
EnterShortLimit(1, PTarget, "ShortP");

Price is first going up so I expect the EnterShortLimit to be hit first. However, it is not executed. Some time later the EnterShortStop IS executed however.

Is there a problem having these two simultaneously?

EDIT:
I see now that only the first one is executed. If I swap them, i.e.

EnterShortLimit(1, PTarget, "ShortP");
EnterShortStop(1, LTarget, "ShortL");

then only the EnterShortLimit is executed. So apparently one order cancels the other?
But I don't understand why that should be.... ?
Last edited by FireFly; 09-07-2010 at 05:23 AM.
FireFly is offline  
Reply With Quote
Old 09-07-2010, 05:24 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
Default

FireFly, you are likely running into the Internal Order Handling Rules with this -

http://www.ninjatrader-support.com/H...verview36.html (bottom section of this link)

Please check with TraceOrders for the underlying reason of the ignored order -

http://www.ninjatrader.com/support/f...ead.php?t=3627
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 09-07-2010, 05:51 AM   #3
FireFly
Senior Member
 
Join Date: Apr 2007
Location: , ,
Posts: 150
Thanks: 0
Thanked 0 times in 0 posts
Default

I have checked the Internal Order Handling Rules but I still don't see why they would ignore the second order.
FireFly is offline  
Reply With Quote
Old 09-07-2010, 05:53 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
Default

Please run your code with the TraceOrders enabled, it would state the reason for ignoring the order in your output window then.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 09-07-2010, 06:09 AM   #5
FireFly
Senior Member
 
Join Date: Apr 2007
Location: , ,
Posts: 150
Thanks: 0
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by NinjaTrader_Bertrand View Post
Please run your code with the TraceOrders enabled, it would state the reason for ignoring the order in your output window then.
I did that already:

"An Enter() method to submit an entry order has been ignore. Please search on the term 'Internal Order Handling Rules" in the Help Guide for detailed explanation"

Well, as I said I have checked the Internal Order Handling Rules and I don't see why the order is ignored.
FireFly is offline  
Reply With Quote
Old 09-07-2010, 06:14 AM   #6
mrlogik
Certified NinjaScript Consultant
 
mrlogik's Avatar
 
Join Date: Sep 2006
Location: New York, USA
Posts: 774
Thanks: 1
Thanked 7 times in 5 posts
Default

FireFly,

Which version of NT are you running? NT6.5 does not allow what you're trying to do.

However, NT7 does if you set Unmanaged = true in your initialize code. You will have to code for this, so you may want to look over the help file and search unmanaged.
"You look closely enough, you can find everything has a ... weak spot where it can break, sooner or later"

PureLogikTrading
mrlogik is offline  
Reply With Quote
Old 09-07-2010, 06:17 AM   #7
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
Default

Quote:
Originally Posted by FireFly View Post
I did that already:

"An Enter() method to submit an entry order has been ignore. Please search on the term 'Internal Order Handling Rules" in the Help Guide for detailed explanation"

Well, as I said I have checked the Internal Order Handling Rules and I don't see why the order is ignored.
What other Set or Exit methods are you using in your code?
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 09-07-2010, 06:18 AM   #8
FireFly
Senior Member
 
Join Date: Apr 2007
Location: , ,
Posts: 150
Thanks: 0
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by mrlogik View Post
FireFly,

Which version of NT are you running? NT6.5 does not allow what you're trying to do.

However, NT7 does if you set Unmanaged = true in your initialize code. You will have to code for this, so you may want to look over the help file and search unmanaged.
I'm running NT6.5.

Thanks for your suggestion! However, I first would like to understand why the current setup doesn't work. I don't see why it goes against order handling rules.
FireFly is offline  
Reply With Quote
Old 09-07-2010, 06:26 AM   #9
FireFly
Senior Member
 
Join Date: Apr 2007
Location: , ,
Posts: 150
Thanks: 0
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by NinjaTrader_Bertrand View Post
What other Set or Exit methods are you using in your code?
I use:

EnterLong(1,"Long");

only once to enter a long position in one specific bar. After that I intend to reverse and short on

EnterShortStop(1, LTarget, "ShortL");
EnterShortLimit(1, PTarget, "ShortP");

I was expecting in this case that the position would reverse and go short on the EnterShortLimit (because price goes up first) and that a number of bars later an extra short would be entered with the EnterShortLimit.
(EntriesPerDirection>1, this is not the limitation)
FireFly is offline  
Reply With Quote
Old 09-07-2010, 08:14 AM   #10
FireFly
Senior Member
 
Join Date: Apr 2007
Location: , ,
Posts: 150
Thanks: 0
Thanked 0 times in 0 posts
Question

Any ideas why this doesn't work?
FireFly is offline  
Reply With Quote
Old 09-07-2010, 10:27 AM   #11
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
Default

Can you please attach the TraceOrders output you would get in this scenario?

Thanks
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 09-07-2010, 10:44 AM   #12
FireFly
Senior Member
 
Join Date: Apr 2007
Location: , ,
Posts: 150
Thanks: 0
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by NinjaTrader_Bertrand View Post
Can you please attach the TraceOrders output you would get in this scenario?

Thanks

2/14/2000 12:00:00 AM Entered internal PlaceOrder() method at 2/14/2000 12:00:00 AM: Action=Buy OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='Long' FromEntrySignal=''
2/15/2000 12:00:00 AM Entered internal PlaceOrder() method at 2/15/2000 12:00:00 AM: Action=SellShort OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=634.72 SignalName='ShortL' FromEntrySignal=''
2/15/2000 12:00:00 AM Entered internal PlaceOrder() method at 2/15/2000 12:00:00 AM: Action=SellShort OrderType=Limit Quantity=1 LimitPrice=674.72 StopPrice=0 SignalName='ShortP' FromEntrySignal=''
2/15/2000 12:00:00 AM Ignored PlaceOrder() method at 2/15/2000 12:00:00 AM: Action=SellShort OrderType=Limit Quantity=1 LimitPrice=674.72 StopPrice=0 SignalName=ShortP' FromEntrySignal='' Reason='An Enter() method to submit an entry order has been ignore. Please search on the term 'Internal Order Handling Rules' in the Help Guide for detailed explanation.'
FireFly is offline  
Reply With Quote
Old 09-07-2010, 12:10 PM   #13
FireFly
Senior Member
 
Join Date: Apr 2007
Location: , ,
Posts: 150
Thanks: 0
Thanked 0 times in 0 posts
Default

Any ideas?
FireFly is offline  
Reply With Quote
Old 09-07-2010, 12:28 PM   #14
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
Default

Unfortunately not FireFly, if no Exits or Sets are working in the mix...can you please send us the strategy / market / chart setting to test it here? You can direct it to support at ninjatrader dot com - thanks
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 09-07-2010, 02:00 PM   #15
FireFly
Senior Member
 
Join Date: Apr 2007
Location: , ,
Posts: 150
Thanks: 0
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by NinjaTrader_Bertrand View Post
Unfortunately not FireFly, if no Exits or Sets are working in the mix...can you please send us the strategy / market / chart setting to test it here? You can direct it to support at ninjatrader dot com - thanks
I have just mailed a stripped version of the strategy that shows the problem.
FireFly 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
EnterShortLimit just cancel the previous ExitLongLimit order ! Quinfleroy Automated Trading 2 04-14-2010 11:33 AM
Reverse using EnterShortLimit() monpere Strategy Development 12 03-16-2010 11:07 AM
EnterShortLimit question... dadof3and3 Automated Trading 5 07-06-2009 08:57 AM
EnterShort() vs EnterShortLimit() msamadov Strategy Development 1 05-20-2009 01:23 PM
EnterShortLimit / EnterLongLimit John833 Strategy Development 3 11-20-2008 04:39 PM


All times are GMT -6. The time now is 03:09 AM.