![]() |
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
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Apr 2007
Location: , ,
Posts: 150
Thanks: 0
Thanked 0 times in 0 posts
|
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.
|
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
|
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
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Apr 2007
Location: , ,
Posts: 150
Thanks: 0
Thanked 0 times in 0 posts
|
I have checked the Internal Order Handling Rules but I still don't see why they would ignore the second order.
|
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
|
Please run your code with the TraceOrders enabled, it would state the reason for ignoring the order in your output window then.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#5 | |
|
Senior Member
Join Date: Apr 2007
Location: , ,
Posts: 150
Thanks: 0
Thanked 0 times in 0 posts
|
Quote:
"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. |
|
|
|
|
|
|
#6 |
|
Certified NinjaScript Consultant
Join Date: Sep 2006
Location: New York, USA
Posts: 774
Thanks: 1
Thanked 7 times in 5 posts
|
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 |
|
|
|
|
|
#7 | |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
|
Quote:
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
|
#8 | |
|
Senior Member
Join Date: Apr 2007
Location: , ,
Posts: 150
Thanks: 0
Thanked 0 times in 0 posts
|
Quote:
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. |
|
|
|
|
|
|
#9 | |
|
Senior Member
Join Date: Apr 2007
Location: , ,
Posts: 150
Thanks: 0
Thanked 0 times in 0 posts
|
Quote:
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) |
|
|
|
|
|
|
#10 |
|
Senior Member
Join Date: Apr 2007
Location: , ,
Posts: 150
Thanks: 0
Thanked 0 times in 0 posts
|
Any ideas why this doesn't work?
|
|
|
|
|
|
#11 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
|
Can you please attach the TraceOrders output you would get in this scenario?
Thanks
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#12 | |
|
Senior Member
Join Date: Apr 2007
Location: , ,
Posts: 150
Thanks: 0
Thanked 0 times in 0 posts
|
Quote:
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.' |
|
|
|
|
|
|
#13 |
|
Senior Member
Join Date: Apr 2007
Location: , ,
Posts: 150
Thanks: 0
Thanked 0 times in 0 posts
|
Any ideas?
|
|
|
|
|
|
#14 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
|
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
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#15 |
|
Senior Member
Join Date: Apr 2007
Location: , ,
Posts: 150
Thanks: 0
Thanked 0 times in 0 posts
|
I have just mailed a stripped version of the strategy that shows the problem.
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |