Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Strategy Start Behavior Problem

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

    Strategy Start Behavior Problem

    I have a ETH always long or short strategy that exits its positions upon session close. Then, upon session open, re-initiates the long or short position it had before the close when the market opens up again. But I've run into an issue.

    I like to reboot/refresh my computer during the 1hr CME break (2-3PM PST). But doing this requires that I reboot the strategy obviously. I was currently using the "wait until flat" start behavior but I noticed that with this setting, the strategy remained yellow during the close and even during the open, it never turned green because it still had a virtual position that hadn't exited yet.

    I'm attempting to have an extremely confusing dialogue with support on this issue which is only getting more confusing. My question is which start behavior will enable me to reboot my system during session close (2-3PM PST) and allow the strategy to begin trading upon the open? I'm leaning towards the "immediately submit, synchronize account" setting but I'm not sure if that would make the strategy run correctly, the "wait until flat" clearly is not an option and doesn't work.

    Thanks in advance!

    #2
    Another point I was thinking about. When I start the strategy up on reboot during market hours, I assumed the strategy knew the market was closed (based on it's exiting all positions at market close behavior) and therefore had a virtual flat position which would turn it green and make it ready to trade upon the open. But this is not the case.

    Essentially, when you restart the strategy during market close with "wait until flat" start behavior, it remains yellow because it still has a virtual position. In other words, it doesn't know it's supposed to be flat and doesn't realize the market is closed. I'd great appreciate your input on this issue, thank you.

    Comment


      #3
      Hit trader14, thanks for your post.

      You should use the AdoptAccounPosition startup if you want the strategy to keep trading the open position after you restart, please see the documentation here:



      Please let me know if I can assist any further.
      Chris L.NinjaTrader Customer Service

      Comment


        #4
        Originally posted by NinjaTrader_ChrisL View Post
        Hit trader14, thanks for your post.

        You should use the AdoptAccounPosition startup if you want the strategy to keep trading the open position after you restart, please see the documentation here:



        Please let me know if I can assist any further.
        There are no open positions Chris, the strategy exits all positions upon market close. This is my whole point. The strategy is flat, or should be anyway, and my account is flat. I'm try to determine which start behavior to use given the fact my strategy exits all positions upon the close, I then reboot my computer during the 1 Hr break, then reactivate the strategy so it can begin trading at the open. Make sense?

        Comment


          #5
          Hi trader14, thanks for your reply.

          If there are no open positions on either account after the strategy restarts you can use Immediately submit or AdoptAccount. If you use immediately submit, make sure your account position is in the correct state before enabling the strategy e.g. If you know the strategy should start flat then your account position should be flat upon startup as well.

          Please let me know if I can assist any further.
          Chris L.NinjaTrader Customer Service

          Comment


            #6
            Originally posted by NinjaTrader_ChrisL View Post
            Hi trader14, thanks for your reply.

            If there are no open positions on either account after the strategy restarts you can use Immediately submit or AdoptAccount. If you use immediately submit, make sure your account position is in the correct state before enabling the strategy e.g. If you know the strategy should start flat then your account position should be flat upon startup as well.

            Please let me know if I can assist any further.
            Okay, the immediately submit, synchronize account seems like the best way to go.Thank you. Will you guys ever make a change so you can use the "wait until flat" behavior (as its the least disruptive) but have the strategy's virtual position also be flat? Currently, doing a reboot, the virtual position would be either long or short as it does realize it's supposed to be flat during the close.

            Comment


              #7
              Trader14 I have a similar issue I use utilize onbarclose and exitonsessionclose.
              exitonsessionclose does close the trade, and if I do not restart the strategy everything works as expected. If I do restart the strategy during close the strategy position re-enters the trade, the market is closed so the order just sits there. My assumption is that the problem lies in using non time based candles. Though the session has ended, the tick based candle never closes. Restarting the strategy causes Ninjatrader to process historical bars and apparently doesn’t handle exitonsessionclose accurately for historical candles (I.e. it waits till the candle closes) and since the last tick candle has not closed it thinks it’s still in a position.

              Comment


                #8
                Originally posted by bmdenton23 View Post
                Trader14 I have a similar issue I use utilize onbarclose and exitonsessionclose.
                exitonsessionclose does close the trade, and if I do not restart the strategy everything works as expected. If I do restart the strategy during close the strategy position re-enters the trade, the market is closed so the order just sits there. My assumption is that the problem lies in using non time based candles. Though the session has ended, the tick based candle never closes. Restarting the strategy causes Ninjatrader to process historical bars and apparently doesn’t handle exitonsessionclose accurately for historical candles (I.e. it waits till the candle closes) and since the last tick candle has not closed it thinks it’s still in a position.
                Sounds similar. Yeah, I use exit on close and on bar close in my strat. What I assumed, wrongly, was that the strategy knows the market is closed when I restart it, not the case. When I restart it, it thinks it has a virtual position even though it should be flat, per the exit just before the market close. So, I'm quite stuck. Either I just leave my computer running forever, or, I leave it running during the week and start the strats up on Sunday. There's gotta be another way.

                Comment


                  #9
                  My solution was to include an additional data series of 1 minute and close my trade a minute before the close. Since that candle will close before the close, restarting the strategy knows it shouldn’t be in a position. I think it should be marked as a bug though. I understand the difficulty from the dev side though, you can’t accurately process the historical bars without including a 1 second series so they must’ve just decided to process historically on the bar close instead for efficiency.

                  Comment


                    #10
                    Originally posted by bmdenton23 View Post
                    My solution was to include an additional data series of 1 minute and close my trade a minute before the close. Since that candle will close before the close, restarting the strategy knows it shouldn’t be in a position. I think it should be marked as a bug though. I understand the difficulty from the dev side though, you can’t accurately process the historical bars without including a 1 second series so they must’ve just decided to process historically on the bar close instead for efficiency.
                    Hmm. Mine strat exits 15min prior to the close. Still having the same issue, it doesn't fix it.

                    Comment


                      #11
                      Originally posted by bmdenton23 View Post
                      My solution was to include an additional data series of 1 minute and close my trade a minute before the close. Since that candle will close before the close, restarting the strategy knows it shouldn’t be in a position. I think it should be marked as a bug though. I understand the difficulty from the dev side though, you can’t accurately process the historical bars without including a 1 second series so they must’ve just decided to process historically on the bar close instead for efficiency.
                      The issue is that those of us who use on bar close and who's positions are exited at or just prior to the close (like mine and yours), there is not currently a start behavior available to work with this strategy type. Its either "wait until flat" or "immediately submit" and neither of those work well. Ninjatrader really needs to come up with a better start behavior or, make a strategy recognize that it should be flat and not in a virtual position when the market is closed.

                      Comment


                        #12
                        Hello trader14 and bmdenton23,

                        The behavior described here is a known limitation involving ExitOnSessionClose when the strategy is enabled after hours. The strategy will not trigger ExitOnSessionClose historically because the first tick of the next bar is not yet seen. While this may not be visually ideal, the symptoms should not affect trading since we will see the ExitOnSessionClose behavior once the first bar of a new session bar starts processing.

                        We are tracking impact to improve this behavior with the internal ticket ID SFT-1842. I have noted your impact here.

                        If you are seeing different behavior that is problematic once the strategy starts processing the next session, please let us know so we can investigate further.


                        JimNinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by timmbbo, Today, 08:59 AM
                        1 response
                        2 views
                        0 likes
                        Last Post NinjaTrader_ChelseaB  
                        Started by KennyK, 05-29-2017, 02:02 AM
                        2 responses
                        1,281 views
                        0 likes
                        Last Post marcus2300  
                        Started by fernandobr, Today, 09:11 AM
                        0 responses
                        3 views
                        0 likes
                        Last Post fernandobr  
                        Started by itrader46, Today, 09:04 AM
                        1 response
                        6 views
                        0 likes
                        Last Post NinjaTrader_Clayton  
                        Started by bmartz, 03-12-2024, 06:12 AM
                        5 responses
                        33 views
                        0 likes
                        Last Post NinjaTrader_Zachary  
                        Working...
                        X