Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Reset SetStopLoss

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

    Reset SetStopLoss

    How can SetStopLoss be reset back to default behavior of not doing anything?

    There are a number of threads about this, and none of them actually answer the question. They all talk about setting it to a large value that wont execute, but that is not reset. I want a true reset that will not submit any stop orders for a new entry. Is there a special value like double.MinValue that can be passed in to actually reset the function until a later call?

    #2
    Hello aslane,

    Thanks for your post.

    One approach you could take would be to only use signal names for your SetStopLoss. When an entry using a matching signal name as the stoploss, the stop loss would be used. If the entry does not match then no stop loss would be used.

    Here is a quick example you can test:

    if (CurrentBar == 500)
    {
    SetProfitTarget("myTest", CalculationMode.Ticks, 10);
    SetStopLoss("myTest", CalculationMode.Ticks, 10, false);
    EnterLong("myTest");
    }

    if (CurrentBar == 1500)
    {
    EnterLong();
    }

    What would happen is that the first entry would end with either the stop or target filled. In the case of the 2nd entry, it would end at the session (if exit on session set).

    I am unsure if the above approach would meet your needs so I will create a feature request to allow for the ability to "turn off" the Set methods. If this already exists, your vote will be added to it. In either case I will update this thread when I have further information on the feature request.



    Comment


      #3
      So the answer is you can not do it, which is fine as I can work around it, but it would be nice to be able to disable it.

      Comment


        #4
        Hello aslane,

        Thanks for your reply.

        Correct, the set methods cannot be disabled.


        Comment


          #5
          The only alternative is to use Enter and Exit methods directly such as:

          ExitLongStopMarket(...)
          ExitShortStopMarket(...)

          This is not as convenient as SetStopLoss, but you have more flexibility.

          In managed mode you would just call ExitLongStopMarket in each OnBarUpdate to keep it alive.

          If you are trying to emulate multiple stops or transitioning stops, like starting with a fixed stop and then transitioning to a trailing stop at X ticks above breakeven, you just need to track the stop price(s) yourself and update the stop order price on each bar.


          Steve L
          NinjaTrader Ecosystem Vendor - Ninja Mastery

          Comment


            #6
            Hello aslane,

            Thanks for your patience.

            The feature request has been created as SFT-4277, "Turn off SetStopLoss()".

            Thanks for your suggestion for improvement.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Today, 05:17 AM
            0 responses
            46 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            126 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            66 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            42 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            46 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X