• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Account Sync is wrong

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

    Account Sync is wrong

    Hi together,

    curious acc. sync problem.

    Have installed a Re-Entry-Rule, re-entry only after 3 days. It works for all underlyings, but one ....the ES future, syncronize wrong, it has still 2 contracts long while it should be in the re-entry block phase.

    I have immediate submit, syncronize acc.

    I have checked the code twice, deleted and set again. The strategy is identical on all assets it is only the long phase on the ES Future, what is syncing 2 contracts long while it should be flat?

    if i delete it manually it syncronizes again 2 long contracts

    any idea?

    add:
    I deleted the daily chart window, setup a new chart window, started the strategy again and the system show a error message: "The OCO ID cannot be reused. Please use a new OCO ID: SELL 2 StopMarket. ....

    HOW TO AVOID THESE ..... thats not really trustworthy, I am actually on a sim account but soon live..... is there anything I can add to avoid these error messages, or to delete these mystic ID´s ?

    Obviously it is not up to the re-entry rule, somehow the system is thinking we are still 2 long, syncronize these 2 long contracts with the account and has a order to close the 2 contracts, but this order is somehow ..... hanging?
    Last edited by pmmkm; 09-24-2018, 04:38 AM.

    #2
    Hello pmmkm,

    Thanks for your post.

    If the Account is short 2 contracts when the strategy is enabled with Immediately Submit, Synchronize Account, and the strategy is in a flat position, a Buy Market order of 2 contracts will be placed to synchronize the account to the strategy position.

    If you are sure the strategy position is where you want it at the time of enablement and you do not want the account to synchronize to the strategy position, I suggest using Immediately Submit without Synchronize Account Position.

    If you are seeing something contrary to this behavior, could you provide an example strategy that depicts this issue where we can see the a synchronize order that is not consistent with the account's position?

    I've included documentation on Strategy Position Vs. Account Position as well as the documentation on Syncing Account Positions for further reading.

    Strategy vs. Account Position - https://ninjatrader.com/support/help..._account_p.htm

    Syncing Account Positions - https://ninjatrader.com/support/help..._positions.htm

    As for the OCO error, if you are hitting this with an Unmanaged Approach strategy, I may suggest strict observance of OCO Id's being used so they do not get re used and unique OCO Id's are created.

    An example Umananged strategy that I have shared uses GetAtmStrategyUniqueId() to generate unique OCO Id's for realtime orders.

    Code:
                        if (State == State.Historical)
    						oco = DateTime.Now.ToString() + CurrentBar + "ShortExits";
    					else
    						oco = GetAtmStrategyUniqueId() + "ShortExits";;
    I look forward to being of any further assistance.
    Attached Files
    JimNinjaTrader Customer Service

    Comment


      #3
      No, the account is flat, if I enable the strategy, the account is 2 long, but should be flat

      If I close the 2 long, the strategy is disabled, once I enable the strategy, it is again 2 long.

      It shows a cancel pending 2sell limit order which is not to delete, it is also GTC....


      There must be a conflict between strategy and this pending 2sell limit order, but how to reset this?

      I build the strategy with the strategy builder. Any changings should be possible without programming something manually.

      I tried to add 2short manually before enabling, with the expectation that it should be flat, but, if I manually sell2 = 2 short and enable strategy, it sync to 2 long (buys 4)
      Last edited by pmmkm; 09-24-2018, 11:28 AM.

      Comment


        #4
        Hello pmmkm,

        The strategy calculates a position based on historical data and if that strategy position is out of sync with the account position, the account will submit a market order to synchronize it to the strategy position as per the Sync Account Position behavior.

        You could add a print to your strategy that prints on State.Realtime that prints the strategy position so you can see the current strategy position on the first realtime bar. If you move this condition to Set 1, it will occur before any of your other strategy code processes realtime data.

        I have attached a demonstration.

        Demo - https://drive.google.com/file/d/1lzx...w?usp=drivesdk

        Please let us know if you have any questions.
        Attached Files
        JimNinjaTrader Customer Service

        Comment


          #5
          Jim,

          thank you but I don´t really understand what you mean, I added the code what you mentionend but nothing happened or even changed or solved the problem.

          The strategy keeps 2 long open, on any historic trades, the profit or stopp loss closes the position, but not the last trade and I don´t understand why.

          By the way, i also tried to reset this sim account, deleted the complete historie, but the problem still exists. But only on the ES

          See the picture
          https://drive.google.com/file/d/1GBf...ew?usp=sharing

          The open position is 14, 7 times 2 long every day and the strategy profit stopp closes only 12, so 2 are still open ......WHY?
          Last edited by pmmkm; 09-25-2018, 02:49 AM.

          Comment


            #6
            Hello pmmkm,

            Thanks for providing a picture and explaining the issue further.

            This may be a race condition where the profit target is getting filled on the same bar as an entry and the simulation engine does not handle these in the proper order, but I would need the strategy to test further and give further input. I'd also like to report this if that is the case.

            Could you write in to platformsupport [at] ninjatrader [dot] com with the text "Attn Jim" and a link to this thread including the following information?


            I look forward top being of further assistance.
            JimNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by chartish, Today, 04:43 PM
            0 responses
            7 views
            0 likes
            Last Post chartish  
            Started by Trader17, Today, 04:07 PM
            0 responses
            4 views
            0 likes
            Last Post Trader17  
            Started by GussJ, Today, 01:30 PM
            2 responses
            18 views
            0 likes
            Last Post GussJ
            by GussJ
             
            Started by GARZONJ, Today, 12:25 PM
            3 responses
            17 views
            0 likes
            Last Post NinjaTrader_PaulH  
            Started by RandanAL, Today, 11:53 AM
            1 response
            13 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Working...
            X