![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Apr 2008
Posts: 72
Thanks: 0
Thanked 0 times in 0 posts
|
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"); 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. |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
|
Someone will follow up on this inquiry tomorrow.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Tight Face,
You will need to use TraceOrders = true and try to see what your orders are doing under the hood.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#4 |
|
Member
Join Date: Apr 2008
Posts: 72
Thanks: 0
Thanked 0 times in 0 posts
|
OK. I will try that and report back results soon.
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |