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 CarlTrading, Yesterday, 09:41 PM
          1 response
          14 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, Today, 02:41 AM
          0 responses
          6 views
          0 likes
          Last Post CarlTrading  
          Started by CaptainJack, Yesterday, 11:44 PM
          0 responses
          11 views
          0 likes
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          32 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          30 views
          0 likes
          Last Post CarlTrading  
          Working...
          X