Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Sync account position

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

    Sync account position

    Hi,

    On NT7, when selecting a strategy to work on a chart, there is the option to enable "sync account position".
    What does this do?
    If I start a strategy on a chart and the strategy is in the middle of a trade (it for example is assuming a long position was opened 3 bars ago were the strategy to have been enabled sooner) but my real live position is not open (I started the strategy late) then when the strategy closes out the trade (that it thinks is open), my real live position (which isn't really long because I enabled the strategy late) will now open short.
    So if the strategy was to close a long, and I wasn't long in real life, I will now be short in real life due to the strategy working with what it knows regardless of my real account position.
    I would have thought "sync account position" would tell the strategy that I'm not long and that when it goes to exit long it won't open a short for me. It would rather do nothing and continue until it opens a position and is synced with my live account so that my live account only opens the position when the strategy is opening a position.
    But this doesn't seem to be working like I wrote. It still will open my live account going short in the case described above, where I'm really not long in real life but the strategy thinks I am because it's in the middle of a trade when I start it, and the strategy will go to close long position and that will make me in real life open a short position.
    So what does "sync account position" do?

    Thanks a million.

    #2
    werido, 'SyncAccountPosition' in NT7 would sync the Account Position to your Strategy Position, i.e. if you start the strategy and it's long one contract, but you're account is flat, the strategy would by then immediately 1 contract via a Market Order to achieve syncing.

    http://www.ninjatrader.com/support/h..._account_p.htm
    BertrandNinjaTrader Customer Service

    Comment


      #3
      What about the case when I have already in my account 1lot short (on EURUSD) before starting the strategy. in this case instead of updating the strategy position to 1 lot short the trategy is flaten the account by buytocover the 1 lot short.
      This is a very dangerous situation because every time I stop the strategy to start is again I need to flatten the account.
      How can I just sync the account and the strategy by updating the strategy position (Position.Quantity) with the current account position?

      Comment


        #4
        asafs, per default the automatic sync would only work to update the account position as dictated by the strategy position, the strategy could not adopt the real world account position here, although that's on our list of feedback to look into for the future.

        What you could do is programmatically enter on a historical bar the needed qty currently present in your account so the strategy would manage this strategy position then when restarted which would be in sync to your account then.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          First I must say this is a mandatory feature to be able to close a strategy (for example weekend maintenance to the server) and to be able to restart from same position…
          Please advice me where can I obtain the current account net position for a specific instrument and the unrealized PnL for that position so I can update it into the history when start the strategy.

          Assaf

          Comment


            #6
            For those of you that have the same problem try this:

            To get your account position by instrument you can use:
            Cbi.Position myPosition = Account.Positions.FindByInstrument(Instrument);

            Then:

            myPosition.MarketPosition //for position direction
            myPosition.Quantity //for quantity size.
            myPosition.GetProfitLoss(Close[0], PerformanceUnit.Currency) //for unrealized PnL.

            I know this is unsupported but in my opinion it is mandatory to be able to close and open strategy without flattening the account!!!!

            Comment


              #7
              asafs, you're correct this unsupported snippet should be helping you here - I can understand your point of view and this feedback is already on our list for future consideration.
              BertrandNinjaTrader Customer Service

              Comment


                #8
                Dear Sir,

                I am trying to sync my real account and my strategy. For example I have 0.3K long on EURUSD on my real account and when starting the strategy I want to submit 0.3K long in history before the strategy become "live"

                I tried to submit order in history bar like this:
                if (CurrentBar == Bars.Count -3)
                initAccountPosition();

                But the order that am submitting in history bar unfortunately it also submited as a real order so in the strategy position I have 0.3K long but on my real account I have now 0.6K long.

                Appreciates your help.

                Regards,

                Assaf

                Comment


                  #9
                  Hi Assaf,

                  There's unfortunately no way to tell the strategy what your account position is. The strategy position is only generated based on the order conditions as they're run on available historical data.
                  Ryan M.NinjaTrader Customer Service

                  Comment


                    #10
                    Sync account position

                    any reason why on real account when if (CurrentBar == Bars.Count -3) the Historical flag is false

                    Assaf

                    Comment


                      #11
                      Is this a single or multi series strategy you're working with? I just ran a quick test here and it evaluates normally to 'true' on my ES 1 min here.
                      BertrandNinjaTrader Customer Service

                      Comment


                        #12
                        multi series but I am checking before
                        if
                        (BarsInProgress > 0) return;

                        I am trying to do the following in a real account:
                        when starting a strategy to submit orders in History. but when trying to submite order in history bar the order is pending and filled in the last bar as real order in the account. I just want it to be filled in the history bar for that strategy and not submited filled as real order in the real account.

                        thanks,

                        Assaf

                        Comment


                          #13
                          Do you load then enough bars to satisfy the BarsRequired for all series? I believe your issue here is tied to Historical not evaluating as you need - with a historically submitted entry order you could work out the needed sync to the current account position, but it would not be something we could officially support here.
                          BertrandNinjaTrader Customer Service

                          Comment


                            #14
                            Dear asafs, did you find a solution to this synching problem yet? I would love to know as we are trying to solve it now. When re-enabling, our strategy recalculates the positions and comes up with positions which are 1cent different from the way it calculated them in realtime and it then synch/deletes them. Same for orders. It's not making any sense to us at this point. Would love some help!

                            Comment


                              #15
                              I am using the following interface to execute my real positions in to the strategy 3 bars before the last Bar (in History).

                              Cbi.Position myPosition = Account.Positions.FindByInstrument(Instrument);

                              Then:

                              myPosition.MarketPosition //for position direction
                              myPosition.Quantity //for quantity size.
                              myPosition.GetProfitLoss(Close[0], PerformanceUnit.Currency) //for unrealized PnL.

                              my broker is IB.

                              Assaf

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by theburingdrone, Today, 10:35 PM
                              0 responses
                              1 view
                              0 likes
                              Last Post theburingdrone  
                              Started by theburingdrone, Today, 10:34 PM
                              0 responses
                              3 views
                              0 likes
                              Last Post theburingdrone  
                              Started by ntbone, Today, 10:31 PM
                              0 responses
                              2 views
                              0 likes
                              Last Post ntbone
                              by ntbone
                               
                              Started by dpolyakov, Today, 09:58 PM
                              0 responses
                              4 views
                              0 likes
                              Last Post dpolyakov  
                              Started by Bidder, Today, 09:07 PM
                              0 responses
                              6 views
                              0 likes
                              Last Post Bidder
                              by Bidder
                               
                              Working...
                              X