• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

EnterLongLimit, EnterLongStopMarket ignored in OnOrderUpdate?

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

    EnterLongLimit, EnterLongStopMarket ignored in OnOrderUpdate?

    Hello,

    In latest NT8 (RC2) I have a problem placing the correct exit orders for my strategy.

    The problem is that once an order is filled, I want to place the corresponding Exit Orders for a Target and a Stop using ExitLongLimit, ExitLongStopMarket. It seems like that NT8 is completly ignoring those orders on live/simulation strategies - however it is honoring the exits on backtesting...

    In order to reproduce I created a simply modification to the SampleMAStrategy. Just take the code below and do a simulation. You will see that NT8 completly ignores the Exit Orders once filled.

    Code:
    protected override void OnBarUpdate()
    {
      if (CurrentBar < BarsRequiredToTrade)
        return;
    
      if (CrossAbove(smaFast, smaSlow, 1))
    	EnterLong();
    }
    		
    protected override void OnOrderUpdate(Cbi.Order order, double limitPrice, double stopPrice, int quantity, int filled, double averageFillPrice, Cbi.OrderState orderState, DateTime time, Cbi.ErrorCode error, string comment)
    {
    	if(orderState==OrderState.Filled)
    	{
    		ExitLongLimit(0,true,1,limitPrice+10*TickSize,"Exit TP2","long2");
    		ExitLongStopMarket(0,true,1,limitPrice-10*TickSize,"Exit SL2","long2");
    	}
    }
    Am I doing something wrong here or is this a bug - in NT7 that works.

    Kind regards,
    Oliver

    #2
    Hello,

    Thank you for the post.

    It looks like you are using OnOrderUpdate, there is a note about this scenario in the OnOrderUpdate help guide entry. Mainly if you want to drive order logic based on Fills,you would instead need to use OnExecutionUpdate

    http://ninjatrader.com/support/helpG...=OnOrderUpdate

    http://ninjatrader.com/support/helpG...tionupdate.htm

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Ok thanks for the info, I'll try that approach.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by FREEN, Today, 10:33 AM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_Jim  
      Started by NoamBarel, Today, 10:11 AM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_Jim  
      Started by 7robert, Today, 09:41 AM
      2 responses
      7 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by Mykro, Today, 08:42 AM
      1 response
      12 views
      0 likes
      Last Post NinjaTrader_Kate  
      Started by franki, Yesterday, 12:52 PM
      5 responses
      31 views
      0 likes
      Last Post NinjaTrader_Jim  
      Working...
      X