Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop adjusting

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

    Stop adjusting

    Hi

    I've got a problem with adjusting the stop. For example, when I enter a long position, I generate a stop at 5 ticks below (SetStopLoss(CalculationMode.Ticks, 5)). Now, when it didn't get touched during this bar, I want to adjust it to 5 points below the new open. The only possibility to do that would be with using the close of the old bar, but I don't want to do that because of gaps. So, is there any possibility to adjust the stop on each bar open 5 points below the bar's open?

    Regards,

    Sepp

    #2
    Hi Sepp, please try:
    Code:
    SetStopLoss(CalculationMode.Price, Open[0] - 5 * TickSize);
    AustinNinjaTrader Customer Service

    Comment


      #3
      But I don't think that this will work in backtesting because therefore Open[0] is used as the open of the last bar...
      So any possibility to get this in backtesting?

      Regards,

      Sepp

      Comment


        #4
        Sepp, Open[0] will always refer to the open of the current bar. Are you experiencing something else? You can add intrabar granularity to your backtests to help make it work.
        AustinNinjaTrader Customer Service

        Comment


          #5
          When I backtest it, Open[0] refers to the open of the last bar, not the one of the current bar. That's what I was asking. But it looks like I have to solve it with an intrabar solution. If you have other ideas, please let me know.

          Regards,

          Sepp

          Comment


            #6
            Ok, it seems like it works now, when I'm using Open[-1]. Then it uses indeed the current open. This will be good enough for me I think.

            Regards,

            Sepp

            Comment

            Latest Posts

            Collapse

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