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 CarlTrading, 03-31-2026, 09:41 PM
            1 response
            152 views
            1 like
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            87 views
            1 like
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            131 views
            2 likes
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            127 views
            1 like
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            106 views
            0 likes
            Last Post CarlTrading  
            Working...
            X