Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Concern!

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

    Concern!

    Hello,

    I'm trying to paper test NT with my IB account. Every night IB shuts down and every morning I need to disable and re-enable all my strategies (is this correct?).

    Each time I re-enable my strategies I see the "yellow" instruments to indicate the "virtual" trade so get flat before trading (my choice). So far, so good. My concern is that each time I reset the environment NT loses that "virtual" order and starts from scratch. The results is that I do not get the trades executed!

    I'm not sure I made myself clear....but I would like to solve this problem that is stopping me from "going live"!

    Please HELP!
    Thanks.
    Tex

    #2
    Hello TexFly,
    Unfortunately IB/TWS shuts down and thus you are facing the scenario.

    You can sync your account position and your strategy position to make sure you do not lose any trades. Please refer to our help guide to know more about it.

    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Thanks. I have changed the settings to "Immediately submit live working historical orders, Sync account position = true"

      Questions:

      1) It appears that NT places the historical orders not at the current bid/ask but at a previous value causing some unwanted losses. How do I rectify this?

      2) I now see the "Your strategy position for instruments are not in sync with account position...". Why if my settings are to be in sync? Is it just an alert corrected by NT placing the order immediately?

      3) My strategy is "end of the day" but I want to trade at 3.30pm. Do I need to use the multi-time frame technic?

      Tex

      Comment


        #4
        Hello Tex,
        1. NinjaTrader places historical orders at the end of the bar. Bid/Ask price is not accounted for in historical bars. You can add an higher granularity bar series in your strategy and can submit the orders in the the secondary bar. This can fine tune your entry exits.

        Please refer to this sample code which demonstrates it further.
        You can submit orders to different Bars objects. This allows you the flexibility of submitting orders to different timeframes. Like in live trading, taking entry conditions from a 5min chart means executing your order as soon as possible instead of waiting until the next 5min bar starts building. You can achieve this by


        2. Yes, is you are out of sync (i.e. strategy position does not matches with account position then NinjaTrader will submit an order).

        I will also suggest placing the below code in your strategy.
        protected override void OnBarUpdate()
        {
        if (Historical) return;
        //rest of the code
        }

        What it will do is, it will not evaluate your code on historical bars. Thus your strategy will not be in Yellow state anymore and will be live whenever you initialize it.


        3. Yes, you need to modify your code and run it with Calculate on bar close set to true. The sample code link as given above is the way to go.
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          My signal is based on the previous two days instrument behavior. If I add the code you are suggesting I guess it will never trigger any trades. Am I understanding correctly?

          If yes I cannot use that. Can I limit the "look back" to just a few days?

          Comment


            #6
            Unfortunately IB/TWS shuts down and thus you are facing the scenario.
            Here's a little trick how to keep TWS running 24/7
            This way I managed to keep TWS and my NT strategies running for 3 weeks straight.

            take a look at post#3 at


            Marco
            Last edited by marcow; 10-13-2012, 09:30 PM.

            Comment


              #7
              Originally posted by marcow View Post
              Here's a little trick how to keep TWS running 24/7
              This way I managed to keep TWS and my NT strategies running for 3 weeks straight.

              take a look at post#3 at


              Marco
              ugh, i missed this post in my previous searches... came across some other attempts..(but didn't deal with strategies).

              don't have IB... so not important.

              love the founder though ceo/founder though

              Comment


                #8
                sorry guys, my previous post had some missing information:
                In fact you're dealing with 2 issues here: the TWS AutoLogOff and the IB server restart.

                here's how to deal with them:

                1) TWS AutoLogOff: take a look at post#3 at
                http://www.ninjatrader.com/support/f...ad.php?t=51362

                2) IB Server restart: you have to make the strategies you're running immune to temporarily connection loss(es) during the IB server restart. Here's how to do this: in NT control panel, goto Tools/Options/Strategies/NinjaScript and then edit the parameters in the "on connection loss" group as follows:
                Disconnect delay seconds: 120
                Number of restart attempts: 10
                Restart within X minutes: 30
                Handling : Keep Running

                you can also hardcode this in your strategy by adding the following code in the Initialize section:

                Code:
                 
                // Connection Loss handling defaults 
                ConnectionLossHandling = ConnectionLossHandling.KeepRunning; // Keeps the strategy running as if no disconnect occurred
                DisconnectDelaySeconds = 120; // Disconnect has to be at least 120 seconds
                MaxRestartAttempts = 10;
                MaxRestartMinutes = 30; // restart strategy only if restart attempts < MaxRestartAttempts within the last 30 minutes
                Maybe it's enough to only set the DisconnectDelaySeconds to 1800 or so, but with the settings above I managed to keep my strategies running for 3 weeks 24/7 without a single problem.

                Marco

                Comment


                  #9
                  Marco, great info. Thanks!

                  Do I need to apply the same procedure even if I use TD for historical data?
                  I have IB for the orders (when will go live...) and TD for historical (because of the IB limitations...).

                  After enabling the strategies and TWS shuts off at 11pm am I going to have the problem described earlier?

                  Tex

                  Comment


                    #10
                    Do I need to apply the same procedure even if I use TD for historical data?
                    Don't know because I use IB for orders and data feed. It depends if NT disables the strategies on data feed connection loss, or on order connection loss, or on both ?
                    Maybe NT support can provide you details on this.


                    After enabling the strategies and TWS shuts off at 11pm am I going to have the problem described earlier?
                    What do you mean ? TWS doesn't shut off at 11pm if you follow the procedures as I described.

                    Your strategies will keep running -although they will turn yellow or oranje or whatever color, because of the connection loss. But after the IB server restart when the connection is restored they will continue as if nothing happened.
                    Last edited by marcow; 10-14-2012, 05:11 PM.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by algospoke, Today, 06:40 PM
                    0 responses
                    10 views
                    0 likes
                    Last Post algospoke  
                    Started by maybeimnotrader, Today, 05:46 PM
                    0 responses
                    8 views
                    0 likes
                    Last Post maybeimnotrader  
                    Started by quantismo, Today, 05:13 PM
                    0 responses
                    7 views
                    0 likes
                    Last Post quantismo  
                    Started by AttiM, 02-14-2024, 05:20 PM
                    8 responses
                    168 views
                    0 likes
                    Last Post jeronymite  
                    Started by cre8able, Today, 04:22 PM
                    0 responses
                    10 views
                    0 likes
                    Last Post cre8able  
                    Working...
                    X