Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT8 Advanced Order Management

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

    NT8 Advanced Order Management

    Dear support team,

    I have a Long position and also a Limt order to book my profit. But when i get a trend reversal signal from my indicator, I want to exit my long position. So, I'm calling ExitLong, but it is not working. Am i not allowed to Exit the Long position when i have a pending limit order? Do I need to cancel the existing limit order before I call the ExitLong? Could you please clarify?

    //creating entry order based on Buy signal from indicator
    EnterLong(quantity, "STScalpLongEntry");

    //set limit order with profit target
    ExitLongLimit(1, true, quantity, currentPtPrice, "Long profit target", "STScalpLongEntry");

    //exit the Long position based on the trend reversal signal
    if(Position.MarketPosition == MarketPosition.Long && entryOrder != null)
    {
    if (entryOrder.Name == "STScalpLongEntry")
    ExitLong(quantity,"ExitScalperLongST","STScalpLong Entry");//Exit ST scalper position
    }

    Thankyou,
    Murali

    #2
    Hello radhmu978,

    If you have existing targets working you can't call ExitLong, it will be ignored by the managed approach. You would have to cancel the limit orders by either expiring them or specifically calling CancelOrder on the limit order object, wait for confirmation and then submit the exit.



    A limit order will expire after 1 OnBarUpdate call if you don't call ExitLongLimit again however you are using live until cancelled so you will need to call CancelOrder on the limit order object to stop it.


    Comment


      #3
      A limit order will expire after 1 OnBarUpdate call if you don't call ExitLongLimit again however you are using live until cancelled so you will need to call CancelOrder on the limit order object to stop it.
      https://ninjatrader.com/support/help...thod_to_ca.htm

      I have an issue here, I'm setting my ExitLongLimit as live until cancelled. But after the 1 OnBarUpdate call , I'm not able to reenter the loop and trail my stop loss. My oder state is in accepted state. please check the screenshot attached.

      if (TrailStopLoss &&
      stopLoss != null && (stopLoss.OrderState == OrderState.Accepted || stopLoss.OrderState == OrderState.Working)
      {
      currentSlPrice = Close[0] - StopLossDistance * tickSizeSecondary;
      ExitLongStopMarket(1, true, entryOrder.Quantity, currentSlPrice, "stop loss", entryOrder.Name);
      }
      Attached Files

      Comment


        #4
        Hello radhmu978,

        From just the code I wouldn't be able to tell what's happening, have you tried to use Prints to make sure the method is being called?

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        90 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        137 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        68 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        120 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        71 views
        0 likes
        Last Post PaulMohn  
        Working...
        X