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 11-08-2008, 06:27 PM   #1
Tight Face
Member
 
Join Date: Apr 2008
Posts: 72
Thanks: 0
Thanked 0 times in 0 posts
Default ExitLong()/ExitShort() not working as expected

I have setup a pyramiding type entry strategy with two BarsArray instruments.

So here is a typical example: I enter short, and then pyramid a second level of shares. Then when the level2 exit threshold is reached, I want to close out the second entry, and then finally the level1 exit threshold is reached, I want to close out the very first entry.

Code:
EnterShort(1,level1,Instruments[1].MasterInstrument.Name + "_ES_1");
EnterShort(1,level2,Instruments[1].MasterInstrument.Name + "_ES_2");
...
ExitShort(1,level2,Instruments[1].MasterInstrument.Name + "_XS_2",Instruments[1].MasterInstrument.Name + "_ES_2");
ExitShort(1,level1,Instruments[1].MasterInstrument.Name + "_XS_1",Instruments[1].MasterInstrument.Name + "_ES_1");
It should look like: Enter level1, Enter level2, Exit level2, Exit level1...

The problem is, this works sometimes, but not always. Even playing back over the replay data it is different. Sometimes the level2 exit is tied to the level1 entry, and sometimes the level2 exit is tied to the level1 AND level2 entry.

In the attached image, the red line should not be displayed.

Also, I am wondering why the above overloaded exit method requires that a quantity be specified? If I am supplying the entrySignal, shouldn't the method figure out what the quantity is already?

Maybe something like this:
ExitShort(int barsInProgressIndex, string signalName, string fromEntrySignal)

Thanks.
Attached Images
File Type: png SSO 10_29_2008 (3 Seconds).png (36.5 KB, 23 views)
Tight Face is offline  
Reply With Quote
Old 11-09-2008, 07:53 AM   #2
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

Someone will follow up on this inquiry tomorrow.
NinjaTrader_Ray is offline  
Reply With Quote
Old 11-10-2008, 08:09 AM   #3
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Tight Face,

You will need to use TraceOrders = true and try to see what your orders are doing under the hood.
NinjaTrader_Josh is offline  
Reply With Quote
Old 11-10-2008, 09:27 AM   #4
Tight Face
Member
 
Join Date: Apr 2008
Posts: 72
Thanks: 0
Thanked 0 times in 0 posts
Default

OK. I will try that and report back results soon.
Tight Face 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
ExitShort / ExitLong Not Exiting Ari Gold General Programming 8 07-19-2008 12:29 AM
When in 2009 is NT7 expected? Re: Memory footprint bluelou Miscellaneous Support 11 06-22-2008 05:57 PM
DrawTextFixed not update as expected goover General Programming 2 03-04-2008 08:19 PM
ExitShort() / ExitLong() andrewbee General Programming 1 02-06-2008 10:57 AM
ExitLong and ExitShort mazachan Strategy Development 3 07-30-2007 03:15 PM


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