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 NullPointStrategies, Yesterday, 05:17 AM
          0 responses
          66 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          141 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          75 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          46 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          51 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X