![]() |
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Jul 2008
Location: Bay Area, CA
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
|
I have my script entering with X quantity - if something happens, it exits X quantity, no problem.
If something else happens, it only exits x/2 quantity. OK, still no problem. Then, when this same x/2 trigger happens again, it will not exit the other x/2 quantity and leave me flat. My output screen shows that the command was called, but NT does nothing. I tried calling an additional command ExitShort/Long() with no quantity mentioned - thinking I may have a problem with my variable, but it still doesn't execute. Something is blocking this order from being received by NT. Any thoughts? If I let it continue to run, many bars later it will exit and re-enter at the same time. Weird. |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
|
Please debug your strategy as per here to see what's going on: http://www.ninjatrader-support.com/v...ead.php?t=3627
Dierk
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Jul 2008
Location: Bay Area, CA
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks for the help -
Here's my log: Last Bar was Green 7/17/2008 12:47:00 PM Entered internal PlaceOrder() method at 7/17/2008 12:47:00 PM: Action=BuyToCover OrderType=Market Quantity=0.1M LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal='' 7/17/2008 12:47:00 PM Ignored PlaceOrder() method: Action=BuyToCover OrderType=Market Quantity=100000 LimitPrice=0 StopPrice=0 SignalName=Buy to cover' FromEntrySignal='' Reason='There already is a matching, terminal exit order in place' Getting out Short SH 106.68 2nd Short SH, all out 7/17/2008 12:47:00 PM Entered internal PlaceOrder() method at 7/17/2008 12:47:00 PM: Action=BuyToCover OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal='' 7/17/2008 12:47:00 PM Ignored PlaceOrder() method: Action=BuyToCover OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName=Buy to cover' FromEntrySignal='' Reason='There already is a matching, terminal exit order in place' 106.68 The first try was my original code, and the second was the extra code I added. Looks like they are both working, but I don't understand the reason why it won't be executed. There are no pending orders listed in the control center and I did not code any other weird exits. |
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Jul 2008
Location: Bay Area, CA
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
|
Later, it does get out, but only when my script is telling it to re-buy. Here is the log.
7/17/2008 12:51:44 PM Entered internal PlaceOrder() method at 7/17/2008 12:51:44 PM: Action=Buy OrderType=Market Quantity=0.2M LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal='' Got in Long, x = 0 106.72 106.68 7/17/2008 12:52:00 PM 7/17/2008 12:51:45 PM Cancelled remaining exit order: Order='52f9779e65dc4bacb4bfbd664f5366c2/Sim101' Name='Close position' State=Filled Instrument='$USDJPY' Action=BuyToCover Limit price=0 Stop price=0 Quantity=0.1M Strategy='Pipper' Type=Market Tif=Gtc Oco='' Filled=100000 Fill price=106.72 Token='52f9779e65dc4bacb4bfbd664f5366c2' Gtd='12/1/2099 12:00:00 AM' 7/17/2008 12:51:45 PM Cancelled remaining exit order: Order='f511e7f0a30d4f5aa9cb9174fb1a5e81/Sim101' Name='Buy to cover' State=Filled Instrument='$USDJPY' Action=BuyToCover Limit price=0 Stop price=0 Quantity=0.1M Strategy='Pipper' Type=Market Tif=Gtc Oco='' Filled=100000 Fill price=106.7 Token='f511e7f0a30d4f5aa9cb9174fb1a5e81' Gtd='12/1/2099 12:00:00 AM' FirstTick |
|
|
|
|
|
#5 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
|
See near bottom of page "Internal Order Handling...."
http://www.ninjatrader-support.com/H...verview36.html
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#6 |
|
Junior Member
Join Date: Jul 2008
Location: Bay Area, CA
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
|
All my orders are market orders and I do not have any Set commands, no stop losses, so the internal order handling rules don't seem applicable.
It seems there are hidden pending orders somewhere - how can I see where they are so that I can track where they came from? |
|
|
|
|
|
#7 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
|
Will come back to you.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#8 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Hi Ari Gold,
The solution is to use two uniquely named entry signals. You would use a blank fromEntrySignal parameter if you wish to exit the whole position or you can call the various signal names to exit in portions.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#9 |
|
Junior Member
Join Date: Jul 2008
Location: Bay Area, CA
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
|
Thank You Josh!
Looks like it's fixed - now to try it on real data next week...
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| ExitLong ignoring condition | verge | Strategy Development | 2 | 05-13-2008 07:28 AM |
| ExitShort() / ExitLong() | andrewbee | General Programming | 1 | 02-06-2008 10:57 AM |
| ExitLong() is being “skipped” | CashCache | Strategy Development | 2 | 01-28-2008 05:43 PM |
| Closing a forex position with ExitLong() | henry.omd | Strategy Development | 2 | 01-05-2008 12:31 PM |
| ExitLong and ExitShort | mazachan | Strategy Development | 3 | 07-30-2007 03:15 PM |