• 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

Strategy automaticly syncing even when off

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

    Strategy automaticly syncing even when off

    Hello,

    I'm having a problem with what appears to be my strategy automatically syncing to a position that doesn't exist when I turn it on.

    I have attached screenshots of before turning the strategy on, after turning it on and when I turn it off.

    What is happening is when I turn it on it appears to be syncing to a position that doesn't exist. It shows in the strategy tab that a position is taken and shows P$L. It submits a live stop. No position actually exists.

    When I turn the strategy off it is supposed to close the position so what happens is it submits an order to close but since there is no position it actually enters live position.

    If I leave it on I can cancel the stop and when it hits a trade trigger in the opposite direction it will submit an order to close giving me 1 position and then submit the proper order and stop for the for the position It is supposed to and I then have 2 positions. I can close 1 position manually and everything functions normally from then.

    If the price moves in the same way as the position and hits a trade trigger nothing happens.

    The sync option was hard coded to be true and was suspected of being the problem so it was modified so it wasn't hard coded and I have tried choosing sync false but still have a problem.

    Any help you could give would be greatly appreciated.

    Regards
    Brian

    #2
    Screenshots before I turn strategy on
    Attached Files

    Comment


      #3
      Screenshots after turning the strategy on
      Attached Files

      Comment


        #4
        Screenshots after shutting strategy down
        Attached Files

        Comment


          #5
          Hello Briansstocks,

          What do you have the Tools -> Options... -> 'On starting a real-time strategy' option set to?

          With Immediately submit live working historical orders, this would be expected. The strategy is basically trying to resume and holds the historical position as if it were the current position.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            ChelseaB,

            I was instructed by the programmer that helped me create the strategy that I should have that ticked. I see your point though.

            So for live trading I want wait till the market is flat to enter then for backtesting in market replay I should tick the immediately submit live working orders?

            Thanks for the help. Looks like I will wait till Tuesday to test it out and see if it resolves my issue due to the holiday Monday in the US. Im currently in a trade I don't want to get out of.

            Regards
            Brian

            Comment


              #7
              Hi Brian,

              You have two options.

              First, you could leave immediately submit live working historical orders set and then enable sync account position with the strategy. So as the strategy starts it makes your account long too.

              Or you can use wait until flat before execution live, and make sure your account is flat before the strategy starts.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Thanks ChelseaB

                The sync option was hard coded to true and I still had the same problem. I would like the sync to work but at this point it doesn't appear to work. I will give it a test now that its not hard coded Tuesday and see if it will work.

                I will let you know what happens when I try to start the strategy when flat, I could live with that for now.

                Regards
                Brian

                Comment


                  #9
                  Hello Brian,

                  Setting the account sync to true hard coded in the strategy is not covered in the help guide or supported by NinjaTrader support for NinjaTrader 7 to do, so we can't be 100% sure about the behavior.

                  However, let me know if removing that line of code and manually setting the account sync to true still does not sync the account when enabling the strategy.
                  Last edited by NinjaTrader_ChelseaB; 09-09-2015, 06:44 AM.
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    ChelseaB,

                    Thank you for your assistance. I tried your second option and set the strategy to wait till flat to enter and it worked as expected.

                    The crazy thing Is that I tried to make the bad trade entry happen on purpose so I could experiment on if the sync option would actually work or not. Now even if I turn the sync on and set the strategy to immediately submit an order it doesn't enter a trade right away. Not sure what to think about that. I also have no idea how to recreate the scenario so I can test the settings and see if the sync option will work or not. I am set up to exit upon closing the strategy so the only way I can leave an open position is if the server just loses internet connection.

                    Regards

                    Comment


                      #11
                      ChelseaB,

                      Well looks like the change in settings caused another problem.

                      I noticed after I changed the setting my strategy under the strategy tab was yellow. I just left it and it started trading later on that session when it was supposed to and went back white.

                      Today I had a windows update on my server so I shut NT down and had to do the NT update also. I started the strategy up as normal, the yellow label under the strategy tab is yellow again and I thought nothing of it. Basically all session the price of the instrument has been where my strategy should of entered a trade but no trades are taking place.

                      I haven't changed anything except selecting wait till flat to enter and selecting false in my strategy option for the sync.

                      What is the problem now with this thing?
                      Attached Files

                      Comment


                        #12
                        Hello Brian,

                        When 'Wait until flat before execution live' is selected, if the strategy has a historical position, then it will wait until that historical position is closed before it will place the first live trade.

                        If you want to make sure that your strategy does not have a historical position, do not allow the strategy to make historical trades.

                        You can add
                        Code:
                        if (Historical) return;
                        to the first line of OnBarUpdate to prevent code from running historically.

                        Below is a link to the help guide on all 4 options that can be made with the two settings and what will occur when this is selected.
                        http://ninjatrader.com/support/helpG..._positions.htm


                        You can also run the strategy with Immediately submit live and keep the account sync on. Are you finding that with the Account sync on, that the account is not being synchronized after the first live trade?
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          ChelseaB,

                          Thanks for the link, I'm not a programmer myself but will be hiring a programmer to make some adjustment's to my strategy in the next couple of days, I will make sure that code is added then.

                          I can never figure out why sometimes the chart will show a historical trade that may or may not of actually occurred and sometimes not but I believe this last time nothing was on the chart when I started it, but I may be mistaken. It did finally start trading latter yesterday.

                          When I had immediately submit live historical trades and the sync option set to true I always had problems. What would happen is the strategy would show me a position and P&L as soon as I turned it on. If the position was short and the price was falling it would not enter a trade when the actual trade trigger to go short was hit. If the position was long and the price was falling then the strategy would buy 1 to close the short that didn't actually exist and then submit an order to open the new position giving me 2 instead of the one it was supposed to have. From then on of course the P&L would not match the actual account balance. What was worse is when a new trade trigger was hit to go the other direction it would close 1 position then open another position leaving 1 position still open so no matter what direction the price moved I was just wasting time and paying a fee for a trade that could do nothing because of opposing positions until the next reversal when I would have 2 positions again in the same direction from a different starting price.

                          Im not a programmer as I said but if the strategy actually used the account position for the sync feature instead of what is marked on the chart there would never be a problem or confusion by anyone, the feature would work as everyone would expect.

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by moyerchopra, Yesterday, 11:43 PM
                          0 responses
                          1 view
                          0 likes
                          Last Post moyerchopra  
                          Started by ttodua, Yesterday, 11:40 PM
                          0 responses
                          1 view
                          0 likes
                          Last Post ttodua
                          by ttodua
                           
                          Started by edmata1109, 12-04-2019, 09:19 PM
                          8 responses
                          28 views
                          0 likes
                          Last Post koganam
                          by koganam
                           
                          Started by maindoor, 12-03-2019, 10:45 PM
                          9 responses
                          63 views
                          0 likes
                          Last Post koganam
                          by koganam
                           
                          Started by w0lverine, Yesterday, 08:22 PM
                          0 responses
                          1 view
                          0 likes
                          Last Post w0lverine  
                          Working...
                          X