Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Connection Problems followed by NT Strategy Problems

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

    #16
    Thanks for the input heech!
    BertrandNinjaTrader Customer Service

    Comment


      #17
      Originally posted by heech View Post
      I use Macros Express Pro for startup.

      To access any program programmatically from your strategy... this is the wonder of using C# (as opposed to random toy languages). You can do anything C# + .NET can do.

      So, that means:


      Until NT 7 is available... I personally plan on tying into the TWS API directly, and monitoring positions (just looking for discrepancies) directly through the API.
      Heech,

      You are my hero!

      TWS? Is that a broker, broker's api?

      Did you do this as a seperate namespace or class? In other words, how complicated was it or perhaps I should say how robust did you make it ;-)


      Thanks,

      Comment


        #18
        TWS is Interactive Broker's Traders Workstation.
        Josh P.NinjaTrader Customer Service

        Comment


          #19
          I have similar problems that basically keep me from being able to easilly create an automated strategy that can run unattended. You can use some simple work arounds that could get the strategy workable and semi-unattended.

          Set HandleRealtimeError to off
          Monitor OnConnection and send your self an email when disconnected
          Flatten your possition with your broker
          Have a your strategy reset to flat state on reconnect

          You could make it more automated by monitoring your position and orders externally in a database and squaring them within strategy upon reconnect but that involves alot of coding and wouldn't necessarily be acurate.

          Also could code your own position check through brokers API if they support it.

          Myself I think i'd rather just wait and see what NT 7 offers since if you can access your account within a strategy it'll make implementing these sort of precautions a whole lot easier.

          Comment


            #20
            darckeen,

            Just to clarify, NinjaTrader does NOT recommend running strategies unattended. There are many things that can go wrong that NinjaTrader just does not have control over. For one, internet going out is absolutely irreconcilable by NinjaTrader.
            Josh P.NinjaTrader Customer Service

            Comment


              #21
              Flatten All Positions For Strategy

              Josh,

              In regards to getting flat programmatically to make sure everything is flat for a given strategy. I understand I can do this manually through the dom, but could this be done possibly using the following initialize parameters?

              ExitOnClose = true;
              ExitOnCloseSeconds = 3600;

              For example, could you call a function that changes this to ExitOnClose then set the time to 5-10 secs away from current time. So you could do something like get time, get market session, then calculate how many seconds between close and exit from current time, then reset this variable and then it would programmatically take you out of the trade? Or is this not possible because this can only run once during the initialization and as such you can't change this midstream?

              Thanks

              Comment


                #22
                ExitOnClose parameter does not work off of when you start your strategy. It works off of the end of your chart session. I would not see this being useful for trying to use it to sync to start. If you just want a flat strategy position on strategy start you can use this:
                Code:
                if (Historical)
                     return;
                Josh P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by bortz, 11-06-2023, 08:04 AM
                47 responses
                1,610 views
                0 likes
                Last Post aligator  
                Started by jaybedreamin, Today, 05:56 PM
                0 responses
                9 views
                0 likes
                Last Post jaybedreamin  
                Started by DJ888, 04-16-2024, 06:09 PM
                6 responses
                19 views
                0 likes
                Last Post DJ888
                by DJ888
                 
                Started by Jon17, Today, 04:33 PM
                0 responses
                6 views
                0 likes
                Last Post Jon17
                by Jon17
                 
                Started by Javierw.ok, Today, 04:12 PM
                0 responses
                16 views
                0 likes
                Last Post Javierw.ok  
                Working...
                X