Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Historical trades not taking SL TP limit orders using exitlimit() method

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

    Historical trades not taking SL TP limit orders using exitlimit() method

    I am using the below to set my TP and SL levels. But when i load the historical trades, none of these orders are taken even though during market replay i do see they are set and triggered. Is this normal?

    if (execution.MarketPosition == MarketPosition.Short)
    {
    ExitShortLimit(execution.Quantity, true, 1, takeProfitShortLevels, "TP_" + execution.Order.Name, execution.Order.Name);
    ExitShortStopLimit(execution.Quantity, true, 1, execution.Price + InitialSLAmount, execution.Price + InitialSLAmount, "Initial_Short_SL_" + i, execution.Order.Name);
    }
    // Handle long position TP and SL
    else if (execution.MarketPosition == MarketPosition.Long)
    {
    ExitLongLimit(1, true, execution.Quantity, takeProfitLongLevels, "TP_" + execution.Order.Name, execution.Order.Name);
    ExitLongStopLimit(1, true, execution.Quantity, execution.Price - InitialSLAmount, execution.Price - InitialSLAmount, "Initial_Long_SL_" + i, execution.Order.Name);
    }​

    #2
    Hello sofortune,

    It appears you are providing the quantity of the execution as the barsInProgressIndex.

    EnterShortLimit(int barsInProgressIndex, bool isLiveUntilCancelled, int quantity, double limitPrice, string signalName)

    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Oh geez, thanks. Not sure what happened there. Let me check if that fixes the issue.

      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