Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ExitLong()/ExitShort() not working as expected

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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 Files

    #2
    Someone will follow up on this inquiry tomorrow.
    RayNinjaTrader Customer Service

    Comment


      #3
      Tight Face,

      You will need to use TraceOrders = true and try to see what your orders are doing under the hood.
      Josh P.NinjaTrader Customer Service

      Comment


        #4
        OK. I will try that and report back results soon.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        66 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        149 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        162 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        99 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        286 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X