![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Sunday May 26th at 12PM 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 |
|
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. |
|
|
|
| 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 |