Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

setting a conditional stop loss

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

    setting a conditional stop loss

    Hi,

    I am trying to write a ATM strategy that involves conditional stoploss.

    How can I, upon an entry of a long position, immediately set a stoploss when the following conditions are met:
    1. set a stoploss to exit at the price of the "previous 2 bar low". (e.g when I go Long on a 1hr bar timeframe, my stoploss is placed at the low of the bar that was 2hr ago)

    2. set a stoploss to exit at "1 ATR away" from the entry price (e.g when Average True Range indicator is at 20 ticks, the ATM strategy will automatically set the stop loss at 20 ticks)

    Can this be done in the "condition builder" as I am not an expert with programming?

    Many Thanks!

    #2
    Hi ggcow,

    You can do some of this by working with User variables. Choose an empty set with no other conditions and then add an action. Under misc category is Set user defined variable. Click the [...] button next to value and you can set user variables to indicators and price values.

    Then for your set stop loss you would use this user variable for the values.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Hi Ryan,

      Thanks for the advice but can I set the stoploss from inside the conditioner builder instead of the "set stoploss" page?

      Presently, I can set my stoploss at the "previous 2 bar low" when I am long. However, the stoploss will update itself after every bar as there will be a new "previous 2 bar low". This is not what I envisioned as I wanted my stoploss that was entered upon entry to be constant until I exit my position.

      Is this possible? Thanks.

      Comment


        #4
        For the most control you will have to work with code unfortunately. That would provide you access to method BarsSinceEntry() so you can fix a stop loss from that point.

        Without working in code, setting user variables to the available indicator/price values is the most advanced control available for stop loss prices.
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

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