Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Issue with basic limit orders

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

    Issue with basic limit orders

    I am using the following to enter orders and have no problem.

    Code:
    EnterLongLimit(0,true,1,Close[0]-value1,"buy");
    EnterShortLimit(0,true,1,Close[0]+value1,"sell");
    However, it seems that nothing I do can get the matching exit limit orders to work. I've tried this on replay and no orders are placed when the conditions are met:

    Code:
    ExitLongLimit(0,true,1,Close[0]+value2,"","buy");
    ExitShortLimit(0,true,1,Close[0]-value2,"","sell");
    The issue is probably not with my conditions because it works perfectly fine when I replace the limits with market orders as follows:

    Code:
    ExitLong("", "buy");
    ExitShort("", "sell");
    Am I getting the syntax for exit limit orders wrong? Could I have a suggestion from where I may be wrong? Thanks!

    #2
    Are you able to compile these strategies with the Exit orders? If you can compile, your syntax is fine.

    To troubleshoot a strategies orders, please enable TraceOrders = true from the Initialize method of your code - http://www.ninjatrader.com/support/f...ead.php?t=3627

    This will enable additional logging which will tell us why these Exit-Limit orders may be ignored.
    MatthewNinjaTrader Product Management

    Comment


      #3
      Yes, I am able to compile the strategy. I've just enabled TraceOrders as suggested and here is part of the output on a 10-min chart replayed at 50x speed. The order given the "buy" signal name has been filled before this. I understand there's a minor glitch with my conditions that makes it place an order at the end of every bar which I will fix using a Position.MarketPosition.ToString() condition after I can get the orders to be placed in the first place, but the main issue I'm facing is that the latter doesn't happen; it seems like the strategy is attempting to place an order each time and I see nothing on my orders tab in the Control Center, nor any rejected/ignored orders.

      What could be the problem?

      Code:
      6/8/2012 10:21:23 AM Entered internal PlaceOrder() method at 6/8/2012 10:21:23 AM: BarsInProgress=0 Action=Sell OrderType=Limit Quantity=2 LimitPrice=6157.5 StopPrice=0 SignalName='' FromEntrySignal='buy'
      6/8/2012 10:30:58 AM Entered internal PlaceOrder() method at 6/8/2012 10:30:58 AM: BarsInProgress=0 Action=Sell OrderType=Limit Quantity=2 LimitPrice=6157.5 StopPrice=0 SignalName='' FromEntrySignal='buy'
      6/8/2012 10:46:11 AM Entered internal PlaceOrder() method at 6/8/2012 10:46:11 AM: BarsInProgress=0 Action=Sell OrderType=Limit Quantity=2 LimitPrice=6157.5 StopPrice=0 SignalName='' FromEntrySignal='buy'
      6/8/2012 10:51:47 AM Entered internal PlaceOrder() method at 6/8/2012 10:51:47 AM: BarsInProgress=0 Action=Sell OrderType=Limit Quantity=2 LimitPrice=6157.5 StopPrice=0 SignalName='' FromEntrySignal='buy'
      6/8/2012 11:00:14 AM Entered internal PlaceOrder() method at 6/8/2012 11:00:14 AM: BarsInProgress=0 Action=Sell OrderType=Limit Quantity=2 LimitPrice=6157.5 StopPrice=0 SignalName='' FromEntrySignal='buy'
      6/8/2012 11:14:34 AM Entered internal PlaceOrder() method at 6/8/2012 11:14:34 AM: BarsInProgress=0 Action=Sell OrderType=Limit Quantity=2 LimitPrice=6157.5 StopPrice=0 SignalName='' FromEntrySignal='buy'
      6/8/2012 11:20:10 AM Entered internal PlaceOrder() method at 6/8/2012 11:20:10 AM: BarsInProgress=0 Action=Sell OrderType=Limit Quantity=2 LimitPrice=6157.5 StopPrice=0 SignalName='' FromEntrySignal='buy'

      Comment


        #4
        Hello,

        The default behavior is to cancel the order at the end of the bar. If your condition is still true, it will attempt to resubmit it.

        It's likely that the order is being canceled before it can be filled. You can change this behavior by following our guide in Keeping orders alive:

        MatthewNinjaTrader Product Management

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by bolli vishal, Today, 04:51 AM
        1 response
        7 views
        0 likes
        Last Post elirion
        by elirion
         
        Started by Tekie, 05-10-2023, 07:03 PM
        6 responses
        244 views
        0 likes
        Last Post Roonie23  
        Started by mw_futures, 04-24-2025, 05:26 AM
        4 responses
        32 views
        0 likes
        Last Post mw_futures  
        Started by raysinred, Yesterday, 10:32 AM
        1 response
        23 views
        0 likes
        Last Post rockmanx00  
        Started by cbadr, Yesterday, 08:19 PM
        0 responses
        10 views
        0 likes
        Last Post cbadr
        by cbadr
         
        Working...
        X