Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Handling IB disconnects

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

    Handling IB disconnects

    I have a question about IB disconnects. I have a strategy that works multitimeframe and holds overnight.

    When IB disconnects, I understand I have to rerun the strategy. the strategy won't know that it should be holding a position from the previous session.

    Is it possible to tell the strategy that it should be long instead of flat? If so, how would it know which timeframe it should be long (so that it can exit appropriately)? For example an entry on the 5 minute series will exit on a 5 minute bar, a 10 minute will enter/exit on a 10 minute, etc. So if I just say the strategy is long, it has to know long 5 minute or long 10 minute.

    If it's not possible then I'd have to close the position myself which won't be possible.

    #2
    Unfortunately once you are disconnected there is nothing you can do but restart the strategy. When you restart your strategy it will recalculate from the chart data and will not necessarily be in sync with what you had when running real-time. You will need to sync your Account Position and Strategy Position by hand.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by cunparis View Post
      I have a question about IB disconnects. I have a strategy that works multitimeframe and holds overnight.

      When IB disconnects, I understand I have to rerun the strategy. the strategy won't know that it should be holding a position from the previous session.

      Is it possible to tell the strategy that it should be long instead of flat? If so, how would it know which timeframe it should be long (so that it can exit appropriately)? For example an entry on the 5 minute series will exit on a 5 minute bar, a 10 minute will enter/exit on a 10 minute, etc. So if I just say the strategy is long, it has to know long 5 minute or long 10 minute.

      If it's not possible then I'd have to close the position myself which won't be possible.
      cunparis,

      If you are not working with tick data, but instead bar data... you can just setup your strategy to run over the same historical period it originally ran over. (In other words, if your strategy started last week... start your strategy running with last week's bars.) Although it isn't a guarantee, very very very likely you will end up with strategy positions = actual positions. Your fill numbers will be slightly different (your actual market fill versus NinjaTrader's hypothetical guess), but the positions should be the same, and it should even fill on the same timeframe.

      That's the approach I use in my minute-scale, multi-week, multi-frame strategy.

      It seems like the folks at NT don't think in this model. And therefore, unfortunately this isn't something Ninjatrader supports intelligently any more, since they obsoleted a critical feature (setting start date) in the strategies tab. But you can get something similar to this by manually launching a chart with the original time frame you were working with.

      Comment


        #4
        I know you already know this heech, but for the others that do not. The start dates for strategies run from the Strategies tab are determined by the Lookback Period defined out in Tools->Options->Data.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Josh View Post
          I know you already know this heech, but for the others that do not. The start dates for strategies run from the Strategies tab are determined by the Lookback Period defined out in Tools->Options->Data.
          Josh,

          Actually, I didn't really understand that when you said it the first time... I was distracted just trying to get autotrading up and going. But now I think I might need to put some time into this.

          I don't need to launch a chart at all? As long as I have the proper "days back" set for the minute bar section in Data options... the strategy tab will pull up that info?

          And do you know if the "start" date is calculated *every time* I hit start, or just the first time, when the strategy is created with new? In other words:

          - say I'm looking to restart a strategy that originally started on 11/24.

          - so, say it's before market opens 12/2. I would set the data field to "8 days back" (for minute bars), and then select Strategies->New Strategy. Everything gets loaded from 11/24 on.

          - now, market closes 12/2. I stop the strategy (but do not remove it).

          - before market opens 12/3... can I click "start" again, and it will run from 11/24 on? Or do I need to modify the Options->Data field to specify "9 days back"?

          If this does what I want it to do... I take back what I said about NT not handling it intelligently.

          Comment


            #6
            The increasing of bars back does not happen. You need to manually increase the lookback period if you want it to include those rolling dates.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Josh View Post
              The increasing of bars back does not happen. You need to manually increase the lookback period if you want it to include those rolling dates.
              Do I need to remove/add the strategy after I make the change? Or just before I click "start"?

              I'll test and report back (probably in a different thread), in any case.

              Comment


                #8
                If you make a change you will need to restart your strategy for it to take effect.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by NinjaTrader_Josh View Post
                  I know you already know this heech, but for the others that do not. The start dates for strategies run from the Strategies tab are determined by the Lookback Period defined out in Tools->Options->Data.
                  Wow, good to know!

                  It would be helpful if this section of the GUI gave this indication. Right now it says "Chart default look back period". Perhaps it should say "Look back period for charts and strategies".

                  Are these input values for lookback period observed during backtesting? My feeling is no, they are ignored, and instead a completely separate value of 'currentbar' has to be used. ??

                  Thanks!

                  Comment


                    #10
                    Thank you for the suggestion. For backtesting the lookback period is determined by your start and end dates for the backtest in the Strategy Analyzer.
                    Josh P.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Sparkyboy, Today, 10:57 AM
                    0 responses
                    3 views
                    0 likes
                    Last Post Sparkyboy  
                    Started by TheMarlin801, 10-13-2020, 01:40 AM
                    21 responses
                    3,917 views
                    0 likes
                    Last Post Bidder
                    by Bidder
                     
                    Started by timmbbo, 07-05-2023, 10:21 PM
                    3 responses
                    153 views
                    0 likes
                    Last Post grayfrog  
                    Started by Lumbeezl, 01-11-2022, 06:50 PM
                    30 responses
                    812 views
                    1 like
                    Last Post grayfrog  
                    Started by xiinteractive, 04-09-2024, 08:08 AM
                    3 responses
                    11 views
                    0 likes
                    Last Post NinjaTrader_Erick  
                    Working...
                    X