Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

trailing stop issue

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

    trailing stop issue

    I am trying to make a trailing stop but having issues this is what I have so far the issue the trailing stop will not activate


    what i am trying to do is have a stop then after a certian amount of ticks it will convert to a trailing stop.

    the third condition is if the user double clicks it will cancell the trailing stop and set a hard stop so the user can move it freely.




    ///condition flat

    if(bRedBar == true && nCount == 0)
    {
    if(Close[0] > Open[0] + 5*TickSize)
    {
    EnterShortStopMarket(nNumberOfSetContracts, nEntryPrice, "Short1");
    SetStopLoss("Short1", CalculationMode.Ticks, 11, false);
    SetProfitTarget("Short1", CalculationMode.Ticks, 10);

    EnterShortStopMarket(nNumberOfContractsRunner,nEnt ryPrice,"Short2");
    SetStopLoss("Short2", CalculationMode.Ticks, 11, false);


    nCount = 0;
    }




    if(Position.MarketPosition == MarketPosition.Long && Position.Quantity == 1)

    {
    if(bRedBar == true && nCount ==0)
    {
    if(Close[0] > Open[0] + 5*TickSize)
    {
    EnterShortStopMarket(nNumberOfSetContracts, nEntryPrice, "Short1");
    SetStopLoss("Short1", CalculationMode.Ticks, 11, false);
    SetProfitTarget("Short1", CalculationMode.Ticks, 10);
    if(bTrailStopSet == false)
    {
    SetTrailStop("Short2", CalculationMode.Ticks, 18, false);
    bTrailStopSet = true;

    }

    nCount ++;
    }

    if(bManualStopMovement == true && bManualStopOverride == false )
    {
    SetStopLoss("Short2", CalculationMode.Ticks, 18, false);
    bManualStopOverride = true;
    }

    }



    }

    #2
    Hello ballboy11,

    What is the condition that is not triggering?

    Have you used prints to find why the condition is not triggering?

    Please include the output from your prints if you would like assistance debugging the logic.

    Below is a link to examples I've posted that demonstrate trailing and chasing logic.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I read the manual and I guess SetStopLoss(name1) && SetTrailingStop(name1) can not be used at the same time. So the question is after so many ticks can I remove SetStop loss and add setTrailingStop? Set Stop loss will always override the trailstop

      Comment


        #4
        Hello ballboy11,

        No, Set methods cannot be unset. If SetStopLoss is used SetTrailStop will not work.

        You can instead move the stop loss using logic as I have demonstrated in the ProfitChaseStopTrailSetMethodsExample_NT8 example I have linked in my previous post.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Yes, I understand what I did was use a trailing stop and update it until my max trailing stop was reached.

          If initial stop was 11 ticks and after so many ticks I changed my trail stop to 15

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by CaptainJack, 05-29-2026, 05:09 AM
          0 responses
          248 views
          0 likes
          Last Post CaptainJack  
          Started by CaptainJack, 05-29-2026, 12:02 AM
          0 responses
          161 views
          0 likes
          Last Post CaptainJack  
          Started by charlesugo_1, 05-26-2026, 05:03 PM
          0 responses
          165 views
          1 like
          Last Post charlesugo_1  
          Started by DannyP96, 05-18-2026, 02:38 PM
          1 response
          250 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 05-11-2026, 05:56 AM
          0 responses
          201 views
          0 likes
          Last Post CarlTrading  
          Working...
          X