Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

modification stoploss

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

    modification stoploss

    Hello,

    before asking this question I have tried different ways to find a solution but I couldn´t:

    how can I move a stoploss maybe 2 times to a certain price or distance from entry.

    I can do as indicated in the "samplepricemodification" to set the stoploss to Breakeven or also to set the stoploss eg 10 pips distance from entry price.

    But then I can not change it again to another price or distance from entry. This condition doesn´t work and there is still filled either the profit target or the stoploss at breakeven (as in the sample mentioned above)

    How can I please move the stoploss 2nd time eg to a distance of 20 ticks from entry price? (I have tried with else and with elseif and with if....)

    Thanks
    Ton y

    #2
    Hi Tony,

    You can custom code the sequence you want, commonly using bool flags or user variables. I would do a forum search here for many examples using bool flags.

    We have a dedicated sample on using user variables for sculpting sequences here:
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      price modification

      Ryan,

      thank you for your reply. I know how variable do work in coding (also without wizard).

      This wasn´t the question, right? I refer to the "samplepricemodification" and I do ask how I can change the stoploss a 2nd time eg 20 pips more in direction of the move from breakeven so that this is realized and not only the first stoploss at breakeven.

      This is different from your answer.

      Thanks
      Tony

      Comment


        #4
        Yes, bool flags are relevant here. You need some mechanism to control what lines of code you're evaluating. Pseudo code illustrating this below:

        if (Price > 10)
        Do my #1 thing.

        if (Price > 20)
        Do my #2 thing;

        You need bool flags or user variables here because the first condition continues to evaluate true at the same time as the second condition. You then have two actions processed for both the conditionals when your expectation is that only the second condition is actioned. User variables are mentioned specifically because the sample uses them to create sequences. They can be used the same way as bool flags.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Thank you!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          88 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          48 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          30 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          34 views
          0 likes
          Last Post TheRealMorford  
          Started by Mindset, 02-28-2026, 06:16 AM
          0 responses
          68 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X