• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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.
    https://ninjatrader.com/support/foru...345#post521345
    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 U0000999, Today, 05:17 AM
          0 responses
          3 views
          0 likes
          Last Post U0000999  
          Started by Prataturry89, Today, 03:40 AM
          0 responses
          5 views
          0 likes
          Last Post Prataturry89  
          Started by UltraFastKetoBoost28, Today, 02:43 AM
          0 responses
          6 views
          0 likes
          Last Post UltraFastKetoBoost28  
          Started by kojakojids, Today, 02:04 AM
          0 responses
          5 views
          0 likes
          Last Post kojakojids  
          Started by pitifak, Today, 01:01 AM
          0 responses
          4 views
          0 likes
          Last Post pitifak
          by pitifak
           
          Working...
          X