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 Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        633 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        364 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        567 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        568 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X