Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Sync Account Strategy Issues

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

    Sync Account Strategy Issues

    Hello,

    I'm trying to develop swing trading strategy and I'm running into a few issues with regards to syncing when I try to incorporate "1-Day" data series in NT7's sample scripts.

    The type of bar is "1-min" and once there's positions placed I test the account-strategy synchronization by disabling and re-enabling the script. Which fails once it tries to sync the open positions. The strategy has no sync issues if we incorporate 5-min data or 15-min data, but once I use 1-day data the open position isn't recognized and it is closed with the label "Synchronize".

    Cheers!
    Attached Files

    #2
    Hello Christian Sepulveda, and thank you for your question.

    This is likely because NinjaTrader is truly event driven, and data comes in to NinjaTrader to trigger events with 1 minute bars more frequently than with daily bars. As a test, please change your daily bar type to 1440 minute, as there are 1440 minutes in a day. If this does not resolve your query or there are any other questions we may answer please let us know.
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      Hello Jessica,

      Thank you for your quick response. I'm going to run some tests to see if that is why the syncing is failing.

      Comment


        #4
        Jessica,

        I just ran some tests using the configurations you suggested and the output is still the same.
        The synchronization between the account and strategy keeps failing. The open positions are closed with the label "Synchronize".

        Comment


          #5
          I believe it may help if I can see what is happening in action with your 1 minute, 5 minute, 1440 minute, and 1 day charts.

          So that I may have a more complete picture of what is happening on your end, would it be possible to use the freely and publicly available screen capture software Jing, https://www.techsmith.com/jing.html , or a similar program which can record video of what is happening on your screen, so that you can show me what is occurring on your end? These quick instructions can get you started with Jing.

          1. When you start Jing, a yellow half circle will appear near the top of your screen. Please hover over it with your mouse
          2. A small + sign will extend out of this half circle. Please click on it
          3. When your cursor becomes two intersecting lines, please click and drag your mouse over an area of your screen you would like to record
          4. Please press the film strip button that appears to begin recording
          5. When you are finished recording, please press the square stop button that appears
          6. Please press the share button that appears. It consists of three vertical upward pointing arrows.

          You will then have the option to view your video on screencast.com . This is the link which can help me diagnose what is happening on your end. It is possible you will need to set up a free account in order to share videos.




          Thank you very much in advance for providing us with this information. If this procedure is not an option for you, or if there are any other questions we can answer, please let us know.
          Jessica P.NinjaTrader Customer Service

          Comment


            #6
            Jessica,

            Maybe I can explain the problem more clearly. I am using the sample code provided in NinjaTrader 7 called "SampleMACrossOver.cs".

            if (CrossAbove(SMA(Fast), SMA(Slow), 1))
            EnterLong();
            else if (CrossBelow(SMA(Fast), SMA(Slow), 1))
            EnterShort();

            I incorporate a Daily Data Series in this script "Add(PeriodType.Day,1);" (in the initialize section), and also using the lines:

            if(BarsInProgress != 0)
            return;

            At the time of having a Long position open, I disable the script, and once I re-enable the script the synchronization fails and the position is closed with the label "Synchronize". I need you to try and run this same test, and if you are able to synchronize the position once it is re-enabled, please send me the code and the configuration of your strategy. I also need to know the configuration of the script thats under Tools -> Options -> Strategies -> NinjaScript.

            This would be a much more convenient alternative for me than recording a screen capture as you suggested.

            Thanks in advance,

            Comment


              #7
              I appreciate your patience and taking time to explain. I would like to go over my test scenario with you to make sure it is accurate.

              First, I would like to make sure I am testing the appropriate thing. When I looked over your original post, I noticed an ambiguity. The emphasis below is mine,

              I'm trying to develop swing trading strategy and I'm running into a few issues with regards to syncing when I try to incorporate "1-Day" data series in NT7's sample scripts.

              The type of bar is "1-min" and once there's positions placed I test the account-strategy synchronization by disabling and re-enabling the script. Which fails once it tries to sync the open positions. The strategy has no sync issues if we incorporate 5-min data or 15-min data, but once I use 1-day data the open position isn't recognized and it is closed with the label "Synchronize".
              I would like to ask a couple clarifying questions,

              • I am testing for a difference in synchronization behavior between 1 day bars and 1440 minute bars, and 1 minute, 5 minute, and 15 minute bars. Based on your reports, you have observed 1 day and 1440 minute bars behaving one way, and 1, 5, and 15 minute bars behaving differently. Is this correct?
              • Using each of these bar types, we are not modifying the "days to load" parameter

              If I am correct in those two assumptions, I have downloaded market replay data for the previous two weeks, and have found places where I can get into long positions before testing both of these :


              • disrupting Ninja's connection to the internet
              • disabling and reenabling the strategy

              The only other pieces of information I will need from you, aside from the settings you gave me in the OP, are in your Tools -> Options -> Strategies -> NinjaScript screen. Could you provide me with a screen shot of this screen after reviewing the clarifying questions in this post?
              Jessica P.NinjaTrader Customer Service

              Comment


                #8
                Hello Christian,

                After reviewing this post, rather that each of us trying to explain a very complicated situation to one another, I have decided to prepare a short video. I was hoping you could review this video, and then let me know what your Tools -> Options -> Strategies -> NinjaScript settings are? The video should make my need for these settings clear.

                Free online storage and sharing with Screencast.com. 2 GB of storage and 2 GB of bandwidth per month for free. We won't compress, alter or take ownership of your content.


                Thanks again, this will make it easier to provide the best support possible.
                Jessica P.NinjaTrader Customer Service

                Comment


                  #9
                  Thanks for the video. I am new to NT and it was helpful because I have had problems with the positions window showing the correct position. My question is what is the relationship between Sync account position (True/False) in the strategy window and the (wait until flat/ immediately submit) choices under the NinjaScript tab? From your video it seems that the NinjaScript tab supersedes the Sync account position choice. Is that correct?

                  Comment


                    #10
                    Please disregard. I found it in the help menu. Thanks.

                    Comment


                      #11
                      Forgive me, but I have another question because manipulating the sync account options has not worked for me. In the end, my position is still off. One reason may be because my strategy is never flat. I am trying to find out if any of the four sync choices can successfully reverse my position. For example, let's assume I am short with a manual trade because the strategy somehow got out of snyc. When I enable the strategy, I expect it to buy to cover and buy to open so that I am long one lot, changing from being short one lot. The strategy normally does this with no problem. But I cannot get it to reverse properly after those times that I have had to enter a manual trade to keep the system in the market. I cannot solve this problem using the 2 choices of waiting until flat since the strategy is never flat. But, neither do I want the 2 choices to immediately submit an order. I want it to wait until the next signal and then stop and reverse. Please advise.

                      Comment


                        #12
                        This video has probably the clearest and easiest to follow explanation we have as far as how account v strategy positions in Ninja work.
                        https://www.youtube.com/watch?v=C4UwiGuOBbg&index=16&list=PLwSyiThmJzsQZ2U 77Z_wLC-qDr7ppZH90

                        Briefly, Ninja will operate in accord with the following table. Assume your strategy is in a long position when it is turned on,

                        Account in a short position
                        Sync account position = false
                        Wait until flat until executing live = true
                        Strategy waiting, Account stays short

                        Account in a short position
                        Sync account position = false
                        Immediately submit live working historical orders = true
                        Strategy long, Account stays short

                        Account in a short position

                        Sync account position = true
                        Wait until flat until executing live = true
                        Strategy waiting, Account flattens

                        Account in a short position

                        Sync account position = true
                        Immediately submit live working historical orders = true
                        Strategy long, Account goes long

                        Remember that Strategies will only re-sync on start-up. To ensure a re-sync, you will want to change the Tools -> Options -> Strategies -> NinjaScript -> On connection loss handling to something other than KeepRunning.
                        As an example, assuming that we have a flat account, and a working limit order at the exchange, Sync account position = true, Immediately submit live working historical orders = true .
                        In this situation,
                        • If your Order Handling policy was "keep running" and you were disconnected for a long time, your strategy and account positions would not be in sync.
                        • If your Order Handling policy was "Recalculate", it would automatically sync back up
                        • If it was "StopStrategy", your strategy would be disabled upon disconnection and would sync back up when reconnected.
                        Jessica P.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by benmarkal, Yesterday, 12:52 PM
                        3 responses
                        22 views
                        0 likes
                        Last Post NinjaTrader_Gaby  
                        Started by helpwanted, Today, 03:06 AM
                        1 response
                        17 views
                        0 likes
                        Last Post sarafuenonly123  
                        Started by Brevo, Today, 01:45 AM
                        0 responses
                        11 views
                        0 likes
                        Last Post Brevo
                        by Brevo
                         
                        Started by aussugardefender, Today, 01:07 AM
                        0 responses
                        6 views
                        0 likes
                        Last Post aussugardefender  
                        Started by pvincent, 06-23-2022, 12:53 PM
                        14 responses
                        244 views
                        0 likes
                        Last Post Nyman
                        by Nyman
                         
                        Working...
                        X