Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop orders do not submit when re-enabling the strategy with immediately submit

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

    Stop orders do not submit when re-enabling the strategy with immediately submit

    Hello support,

    In my strategy I have

    EntryHandling = EntryHandling.UniqueEntries;

    and I am submitting 2 unique entries.

    I have profit target for 1 and stop loss for both.

    As the strategy triggers all orders are submitted fine.

    If for some reason I need to stop the strategy and need to re-enable it, only one of the stops is submitted.

    Please explain why and how to get around the problem.

    Some clips of my code below.

    rgrs

    Ioannis

    -----------------------------------

    protected override void OnBarUpdate()
    {


    if (CurrentBar < LongPeriod)
    return;

    if (AllowLong)
    {
    if (IsFlat && longMomentum[0] > 0 && longMomentum[1] <= 0 )
    {
    Buy();
    }
    }


    if (IsLong) ManageLong();


    if (IsFlat) stopPrice = 0;
    }

    private void Buy()
    {
    double PriceTarget = Close[0] + ATR(LongPeriod)[0] * ATRTarget;
    stopPrice = Low[0] - ATR(LongPeriod)[0] * ATRTrail;
    SetStopLoss("L1", CalculationMode.Price, stopPrice, false );
    SetStopLoss("L2", CalculationMode.Price, stopPrice, false );
    EnterLong(lots, "L1");
    EnterLong(lots, "L2");
    SetProfitTarget("L1", CalculationMode.Price, PriceTarget);
    counter = 0;
    }

    private void ManageLong()
    {
    double ratchedval = (1 - (counter * Ratchet));
    double longStopPrice = Low[0] - ATR(LongPeriod)[0] * ATRTrail * ratchedval;

    if( (longStopPrice > stopPrice) || (stopPrice == 0) ) stopPrice = longStopPrice ;
    SetStopLoss("L1", CalculationMode.Price, stopPrice, false);
    SetStopLoss("L2", CalculationMode.Price, stopPrice, false);
    Values[0][0] = stopPrice;

    counter++;

    }

    #2
    Hello im197,

    I will be happy to take a look into this. The sample you provided has some variables used and likely other settings set in state.defaults, would you mind attaching a complete sample strategy that I can use to test?



    Also how were you testing this, were you running forward in realtime with the sim account or was this in one of the other modes like playback?


    I look forward to being of further assistance.

    Comment


      #3
      Hello Jesse,

      I attach the strategy. I am running it on live account keeping positions overnight hence the need for it to work even when I re-enable the strategy.

      Rgrds

      Ioannis
      Attached Files

      Comment


        #4
        Hello im197,

        Thank you for attaching the file, I will review this further to see if I can reproduce what you have described.

        I did note a couple of items while looking at the code, I see that you only used one profit target but two stops and I don't see that the profit target matches the remaining quantity of the position, are you relying on the stop/exit on close for the final part of the position? The syntax for the profit target should also come before calling the entry where you have it now it comes after the entry.

        I will update my post after I have further tested this.

        I look forward to being of further assistance.
        Last edited by NinjaTrader_Jesse; 10-02-2019, 07:25 AM.

        Comment


          #5
          Hello Jesse,

          I am relying on the stop being adjusted via the ManageLong routine to exit the 2nd entry.

          To replicate it set it up on FESX 240min chart.

          rgrds

          Comment


            #6
            Hello,

            any update on the issue?

            Comment


              #7
              Hello im197,

              At this time I have no further details that I can provide, I am currently awaiting clarification from development on this issue. Once I have more details that I can provide I will reply back here.

              I look forward to being of further assistance.

              Comment


                #8
                Hello im197,

                Thanks for your patience.

                There were a few ongoing tickets that needed to be addressed before we could get to the root issue here.

                I have been able to reproduce symptoms where split entries are not submitting all targets and stops when the strategy is re-enabled with ImmediatelySubmit. We have reported these symptoms and received the ticket ID NTEIGHT-14218 from Development. The number for this ID can be found in the Release Notes page of the Help Guide when a new version of NinjaTrader contains a fix for this issue.

                Release Notes - https://ninjatrader.com/support/help...ease_notes.htm

                If you would like to test the fix made, please send me an email at platformsupport [at] ninjatrader [dot] com with the text "Attn Jim 2293015" and a link to this forum thread. I can then provide a test build that you can use to test the fix on your end.

                I look forward to being of further assistance.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by NullPointStrategies, Today, 05:17 AM
                0 responses
                52 views
                0 likes
                Last Post NullPointStrategies  
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                130 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                70 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                44 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                48 views
                0 likes
                Last Post TheRealMorford  
                Working...
                X