Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarsSinceEntry

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

    BarsSinceEntry

    I have multiple entries under BarsSinceEntry... they all seem to work, however I can't get Trailing Stop to work under BarsSinceEntry. By itself it works fine but the following code I can't get. Is this not possible?


    if (BarsSinceEntry() >= 20)
    {
    SetTrailStop("", CalculationMode.Ticks, 12, false);
    }

    #2
    Hello shawnkm,

    That code is valid code and would trigger the stop loss to set at 12 ticks from the entry point once the entry fills. The stop would then trail tick for tick as the price moved in a favorable direction.

    One thing to keep in mind, is that once set, a stop loss cannot be unset. This means if one order is placed and a stop loss / trail stop is used, any new order will automatically have that stop loss applied if the signal name / from entry signal pairing is not unique.

    What is the behavior you are expecting?

    What is the behavior you are experiencing?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      ChelseaB,

      Thank you for the reply. I just want to say that I think NinjaTrader and its support staff is just wonderful.... So thank you.

      Basically, it is ignoring the 20 bar waiting period. I have another entry right below the stoploss entry and it works perfectly. Its a moving average, and it waits 20 bars, then exits if it falls below the moving average.

      This stoploss will not wait the 20 bars.

      Comment


        #4
        Hello shawnkm,

        Each time you place an order, if you want the stop loss to not be applied automatically, you will need to make each new order's signal name unique (use a counter integer that increments each time you make an order). The SetTrailStop will need to use that signal name as its from entry signal.

        This will prevent the new order from automatically having the stop loss applied.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by algospoke, 04-21-2025, 06:44 PM
        2 responses
        43 views
        0 likes
        Last Post MiCe1999  
        Started by michelz, 02-18-2025, 08:30 AM
        33 responses
        1,037 views
        0 likes
        Last Post MiCe1999  
        Started by martyn73, 09-06-2019, 01:27 PM
        6 responses
        311 views
        0 likes
        Last Post bltdavid  
        Started by xfactscout, Today, 02:26 PM
        2 responses
        18 views
        0 likes
        Last Post xfactscout  
        Started by T_man, 02-26-2025, 11:51 AM
        2 responses
        46 views
        0 likes
        Last Post Fertryd2  
        Working...
        X