Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 helpwanted, Today, 03:06 AM
        0 responses
        3 views
        0 likes
        Last Post helpwanted  
        Started by Brevo, Today, 01:45 AM
        0 responses
        6 views
        0 likes
        Last Post Brevo
        by Brevo
         
        Started by aussugardefender, Today, 01:07 AM
        0 responses
        5 views
        0 likes
        Last Post aussugardefender  
        Started by pvincent, 06-23-2022, 12:53 PM
        14 responses
        242 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Started by TraderG23, 12-08-2023, 07:56 AM
        9 responses
        384 views
        1 like
        Last Post Gavini
        by Gavini
         
        Working...
        X