Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy self-termination

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

    Strategy self-termination

    Hi, there's been an issue with self-termination of a strategy run on a chart that has been bugging me for a while. I'm running latest NT version connected to TWS API. The stop happens in two cases:

    (i) Order is rejected due to margin limit violation - in this case strategy halts, NT and TWS are still running
    (ii) API connection is lost for a moment (e.g. IB reboots their servers) - then strategy and TWS halt, NT stays running (although without NT hooked TWS would keep up and would restore connection as soon as it re-appears)

    This strategy halting is extremely annoying and is even somewhat ridiculous in the first case. What can be done to keep a strategy running?

    Thanks in advance

    #2
    I can comment on (i).

    You have to add this line of code in the Initialize() function

    RealtimeErrorHandling = RealtimeErrorHandling.TakeNoAction;

    Read in the manual about this. In the event of a rejected order you may need extra logic in your strategy to handle it.

    Anthony
    mrlogik
    NinjaTrader Ecosystem Vendor - Purelogik Trading

    Comment


      #3
      Nothing can be done at this time. Just curious, what would you have your strategy do as it submits and order and you run into a margin limitation? Anthony is correct, there is this setting but you really would need to have some elaborate handling of order rejections. This is advanced stuff as if you don't know what you are doing you can easily create code that does not do what you expect.
      RayNinjaTrader Customer Service

      Comment


        #4
        Thanks for the tip, now I've got something to play around with. The situation with margin is related to adding on a position when a trend evolves; the problem is that with IB I can't retrieve current account value and so I hit the limit at a certain point.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by bmartz, 03-12-2024, 06:12 AM
        5 responses
        32 views
        0 likes
        Last Post NinjaTrader_Zachary  
        Started by Aviram Y, Today, 05:29 AM
        4 responses
        12 views
        0 likes
        Last Post Aviram Y  
        Started by algospoke, 04-17-2024, 06:40 PM
        3 responses
        28 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by gentlebenthebear, Today, 01:30 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by cls71, Today, 04:45 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X