Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

TrailStop not being placed

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

    TrailStop not being placed

    I had a SetStopLoss working for my S2 position in code below,, when I changed the SetStopLoss to a SetTrailStop,, no stop order is being placed at all.. There are no errors in the TraceOrder output window or in the log.
    protectedoverridevoid Initialize()
    {
    EntriesPerDirection = 10;
    EntryHandling = EntryHandling.UniqueEntries;
    CalculateOnBarClose =
    true;
    ExitOnClose =
    true;
    ExitOnCloseSeconds =
    30;
    BarsRequired =
    10;
    TraceOrders =
    true;

    SetTrailStop(
    "L2", CalculationMode.Ticks, trailStop, false);
    SetTrailStop(
    "S2", CalculationMode.Ticks, trailStop, false);
    }
    Attached Files

    #2
    Are you placing only the SetTrailStop? Or are you trying to place both SetStopLoss and SetTrailStop for the same position? This would not be possible.

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      Are you placing only the SetTrailStop? Or are you trying to place both SetStopLoss and SetTrailStop for the same position? This would not be possible.
      I just used the SetStopLoss for a test and not both. I am also using a SetTrailStop for my S1 position.

      Comment


        #4
        Ok, this should work as long the two SetTrailStops reference different entry signal names. Is this working as expected in backtesting?

        Comment


          #5
          Originally posted by NinjaTrader_Bertrand View Post
          Ok, this should work as long the two SetTrailStops reference different entry signal names. Is this working as expected in backtesting?
          I have only used this backtesting..

          Comment


            #6
            Please use only one at a time and try to isolate out the issue. Remember you cannot use SetStopLoss() in conjunction with SetTrailStop().
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              I am having the same problem. When I commented out all of my SetStopLoss and replaced them all with SetTrailStop, there are no trail stops being placed.

              Comment


                #8
                Can you please post some sample code honvl, so we can take a look? Thanks!

                Comment


                  #9
                  Code:
                  				else if (longFlag && High[0] < failPrice && TradeIntensity2(true,6).Plot0[0] > 175 && TradeIntensity2(true,6).Plot0[0] < 750)
                  				{
                  					entryPrice = Close[0];
                  //					SetStopLoss(CalculationMode.Price, entryPrice - 4*TickSize);
                  					SetTrailStop(CalculationMode.Price, entryPrice - 5*TickSize);
                  					myEntryOrder = EnterLongLimit(0, true, DefaultQuantity, entryPrice, "Buy");
                  					myEntryOrder2 = EnterLongLimit(0, true, DefaultQuantity, entryPrice, "Scalp buy");
                  					longFlag = false;
                  					ACVignore = null;
                  				}
                  				else if (shortFlag && Low[0] > failPrice && TradeIntensity2(true,6).Plot1[0] > 175 && TradeIntensity2(true,6).Plot1[0] < 750)
                  				{
                  					entryPrice = Close[0];
                  //					SetStopLoss(CalculationMode.Price, entryPrice + 4*TickSize);
                  					SetTrailStop(CalculationMode.Price, entryPrice + 5*TickSize);
                  					myEntryOrder = EnterShortLimit(0, true, DefaultQuantity, entryPrice, "Sell short");
                  					myEntryOrder2 = EnterShortLimit(0, true, DefaultQuantity, entryPrice, "Scalp sell");
                  					shortFlag = false;
                  					ACVignore = null;
                  				}

                  Comment


                    #10
                    honvl, thanks for posting the code, unfortunately you can't use SetStopLoss and SetTrailStop concurrently on the same position. Please use only either one.

                    Comment


                      #11
                      I know, that's why the SetStopLoss are all commented out.

                      Comment


                        #12
                        honvl,

                        Please check your Control Center logs for errors. Please try SetTrailStop with a different CalculationMode.
                        Josh P.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                        0 responses
                        649 views
                        0 likes
                        Last Post Geovanny Suaza  
                        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                        0 responses
                        370 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by Mindset, 02-09-2026, 11:44 AM
                        0 responses
                        109 views
                        0 likes
                        Last Post Mindset
                        by Mindset
                         
                        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                        0 responses
                        574 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by RFrosty, 01-28-2026, 06:49 PM
                        0 responses
                        576 views
                        1 like
                        Last Post RFrosty
                        by RFrosty
                         
                        Working...
                        X