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 love2code2trade, 04-17-2024, 01:45 PM
        4 responses
        36 views
        0 likes
        Last Post love2code2trade  
        Started by alifarahani, Today, 09:40 AM
        2 responses
        12 views
        0 likes
        Last Post alifarahani  
        Started by junkone, Today, 11:37 AM
        3 responses
        15 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by pickmyonlineclass, Today, 12:23 PM
        0 responses
        1 view
        0 likes
        Last Post pickmyonlineclass  
        Started by frankthearm, Yesterday, 09:08 AM
        12 responses
        44 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Working...
        X