Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unexpected outcome from sync

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

    Unexpected outcome from sync

    Hi,

    I'm trying to solve a common problem that I know NT has accounted for, but I can't seem to get it to act the way I'm expecting.

    Here is my simple problem: the strategy opens a position with stop / profit target. NT disconnects, so my strategy becomes disabled. When I re-enable the strategy, NT closes my position.

    Here are my relevant settings:
    sync with account position = true
    immediately submit orders
    if (historical) return

    Even though I have open profit / stop on an open position, NT closes my position when enabled. I want it to just continue to manage the stop and profit target as it was doing before.

    Thanks,

    Rich

    #2
    Rich, thanks for reporting in - are you sure the strategy still carries the open position at the point of reenabling then? Have you confirmend this via the strategies tab as you restarted it up?



    Thanks
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Bertrand,

      Here is the output I'm getting from the strategy when I test it via disconnecting from my broker data (I'm testing this using Sim102).

      9/24/2010 6:55:00 AM Entered internal PlaceOrder() method at 9/24/2010 6:55:00 AM: Action=SellShort OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='Target' FromEntrySignal=''
      9/24/2010 6:55:00 AM Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='Target' Mode=Price Value=1161 Currency=0 Simulated=False
      9/24/2010 6:56:57 AM CancelAllOrders: BarsInProgress=0
      **NT** Disabling NinjaScript strategy 'FollowThroughDown/a23ee46d05784f3b9fab607ee65a5805'
      9/24/2010 6:57:49 AM Entered internal SetStopTarget() method: Type=Target FromEntrySignal='Target' Mode=Price Value=1001 Currency=0 Simulated=False
      9/24/2010 6:57:49 AM Entered internal SetStopTarget() method: Type=Target FromEntrySignal='Target' Mode=Price Value=1040 Currency=0 Simulated=False
      9/24/2010 6:57:49 AM Entered internal SetStopTarget() method: Type=Target FromEntrySignal='Target 1' Mode=Price Value=1 Currency=0 Simulated=False
      9/24/2010 6:57:49 AM Entered internal SetStopTarget() method: Type=Target FromEntrySignal='Target 2' Mode=Price Value=1 Currency=0 Simulated=False
      9/24/2010 6:57:49 AM Entered internal SetStopTarget() method: Type=Target FromEntrySignal='Target 3' Mode=Price Value=1 Currency=0 Simulated=False
      9/24/2010 6:57:49 AM Entered internal SetStopTarget() method: Type=Target FromEntrySignal='Target1' Mode=Ticks Value=400 Currency=0 Simulated=False
      9/24/2010 6:57:49 AM Entered internal SetStopTarget() method: Type=Target FromEntrySignal='STarget1' Mode=Ticks Value=40 Currency=0 Simulated=False
      9/24/2010 6:57:49 AM Entered internal SetStopTarget() method: Type=Target FromEntrySignal='STarget2' Mode=Ticks Value=50 Currency=0 Simulated=False
      9/24/2010 6:57:49 AM Entered internal SetStopTarget() method: Type=Target FromEntrySignal='STarget3' Mode=Ticks Value=60 Currency=0 Simulated=False
      9/24/2010 6:57:49 AM Entered internal SetStopTarget() method: Type=Target FromEntrySignal='Target' Mode=Price Value=1040 Currency=0 Simulated=False
      9/24/2010 6:58:00 AM Entered internal SetStopTarget() method: Type=Target FromEntrySignal='Target' Mode=Price Value=1001 Currency=0 Simulated=False
      **NT** Enabling NinjaScript strategy 'FollowThroughDown/a23ee46d05784f3b9fab607ee65a5805' : On starting a real-time strategy - StrategySync=SubmitImmediately SyncAccountPosition=True EntryHandling=AllEntries EntriesPerDirection=1 StopTargetHandling=PerEntryExecution ErrorHandling=StopStrategyCancelOrdersClosePositio ns ExitOnClose=False Set order quantity by=Strategy ConnectionLossHandling=KeepRunning DisconnectDelaySeconds=10 CancelEntryOrdersOnDisable=True CancelExitOrdersOnDisable=False MaxRestarts=4 in 5 minutes
      **NT** Syncing account position on starting strategy 'FollowThroughDown/a23ee46d05784f3b9fab607ee65a5805'. Account position='1S ES 12-10' Strategy position=''

      As soon as I enabled the script, it closed my position. Before I enabled the strategy, I was able to verify that the stop and profit targets were still there. Any ideas on what I'm doing wrong? Does it work differently when the broker side loses the connection but is still connected via NT? My problem is that my broker software (IB) automatically shuts down once every 24 hrs, so I invariably get a situation where it disconnects itself from NT.

      Thanks,

      Rich

      Comment


        #4
        Rich, it flattens your account position because of a flat strategy position, hence the mismatch it corrects as auto sync is enabled -

        **NT** Syncing account position on starting strategy 'FollowThroughDown/a23ee46d05784f3b9fab607ee65a5805'. Account position='1S ES 12-10' Strategy position=''

        As you enable the strategy what would it show in the strategy's tab as it's position?

        Thanks
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Before I enable the strategy, the strategy shows no open position. I thought it was supposed add 1 to the strategy position because the account position was 1. How am I supposed to configure NT so that it will start up where it left off when the strategy was disabled due to the disconnect? BTW, I'm running v7Beta.

          Comment


            #6
            No, it will ensure the account position mirrors the strategy position - so if you're strategy is flat, the account will be 'flatted' > the needed sync is then there. If were not synching up, the strategy would have from the start on, as it would for example take your live account flat instead of replicating the long position the strategy may have entered.

            1. Strategy: Flat - Account: 1 Short

            2. Signal to go long from Strategy, so Strategy: 1 Long - Account : now flat, as you previously held a short

            >> so sync lost.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Ok, that now makes sense to me. So the million dollar question is why does the strategy lose its position when the disconnect happens? In theory, I would expect the strategy to show 1 ES and the account to show 1 ES, so when I start it back up, the strategy just picks up where it left off.

              Comment


                #8
                Rich - what connection loss option are you working with in this scenario?

                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  I have it set to keep running

                  Comment


                    #10
                    Rich, are you really experiencing a connection loss event or are you disconnecting manually from your IB account?
                    BertrandNinjaTrader Customer Service

                    Comment


                      #11
                      I am disconnecting manually. I'm trying to recreate the scenario that would happen when a position is being held over several days. Let's say my strategy gets me into a position on Friday. IB's tradestation attempts to shut itself down once every 24 hrs (at the time I designate). So, do I need to make sure that the tradestation software never shuts down during this time (Sat, Sun) while nothing is going on to make sure my strategy is still running?

                      Comment


                        #12
                        Rich, you can't compare a manual disconnect & reconnect from a connection loss event producing the strategy 'Keep running' state. So you're seeing the exact same issue at TWS shutdown time when the strategy is working for you?
                        BertrandNinjaTrader Customer Service

                        Comment


                          #13
                          I'm actually not sure, because when I experenced the problem for the first time, I didn't have all my settings set the way they are now. I'll test and get back to you next week.

                          Comment


                            #14
                            Ok great, sounds good - thanks for your support and testing and have a nice weekend.
                            BertrandNinjaTrader Customer Service

                            Comment


                              #15
                              I tested it out, and when IB disconnects NT treats it the same as when I did a manual disconnect. Here is the log:

                              **NT** Strategy 'FollowThroughDown/631b9ca4bff6439cb2a60e1250718dcb' lost order connection but will keep running.
                              **NT** Strategy 'FollowThroughDown/631b9ca4bff6439cb2a60e1250718dcb' lost price connection but will keep running.
                              9/28/2010 7:00:02 PM CancelAllOrders: BarsInProgress=0
                              **NT** Disabling NinjaScript strategy 'FollowThroughDown/631b9ca4bff6439cb2a60e1250718dcb'

                              I'm trying some other methods to pick up the strategy with a little success. Let me know if NT comes out with some way to handle this.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by alifarahani, Today, 09:40 AM
                              6 responses
                              36 views
                              0 likes
                              Last Post alifarahani  
                              Started by Waxavi, Today, 02:10 AM
                              1 response
                              17 views
                              0 likes
                              Last Post NinjaTrader_LuisH  
                              Started by Kaledus, Today, 01:29 PM
                              5 responses
                              14 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by Waxavi, Today, 02:00 AM
                              1 response
                              12 views
                              0 likes
                              Last Post NinjaTrader_LuisH  
                              Started by gentlebenthebear, Today, 01:30 AM
                              3 responses
                              17 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Working...
                              X