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 algospoke, Yesterday, 06:40 PM
        2 responses
        19 views
        0 likes
        Last Post algospoke  
        Started by ghoul, Today, 06:02 PM
        3 responses
        14 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by jeronymite, 04-12-2024, 04:26 PM
        3 responses
        45 views
        0 likes
        Last Post jeronymite  
        Started by Barry Milan, Yesterday, 10:35 PM
        7 responses
        20 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by AttiM, 02-14-2024, 05:20 PM
        10 responses
        181 views
        0 likes
        Last Post jeronymite  
        Working...
        X