Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

My Forex Strategy seems to reset at 2am?

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

    My Forex Strategy seems to reset at 2am?

    Hi,

    I hope someone who understands this can lend me some advice..

    I just coded a strategy that basically goes long after a breakout past a recent high and then exits on an indicator crossover, whatever..

    The strategy is supposed to run 24 hours per day on 5min forex charts, and I have checked on it after leaving it on overnight and noticed something unexpected.

    The quantity of order lots was about 85,000 (0.85 standard lots) from the time I started the strategy up until 2am, and then from 3am onward the size traded was about 31,000. It wasn't from the account losing money, it was from something happening to the account's percieved buying power, as the lot size is based on avail buying power.

    What I found was similar to what happens when you disable a strategy that has an open position. The strategy is set to Wait until Flat, and Sync account = false, so the strategy restarts and doesn't know there's already an open position going on, and so the buying power is lower and the new shares traded is lower.

    I have an open position that is now outside the strategy, not being monitored by it, and while it happens to be way up in P&L because the instrument went up overnight, it could just as well have tanked and my safety exits wouldn't have been triggered.


    MAIN POINT OF MY QUESTION: Can someone help me troubleshoot -- why would my strategy seem to have reset itself at 2 - 3am, or lost track of the open positions it had as though it had been turned on or off?

    Thanks!

    #2
    Runnrx,

    You may be running into "ExitOnClose" here, which exits trades when the session rolls over.

    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Adam, thanks for replying, but it seems to be something else.. I have Exit on Close set to False, and what's happening is the trade is not being exited - it's left open and unmanaged, more like the strategy had been turned off then back on again. Do you suppose this could have something to do with temporary loss of internet connection?

      Comment


        #4
        RunnrX,

        That is also possible. You can handle connection loss inside a strategy.



        Adam P.NinjaTrader Customer Service

        Comment


          #5
          Thanks Adam. I think that it was from a connection loss, and that the strategy lost hold of the open position at that time. I'll test it later by watching what it does in an open position if I shut off my router for a few minutes and turn it back on. However, I have it set to keeprunning at it is.. oh well, I don't want to fill this thread up with speculation until I've tested and researched again - thanks - and I'll post my results within the next day to help the thread be a reference for others.

          Comment


            #6
            RunnrX,

            Feel free to continue posting as needed. We monitor threads so I can always answer any other questions you may have.
            Adam P.NinjaTrader Customer Service

            Comment


              #7
              Thanks for the help so far

              Update on troubleshooting:

              original problem: overnight, between 2 - 3 am EST, my open forex position suddenly wasn't being recognized by my strategy which is set to wait until flat + don't sync account. There was a registered open position in the account that was initiated by the strategy, but after 3am was just left open and running wild with no control to exit it anymore.

              Symptom is similar to having a strategy disabled then re-enabled, where it drops control of whatever open position there just was in it and lets it run.

              1) I tested if it was from connection loss just now. I waited for the strategy to open another position, then I turned off my router for 6 minutes. My connection handling settings are delay 10 seconds, reconnect attempt 4 times over 5 minutes, keeprunning. When the connection was re-established, the strategy resumed control of the open position and eventually closed it off properly as well -- so no problem with connectionloss occuring --

              However, the other open position from 2-3am last night is still open and unmonitored by the strategy

              2) I have ExitOnClose to false, and my current session manager has sessions at 24/7 setting. I am next going to test if from 2 - 3 am this happens again to me and post tomorrow about if it did.

              Thanks!

              Comment


                #8
                May I ask what broker you're using?

                Comment


                  #9
                  Originally posted by Radical View Post
                  May I ask what broker you're using?
                  Good question. This is actually using the Sim101 account and the paid intraday Kinetick data feed.

                  Why, what do you think the broker would have to do with it? Do they have certain rollover rules that might affect things like this? (though I'm not actually using one right now)

                  Comment


                    #10
                    Originally posted by RunnrX View Post
                    Good question. This is actually using the Sim101 account and the paid intraday Kinetick data feed.

                    Why, what do you think the broker would have to do with it? Do they have certain rollover rules that might affect things like this? (though I'm not actually using one right now)
                    If you were using IB then it might be possible that TWS would log you off around that time, but not with Kinetick.

                    Comment


                      #11
                      RunnrX,

                      Please send me your log and trace files so that we may look into what occurred.

                      You can do this by going to the Control Center-> Help-> Mail to Support.

                      Please reference the following thread URL in the body of the email:

                      MatthewNinjaTrader Product Management

                      Comment


                        #12
                        Originally posted by NinjaTrader_Matthew View Post
                        RunnrX,

                        Please send me your log and trace files so that we may look into what occurred.

                        You can do this by going to the Control Center-> Help-> Mail to Support.

                        Please reference the following thread URL in the body of the email:

                        http://www.ninjatrader.com/support/f...ad.php?t=52118
                        Done - it was just sent to support@ninjatrader, I didn't know if I needed to direct it to your username. Thank you!

                        Comment


                          #13
                          OK, for anyone following this thread, NinjaTrader_Matthew has solved this for me. After looking at the log file, he found that the strategy was disabled from something like 2:34 A.M. to 2:37 A.M. which probably occurred as a result of my sitting there utterly drowsy, doing some updates to the coding and accidentally reloading the ninjascript... I'll watch for this in the future and see if this happens again at an unexpected time where I'm certain I didn't disable the strategy, and post on here if it does. Thanks everyone, & Matthew!

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by andrewtrades, Today, 04:57 PM
                          1 response
                          5 views
                          0 likes
                          Last Post NinjaTrader_Manfred  
                          Started by chbruno, Today, 04:10 PM
                          0 responses
                          3 views
                          0 likes
                          Last Post chbruno
                          by chbruno
                           
                          Started by josh18955, 03-25-2023, 11:16 AM
                          6 responses
                          436 views
                          0 likes
                          Last Post Delerium  
                          Started by FAQtrader, Today, 03:35 PM
                          0 responses
                          7 views
                          0 likes
                          Last Post FAQtrader  
                          Started by rocketman7, Today, 09:41 AM
                          5 responses
                          19 views
                          0 likes
                          Last Post NinjaTrader_Jesse  
                          Working...
                          X