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 Mindset, 04-21-2026, 06:46 AM
      0 responses
      91 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
      121 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      72 views
      0 likes
      Last Post PaulMohn  
      Working...
      X