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 NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        62 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        134 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        75 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        45 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        50 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X