Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetStopLoss() problem

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

    SetStopLoss() problem

    I think I may be encountering a bug related to SetStopLoss() command while backtesting on one minute data. I am not using SetStopLoss() right after the entry, rather SetStopLoss() command is issued only after price has increased by certain points. And to achieve that I am using SetStopLoss() with Price mode and I am using it within OnBarUpdate() and not within Initialize(). Here is example of my SetStopLoss() command:

    SetStopLoss("hey", CalculationMode.Price, (MIN(Close, 10)[0]) - (25 * TickSize), false);


    After my target conditions are met my strategy exits the position by using following command:

    ExitLong("", "hey");

    Now I have found that my last SetStopLoss() order is always active even after my position is exited by 'ExitLong' command. Any position initiated below the last SetStopLoss() price is immediately exited.

    Now I do understand that a stop loss order is supposed to be automatically cancelled if the managing position is closed by another strategy generated exit order and I am not sure why I am noticing this behavior. Can anyone comment please?
    Thank you.

    #2
    Once you call SetStopLoss() it will automatically be submitted for every entry order you send. If you only want it active for certain orders you will need to provide a unique fromEntrySignal name. Your future orders need to have a different entry signal name if you don't want the SetStopLoss() to apply to them as well.
    Josh P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    596 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    343 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    556 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    554 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X