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 Hwop38, 05-04-2026, 07:02 PM
            0 responses
            160 views
            0 likes
            Last Post Hwop38
            by Hwop38
             
            Started by CaptainJack, 04-24-2026, 11:07 PM
            0 responses
            307 views
            0 likes
            Last Post CaptainJack  
            Started by Mindset, 04-21-2026, 06:46 AM
            0 responses
            244 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            348 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            178 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Working...
            X