Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order rejected - Forex.com

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

    Order rejected - Forex.com

    Hi, I'm using a fairly simple managed strategy for always being either long or short in the market. The strategy finishes itself roughly once a day. Error message I'm seeing is "'Order rejected'. Strategy has sent cancel requests, attempted to close the position and terminated itself." Now I'm at a point to completely give up NT8 and Forex.com, because I think managed approach does not work reliably. Please advise if anything seems wrong, or if anything can be done with proper error handling.

    Code:
    		
                    protected override void OnBarUpdate()
    		{
     			// check conditions for trade
    			if (CurrentBar	< BarsRequiredToTrade)
    				return;
    
    			// enter based on slave signals
      			if (mOrder == null && isUpTrend())
          			    EnterLong("myOrder");
      			if (mOrder == null && isDownTrend())
          			    EnterShort("myOrder");
    		}
    
    		protected override void OnOrderUpdate(Order order, double limitPrice, double stopPrice, int quantity, int filled, double averageFillPrice, OrderState orderState, DateTime time, ErrorCode error, string nativeError)
    		{
    		    // Assign entryOrder in OnOrderUpdate() to ensure the assignment occurs when expected.
    		    // This is more reliable than assigning Order objects in OnBarUpdate, as the assignment is not gauranteed to be complete if it is referenced immediately after submitting
    		    if (order.Name == "myOrder" && orderState != OrderState.Filled)
    		      	mOrder = order;
    		 
    		    if (mOrder != null && mOrder == order)
    		    {
    		        Print(DateTime.Now.ToString()+"|"+ Name + "|" + order.ToString());
    		        if (order.OrderState == OrderState.Filled)
    		       		mOrder = null;
    		    }
    		}
    The error log:
    Time Category Message
    5/29/18 5:25 Position Instrument='GBPUSD' Account='401386179' Average price=1.33168 Quantity=10,000 Market position=Short Operation=Operation_Add
    5/29/18 5:25 Execution Execution='635614510' Instrument='GBPUSD' Account='401386179' Exchange=Default Price=1.33168 Quantity=10,000 Market position=Short Operation=Operation_Add Order='635614510' Time='5/29/2018 5:25 AM'
    5/29/18 5:25 Order Order='635614510/401386179' Name='' New state='Filled' Instrument='GBPUSD' Action='Sell' Limit price=0 Stop price=0 Quantity=10,000 Type='Market' Time in force=GTC Oco='' Filled=10000 Fill price=1.33168 Error='No error' Native error=''
    5/29/18 5:25 Order Order='635614510/401386179' Name='' New state='Working' Instrument='GBPUSD' Action='Sell' Limit price=0 Stop price=0 Quantity=10,000 Type='Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
    5/29/18 5:25 Order Order='635614510/401386179' Name='' New state='Accepted' Instrument='GBPUSD' Action='Sell' Limit price=0 Stop price=0 Quantity=10,000 Type='Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
    5/29/18 5:25 Order Order='635614510/401386179' Name='' New state='Submitted' Instrument='GBPUSD' Action='Sell' Limit price=0 Stop price=0 Quantity=10,000 Type='Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
    5/29/18 5:25 Position Instrument='GBPUSD' Account='401386179' Average price=0 Quantity=0 Market position=Flat Operation=Remove
    5/29/18 5:25 Execution Execution='635614506' Instrument='GBPUSD' Account='401386179' Exchange=Default Price=1.33168 Quantity=10,000 Market position=Short Operation=Operation_Add Order='635614506' Time='5/29/2018 5:25 AM'
    5/29/18 5:25 Order Order='635614506/401386179' Name='myOrder' New state='Filled' Instrument='GBPUSD' Action='Sell short' Limit price=0 Stop price=0 Quantity=10,000 Type='Market' Time in force=GTC Oco='' Filled=10000 Fill price=1.33168 Error='No error' Native error=''
    5/29/18 5:25 Order 401386179, Another instruction has already made changes to the trades and orders. affected Order: Sell 10000 Market
    5/29/18 5:25 Order Order='8c8fdc5033e54fdda649a4b360db4a34/401386179' Name='Close position' New state='Rejected' Instrument='GBPUSD' Action='Sell' Limit price=0 Stop price=0 Quantity=10,000 Type='Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='Order rejected' Native error='Another instruction has already made changes to the trades and orders. '
    5/29/18 5:25 Default Disabling NinjaScript strategy 'TfsEmaTrendBarsV1.3/138997332'
    5/29/18 5:25 Default Strategy 'TfsEmaTrendBarsV1.3/138997332' submitted an order that generated the following error 'Order rejected'. Strategy has sent cancel requests, attempted to close the position and terminated itself.
    5/29/18 5:25 Order Order='635614506/401386179' Name='myOrder' New state='Submitted' Instrument='GBPUSD' Action='Sell short' Limit price=0 Stop price=0 Quantity=10,000 Type='Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''
    5/29/18 5:25 NinjaScript NinjaScript strategy 'TfsEmaTrendBarsV1.3/138997332' submitting order
    5/29/18 5:25 NinjaScript NinjaScript strategy 'TfsEmaTrendBarsV1.3/138997332' submitting order

    #2
    Hello TraderFrank,

    Thank you for your note.

    Could you please send an email to platformsupport[at]ninjatrader[dot]com with Attn: Alan P in the Subject line. Also within the email please include a link to this thread, and attach the log and trace files for the day in subject which you can find in My Documents>NinjaTrader8>Log and My Documents>NinjaTrader8/Trace folders.

    I look forward to your email.
    Alan P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by szferi, Today, 02:04 AM
    0 responses
    1 view
    0 likes
    Last Post szferi
    by szferi
     
    Started by MidenThur, Today, 12:52 AM
    0 responses
    6 views
    0 likes
    Last Post MidenThur  
    Started by seseoraf, Today, 12:51 AM
    1 response
    6 views
    0 likes
    Last Post charmingishagarg  
    Started by Rosario, Today, 12:50 AM
    0 responses
    4 views
    0 likes
    Last Post Rosario
    by Rosario
     
    Started by kemoyums, Today, 12:38 AM
    0 responses
    3 views
    0 likes
    Last Post kemoyums  
    Working...
    X