Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop Loss Multi Time Frame

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

    Stop Loss Multi Time Frame

    This may well be something I've misunderstood about multi instrument.

    I have a 60 min primary strategy, and add a 1min series. I open a position in the 1min, with a stoploss set, and the next time the 60 min fires, it cancels my stoploss as being expired - the position is still open.

    How do I resolve this? I can understand positions/orders might be relative to a series, but if that's the case, why does the 60 min series see the stop loss?

    thanks
    Dave

    #2
    Dave, what kind of StopLoss order are you using? The Set() or Exit() methods? If the Exit() methods are not set to liveUntilCancelled, they would expire on the next OnBarUpdate() call, which is default behavior in NT.

    Comment


      #3
      Hi,

      I'm using SetStopLoss. I'm using enter long/short, and exit long/short. I'm not sure what it would have to do with exit methods?

      Comment


        #4
        dave1992,

        Can you please turn on TraceOrders = true in Initialize() and provide us with the output? Then can you also provide us with snippets of your exact method calls? Thank you.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Here is the output for one day (a slight aside - is there some reason why exit on close doesn't seem to get logged by trace orders?)
          Code:
          02/02/2010 09:00:00 Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='' Mode=Price Value=0.874 Currency=0 Simulated=False
          02/02/2010 09:16:00  6A: Long Entry
          02/02/2010 09:16:00 Entered internal PlaceOrder() method at 02/02/2010 09:16:00: Action=Buy OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal=''
          02/02/2010 10:00:00 Cancelled expired order: BarsInProgress=0: Order='NT-00007/Backtest' Name='Stop loss' State=Working Instrument='6A 06-10' Action=Sell Limit price=0 Stop price=0.874 Quantity=1 Strategy='tt1' Type=Stop Tif=Gtc Oco='NT-00004' Filled=0 Fill price=0 Token='dc3f3a74f05c462fbe19bb7cff6b8b14' Gtd='01/12/2099 00:00:00'
          02/02/2010 17:29:00  6A: Exit 
          02/02/2010 17:29:00 Entered internal PlaceOrder() method at 02/02/2010 17:29:00: Action=Sell OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal=''
          here are my method calls
          EnterShort();
          EnterLong();
          ExitShort();
          ExitLong();
          SetStopLoss(CalculationMode.Price, stop);

          Comment


            #6
            dave1992,

            It is unclear what is happening from the traces. Would you mind attaching a stripped down version of your strategy that demonstrates this behavior and we can analyze it here? Thank you.

            ExitOnClose orders are not generated by any explicit user code so that is why it doesn't show.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              OK, it's a pretty simple strategy though
              Code:
                      protected override void Initialize()
                      { 
                          Add(PeriodType.Minute, 1); 
                          
                          TraceOrders = true;
                      }
              
                  
                      protected override void OnBarUpdate()
                      {
                          
              
                          if (BarsInProgress == 1) {
                                  if (Position.MarketPosition != MarketPosition.Flat && Time[0].Hour == 15 && Time[0].Minute == 16) {
                                  ExitShort();
                              }
              
                              if (Time[0].Hour == 13 && Time[0].Minute == 16) {
                                  SetStopLoss(CalculationMode.Price, Close[0]+50*TickSize);
                                  EnterShort();
                              }
                              return;
                          }
              
                                  
                      }

              Comment


                #8
                Dave, thanks, I could unfortunately not reproduce, I only get a cancelled SetStopLoss as the session end, which is expected. Is this on beta 14?

                Comment


                  #9
                  Yes, beta 14.

                  Could I please see your output?

                  thanks
                  Dave

                  Comment


                    #10
                    Cancelled expired order NT 7 B14

                    I just found the same bug what Dave wrote.

                    On multi timeframe strategy both the target and the stop cancelled with the "Cancelled expired order: BarsInProgress=1..."
                    message , and left the open position unprotected.

                    Regards,
                    Hatori.
                    Attached Files
                    Last edited by hatori; 04-22-2010, 12:05 PM.

                    Comment


                      #11
                      Thanks. We are looking into something at this point in time.
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #12
                        Guys, thanks for your reporting efforts, we were finally able to reproduce here and this will be fixed with our next beta round, please recheck your scripts then. Thanks

                        Comment


                          #13
                          Whew, spent several hours last night trying to debug the same problem. Hope this is fixed soon!

                          Thanks,
                          Tom

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                          0 responses
                          598 views
                          0 likes
                          Last Post Geovanny Suaza  
                          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                          0 responses
                          343 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by Mindset, 02-09-2026, 11:44 AM
                          0 responses
                          103 views
                          0 likes
                          Last Post Mindset
                          by Mindset
                           
                          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                          0 responses
                          556 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by RFrosty, 01-28-2026, 06:49 PM
                          0 responses
                          555 views
                          1 like
                          Last Post RFrosty
                          by RFrosty
                           
                          Working...
                          X