Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Synchronisation Problems AccPosition vs Strategy Position

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

    Synchronisation Problems AccPosition vs Strategy Position

    Hello,
    we are facing here some problems in different situations regarding Synchronisation of our actual Account Positions vs our Strategy Positions.
    Because NT is only synchronizing that positions on start or restart we are in between not always fully aware if all off our positions are in snychronisation.
    To solve this problem, it is necessary, to sync the positions in between while running live.
    unfortunately we do not find the function call of that synchronizing dll in the Help Guide, maybe it is not documented yet.
    it would be great if you ninja guys could give us that function call, so one could be able to code an own solution for an synchronisation at any given time, not only on start or restart.
    Thanks a lot in advance and have a great weekend

    best regards,

    jetjockey737

    #2
    Assuming your account position and strategy position are in sync on strategy start up...

    - The only way they would be out of sync is if an order was submitted against the account outside of the running strategy --> In which case it would be solicted order and known and expected by you the trader

    or

    - The running strategy was overfilled on one its orders in which case you are notified in NT7 programatically and can send an order in to offset this (this is the unmanaged approach) or if running managed (same as 6.5 approach) the strategy (I believe) would stop and send an alert message/email.
    RayNinjaTrader Customer Service

    Comment


      #3
      Hi ray,
      we don't know exactly why at this time, but we have certain conditions were our positions are definitely not synchronized anymore and as far as the connection is not interrupted, ninjatrader does not synchronize that positions by its own.
      no orders were made manually against the strategy.
      to prevent this no synchronized status, it would be great, if one is able to synchronize the account at any given time, but that's not possible if we cannot call the appropriate function to do so. as i said before, the function call seemed not to be documented yet.
      so it would be great, if you could give us the function call, to code a solution.

      best regards,

      jetjockey

      Comment


        #4
        Unfortunately its not that simple. I suggest analyzing your strategy closer to see how the strategy position vs account position gets out of sync.

        The only way they can get out of sync (assuming there is only one strategy running on an account/instrument) is:

        - Manual orders are generated outside of the strategy
        - An overfill condition occurs on your running strategy (IE order that the strategy cancels is filled)
        - Overfill conditions will terminate the strategy (if running a strategy 'managed') or the order status order object's 'OverFill' property will return true for any overfill condition when running 'unmanaged'

        If you find that your situation is not covered by the above then there is likely a bug we need to investigate.
        RayNinjaTrader Customer Service

        Comment


          #5
          Ray, TradeStation users have been through much the same discussion with TS developers for years. TS is well-known to make changes only at glacial speeds. But they are finally about to implement exactly the function Jetjockey and I are seeking. (It's slated for TS version 9.)

          Regardless of the cause of a discrepancy between strategy and account positions (manual trade, multiple strategies, broker error, accidental mouse click, act of God), the best way to know what positions are held in the account is to poll the account. There is no better solution. Position size is always displayed in the Basic Order and SuperDom windows. Couldn't that information also be easily accessed by a function call?

          In addition to reducing potential errors, this would improve (or at least simplify) functionality for running multiple strategies on one instrument. (One strategy could place a trade and another could exit based on the account position.) It would also allow manual trades to be handled by currently running strategies. The trader could manually add to a position and a currently running strategy could manage it. Those are significant gains.

          Would you please reconsider this request? It would boost the usefulness and confidence my clients and I have in programmed trading in NinjaTrader.

          Thank you for your help,

          Best wishes,

          Light

          Comment


            #6
            Light,

            We understand where you are coming from, but as Ray has stated it isn't that simple just to poll the account position. You should be able to cover all sync issues through strategy code though.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Jet, Light,

              Depending on your C# skills, you can create a dialog box that is created by and communicates with a strategy running on a chart. This dialog box would be able to submit orders and manually sync your strategy to the account position on that chart.

              Of course this is a custom unsupported modification, but could be done depending on your programming abilities and sync needs.

              As Ray stated, as long as you keep things sync'd up in the strategy code, you shouldn't have any issues otherwise.
              mrlogik
              NinjaTrader Ecosystem Vendor - Purelogik Trading

              Comment


                #8
                Thanks Josh and mrlogik. Josh, could you please elaborate on the complexity a bit? The Basic Entry window clearly displays the number of shares I am holding in total. I am new to NT, but as far as I know, there is no function to access that same information in my NinjaScript strategy. Given that the Basic Entry window can display my position easily, could you explain why calling it in a strategy would be complicated? (Why not just poll the source of the display?)

                mrlogik, I have plans for a window much like you describe. But suppose I manually add or subtract a few shares while a strategy is running, and I would like the strategy to manage the entire resulting position. (For argument's sake, suppose further that I only get a partial fill on the manual trade.) In such a situation, is it possible to write code in the strategy to track the total contracts held?

                Basically, I (and those I am working with) want to trade in tandem with a strategy -- at times altering positions manually and having the strategy keep up with the totals. Polling the number of shares held in the account seems like the obvious approach. But I must be missing something...

                Thank you both for your responses!

                Best wishes,

                Light

                Comment


                  #9
                  Light,

                  There are a lot of under the hood implications which require tracking. In-flight executions will be of a concern. Running multiple strategies doing different things will also make it very difficult to keep in check the correct position. This is just the tip of the iceberg without getting too deep into the technical reasoning.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    Good idea

                    Thank you Josh,

                    this is a good idea, to use a dialog which is open at runtime and use it to trigger orders. I was never really happy with the sync concept, but with your idea I can always manually sync my strategy position.

                    I just created an example strategy with 2 additional parameters,
                    bool AddNow
                    int AddNowLots

                    these 2 parameters are then just shown in a Dialog which is open while the strategy is running:
                    To enlight the concept I used my own StrategyWithParametersRunTimeEditable class
                    ( http://www.zweisteintrading.eu/Strat...tersEditor.htm )

                    The code to add position to your strategy becomes as simple as


                    protected
                    overridevoid OnBarUpdate()
                    {
                    OnBarUpdateParamsRunTimeEditor();
                    if (CrossAbove(SMA(Fast), SMA(Slow), 1))
                    EnterLong();
                    elseif (CrossBelow(SMA(Fast), SMA(Slow), 1))
                    EnterShort();

                    if(AddNow==true){
                    AddNow=
                    false;
                    if(AddNowLots<0) EnterShort(Math.Abs(AddNowLots));
                    if(AddNowLots>0) EnterLong(Math.Abs(AddNowLots));

                    }
                    }

                    Examples strategy and pictures are attached

                    regards

                    Andreas



                    Attached Files
                    Last edited by zweistein; 01-22-2010, 12:52 PM.

                    Comment


                      #11
                      Thanks Josh and Zweistein. Zweistein, you appear to have addressed the problem I was considering. Thank you for sharing your comments. I have been intending to compose a similar trading interface as well. But your's looks nicely done. Including a way to manually add to a strategy's position from your console seems like a good solution.
                      Last edited by Light; 01-22-2010, 04:21 PM.

                      Comment


                        #12
                        Please Zweistein,

                        I can not access anymore the link you exposed in your post, could you be so kind to show me where I can find this useful information? I tried to do some searches, but I didn't find anything.

                        Thank you very much!!

                        Comment


                          #13
                          Originally posted by joanNT View Post
                          Please Zweistein,

                          I can not access anymore the link you exposed in your post, could you be so kind to show me where I can find this useful information? I tried to do some searches, but I didn't find anything.

                          Thank you very much!!
                          Google has a cached version of that page: Running Strategy Parameters Editor. If you click on the Paypal button on that page, you're also led to a internetpage with his email adress.

                          I hope this is of some help.

                          Comment


                            #14
                            Hello J.O.S.

                            I changed the web site, but when you start to navigate to www.zweisteintrading.eu you should find the page.


                            regards
                            Andreas

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                            0 responses
                            628 views
                            0 likes
                            Last Post Geovanny Suaza  
                            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                            0 responses
                            359 views
                            1 like
                            Last Post Geovanny Suaza  
                            Started by Mindset, 02-09-2026, 11:44 AM
                            0 responses
                            105 views
                            0 likes
                            Last Post Mindset
                            by Mindset
                             
                            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                            0 responses
                            562 views
                            1 like
                            Last Post Geovanny Suaza  
                            Started by RFrosty, 01-28-2026, 06:49 PM
                            0 responses
                            568 views
                            1 like
                            Last Post RFrosty
                            by RFrosty
                             
                            Working...
                            X