Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetTrailStop wih SetStopLoss

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

    SetTrailStop wih SetStopLoss

    Hello

    According to your documentation:
    "The SetTrailStop() method can NOT be used concurrently with the SetStopLoss() method for the same position".

    Suppose I used the SetStopLoss for my first position. Then, after my first position is closed, I want to use a trailing stop, can I call the SetTrailStop before entering the second position?

    Thanks

    #2
    Hello kiss987,

    Thank you for your post.

    If each position in your example used a different Entry Signal Name and you called those specific Entry Signal Names in your Set methods, then yes.

    For example:
    Code:
            protected override void Initialize()
            {
    			SetStopLoss([B]"Entry1"[/B], CalculationMode.Ticks, 10, false);
    			SetTrailStop([B]"Entry2"[/B], CalculationMode.Ticks, 5, false);
            }
            protected override void OnBarUpdate()
            {
    			if (Close[0] > Open[0])
    				EnterLong([B]"Entry1"[/B]);
    			if (Close[0] < Open[0])
    				EnterShort([B]"Entry2"[/B]);
            }
    Please let me know if you have any questions.

    Comment


      #3
      Thank you for your reply.

      What if both entries are using the same signal name but the first entry is already flat? Can I now use SetTrailStop for the second entry?

      Comment


        #4
        Hello kiss987,

        Thank you for your response.

        It would not work in that manner. You could just implement logic to adjust the SetStopLoss() as a trailing stop. We have an example on adjusting the Stop Loss to breakeven that will help get you started: http://ninjatrader.com/support/forum...ead.php?t=3222

        Please let me know if you have any questions.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by SalmaTrader, 07-07-2026, 10:26 PM
        0 responses
        45 views
        0 likes
        Last Post SalmaTrader  
        Started by CarlTrading, 07-05-2026, 01:16 PM
        0 responses
        22 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 06-17-2026, 10:32 AM
        0 responses
        14 views
        0 likes
        Last Post CaptainJack  
        Started by kinfxhk, 06-17-2026, 04:15 AM
        0 responses
        20 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 06-17-2026, 04:06 AM
        0 responses
        22 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X