Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to avoid Order rejected issue with IB

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

    How to avoid Order rejected issue with IB

    Hi guys,

    I am running an automated strategy on forex, my broker is Interactive brokers. I noticed that every day between 10pm GMT and 10.05pm GMT my orders get rejected, as if the connection between NT and IB gets reset. This is the error message I get and it sounds very much as this is a broker issue rather than NT issue:

    Order rejected - reason:The exchange is closed. (201)
    What I am thinking is how to get my strategy to avoid entering new orders or adjusting my stop loss in the time window between 10 and 10.05 pm, would adding the part in bold be sufficient:

    Code:
    		
    if(BarsInProgress == 1) // secondary time frame (e.i. 1 min)
    		{		
    
    			if(long_condition) 
    			{
    				if (Position.MarketPosition == MarketPosition.Flat && entryOrderLong ==null [B]&& ToTime(Times[1][0]) < (220000) && ToTime(Times[1][0]) > (220500)[/B])
    					{
    						entryOrderLong = EnterLongStop(...);
    					}
    			}
    		}
    Futhermore, I am managing my stop loss in the primary time frame (e.i. 60 min bar)
    Code:
    				
    if(BarsInProgress == 0)	// primary time frame (e.i. 30 min)
    		{							
    			if(Position.MarketPosition == MarketPosition.Long && stopOrderLong != null)
    			{    
    				double newStop = 0;
    				if(stop_condition) newStop = Low[0];		 
    				if(newStop > stopOrderLong.StopPrice && newStop < Close[0])	// check if new stop loss is higher than current stop loss
    				{	
    					stopOrderLong = ExitLongStop(...);			
    				}
    			}
    		}
    this wouldn't allow me to adjust an existing order only 5 minutes after the close of the bar, therefore I assume I would need to move my stop loss management in the secondary time frame, is this assumption correct?

    Thanks
    Last edited by sburtt; 10-10-2013, 04:00 PM.

    #2
    Hello sburtt,

    Thank you for your post.

    Your assumption is correct on the Stop Loss adjustments. For the Time I would use or rather than and, the time will never be less than 10 PM and greater than 10:05 PM at the same time.

    Change it to the following:
    Code:
    && ToTime(Times[1][0]) < (220000) || ToTime(Times[1][0]) > (220500)
    For a reference sample on time filters please visit the following link: http://www.ninjatrader.com/support/f...ead.php?t=3226

    Please let me know if I may be of further assistance.

    Comment


      #3
      Originally posted by NinjaTrader_PatrickH View Post
      Hello sburtt,

      Thank you for your post.

      Your assumption is correct on the Stop Loss adjustments. For the Time I would use or rather than and, the time will never be less than 10 PM and greater than 10:05 PM at the same time.

      Change it to the following:
      Code:
      && ToTime(Times[1][0]) < (220000) || ToTime(Times[1][0]) > (220500)
      For a reference sample on time filters please visit the following link: http://www.ninjatrader.com/support/f...ead.php?t=3226

      Please let me know if I may be of further assistance.
      yes right! sorry it was late and i was tired

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      637 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      366 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      107 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      569 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      572 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X