Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy position vs. Account Position Sync

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

    Strategy position vs. Account Position Sync

    Hi Guys, I've been reading all the threads and ninjascript indications re this topic, but I am still a little confused to what setting is best to use in my case. I am planning to run my strategie from Monday am to Friday pm. I noticed that every Thursday the connection between my broker and NT drops, and I need to manually reinstate the connection. At this point I restart NT and start running my strategy, assume I have a long position in my account, how can I be sure that the strategy realizes i am already long?

    What is currently happening, is that when a sell signal occurs my account goes to flat rather than short. To make sure it actually goes short, should I make sure "
    Immediately submit live working historical orders" is switched on?

    or should I do something like "Sync acc position"? I am not really sure what that field does, please could somebody advise?

    Also, what happens in this circumstance if I am running 2 different strategies on the same instrument?

    Thanks,

    #2
    Hello,

    You will want to first fully understand the differences between account and strategy position and then you will need to decide how you want NinjaTrader to handle these differences.



    Depending on how you programmed your strategy the initial start of it will vary. When you restart the script Thursday the strategy will have a strategy position based on historical data. (long/short/flat)

    If it's not flat and you want to immediately have it enter with a market order you would choose immediately submit live working historical orders.

    If you use sync position it's going to submit and cancel open orders in order to ensure your account is the same direction as the strategy. If you're using two strategies at the same time this could conflict with eachother and you account would no longer be synced with the strategy

    For more details on all 4 of the possible combinations: http://www.ninjatrader.com/support/h..._positions.htm

    Let me know if I can be of further assistance.
    LanceNinjaTrader Customer Service

    Comment


      #3
      Lance, I had read those threads, thanks. But what is really missing in my perspective is a few example of what each scenario would look like.

      Assume my strategy is a simple moving average cross over, when the 20 SMA CrossAbove 50 SMA the system would be long and vice-verse, hence I am always in the market with a position. Assume that when on Thursday the connection drops I am running a long position, asat the time the 20 SMA > 50 SMA. I am now running a long position in my account, but when I turn on the strategy again this starts out in yellow, and when the 20 SMA CrossBelow 50 SMA it brings my position to flat, rather than short, how can I make sure that I effectively get short on the signal?

      Comment


        #4
        From the sound of it you currently have wait until flat before submitting live.

        In this case you need to decide how you want to handle the long position that is left open. If you leave it open and then wait for the strategy to submit the next order (short in this case) its going to make your account flat.

        If you wanted to avoid this you could manually close out the long position before starting the strategy so that the account is flat. Then, when wait until flat is checked it will be in sync with the strategy.

        If you wanted NinjaTrader to submit the market order manually you would set sync = to true.

        Wait for flat and sync account = true:
        If the Account Position is not flat, NinjaTrader will submit a market order(s) to reconcile the Account Position to a flat state. The strategy will then wait for the Strategy Position to reach a flat state before submitting live orders.

        It comes down to personal preference.
        LanceNinjaTrader Customer Service

        Comment


          #5
          I not sure i understood 100% how it works, I guess the best solution is to try it out live.

          But I don't think that in your reply above I have the solution to what I personally want. What I mean is, assume I realized the connection dropped immediately, and that I am long due to a signal generated by the strategy 5 min ago. Usually i get 1 signal per day, hence i want to be long. I don't want the strategy to sync, hence square my position, and wait for the next signal. I would like the strategy to realize I am long and on the next signal get me short, or alternatively. I manually exit the long, hence I am squared and I would like the strategy to enter the position immediately. Would this be possible also if the condition to my long position is a CrossAbove()?

          Comment


            #6
            Perhaps we need further clarification because it sounds like you're wanting a different method of order handling in different cases. If this is the case you would have to toggle the settings as desired.

            Additionally when you say "squared" do you mean flat or that you positions equal? Please use the terms flat, short, and long so that we can be sure as to your intentions.

            It might be better to test this out on a simulated account if you are questioning various aspects of how it might perform. You could manually disconnect your internet and test out different on connection loss handling protocols.

            This article might be of help as well, see on connection loss in the NinjaScript section: http://www.ninjatrader.com/support/h...tegies_tab.htm
            LanceNinjaTrader Customer Service

            Comment


              #7
              yes squared = flat

              how can i test it in simulation, if I am trying to connect the strategy to my real account.

              I am probably not making myself clear, it's only 1 recurring case and simple.

              On Monday assume 20 day SMA crossabove 50 day SMA, system goes long 100k EURUSD, I am long 100k EURUSD on my account

              On Thrusday connection drops, at this time 20 day SMA is still above 50 day SMA, I am left with 100k EURUSD long on my account, and happy with this as 20 day SMA is still above 50 day SMA

              I immediately re-connect the broker to NT, but currently I am running on "wait until flat before executing live" hence the strategy does nothing until the 20 SMA crossbelow 50 day SMA. AT THIS POINT THE STRATEGY GOES SHORT, HOWEVER ITS NOT SINCRONIZED WITH MY ACCOUNT, HENCE ON MY ACCOUNT I END OUT FLAT, THIS IS MY ISSUE. How can I make sure that when I turn the strategy back on it realizes I am already long and that to get me short on the signal it must sell 200k EURUSD, rather than 100k?

              Thanks,

              Comment


                #8
                If you set Immediately submit live working historical orders and the long is still active from before it will merge that long position into the new instance of the strategy. If it can't you should get an error.

                With submit live and no sync:
                Any active orders on the account previously generated by the strategy that does not match* an active strategy order will be cancelled. Should the strategy be unable to cancel and receive confirmation on the cancellation of these orders within 40 seconds the strategy will not start and an alert will be issued.
                The matching active orders on the account will then be mapped to the active strategy orders
                Any remaining active strategy orders that cannot be successfully paired will be submitted live and the strategy will begin managing your Strategy Position assuming your Account Position is in sync with it.

                You can connect to the sim data feed and move the market in different directions and practice disabling/enabling your strategy to better understand the functionality
                LanceNinjaTrader Customer Service

                Comment


                  #9
                  I will try to follow your suggestions and test it in simulation mode.

                  After your last post i assume that i should keep the settings on Immediatly submit [...] option to obtain what i have mentioned in my last thread, and probably not on sync status. Do you agree?

                  Comment


                    #10
                    Hello,

                    Based on the information I have here I would agree with that. In this specific case you would get the same outcome whether sync was on or off since the account and strategy position are the same position at the start but this could change based on other trades or strategies running.
                    LanceNinjaTrader Customer Service

                    Comment


                      #11
                      Thanks for your time, most appreciated

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by DanielTynera, Today, 01:14 AM
                      0 responses
                      2 views
                      0 likes
                      Last Post DanielTynera  
                      Started by yertle, 04-18-2024, 08:38 AM
                      9 responses
                      40 views
                      0 likes
                      Last Post yertle
                      by yertle
                       
                      Started by techgetgame, Yesterday, 11:42 PM
                      0 responses
                      11 views
                      0 likes
                      Last Post techgetgame  
                      Started by sephichapdson, Yesterday, 11:36 PM
                      0 responses
                      2 views
                      0 likes
                      Last Post sephichapdson  
                      Started by bortz, 11-06-2023, 08:04 AM
                      47 responses
                      1,615 views
                      0 likes
                      Last Post aligator  
                      Working...
                      X