Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How come profit target / stop lost sometimes fails to obey?

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

    How come profit target / stop lost sometimes fails to obey?



    Why is it that a profit target or stop loss occasionally fails to obey, and the strategy just keeps on running without any targets?

    Attached is an example. On this strategy, I set the profit loss / stop loss at six ticks. It's the exact same strategy. In one instance, I'm going long; in the other instance,, I'm going short. Therefore, I'd expect one version to gain six ticks, and the other to lose six ticks. You can see from my screen shot, the profit target successfully engages at six ticks. However, the stop loss fails to hit, and just keeps on running.

    This issue seems to be sporadic. I can line up 20 trades, and 19 of them will successfully honor the profit target / stop loss limits. However, in one trade, one part of it will not obey the profit target / stop loss limit, and just wanders off into la-la land. Furthermore, I see chatter on FB forums that others occasionally deal with this issue. (Maybe a Rythmic issue?)

    It's a good thing I'm sim trading here, because I'd be bummed for taking a 60 tick loss, instead of the programmed 6 tick stop loss.

    Thanks,





    Attached Files

    #2
    Hello timmbbo,

    Thanks for your post.

    What version of NinjaTrader are you using? Please provide the entire version number. This can be found under Help -> About (Example: 8.?.?.?)​

    How are you defining the stop loss and profit target orders in your script? Are you calling Set methods or Exit methods in the script?

    Please check the "log" tab of the control center for any errors related to your strategy. Do you see any error messages being reported in the Log tab of the Control Center?

    Have you added debugging prints to the strategy to understand exactly how it is behaving?

    Further, enable TraceOrders in your strategy. TraceOrders will print to the output window when orders are being submitted (so we can see if they are being submitted) and also provides information if orders are being ignored or canceled.

    Below is a link to a forum post that demonstrates how to use prints to understand behavior.
    https://ninjatrader.com/support/foru...121#post791121

    Prints and TraceOrder information will be displayed in the NinjaScript Output window.​
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3

      Brandon, thanks. I'll provide that information in a bit. In the meantime, I just scripted this routine to double check

      void CheckOrder() {

      if (SystemPerformance.RealTimeTrades.Count == 0) return;
      if (Math.Abs(SystemPerformance.RealTimeTrades[SystemPerformance.RealTimeTrades.Count-1].TradesPerformance.GrossLoss) > (TickSize * ProfitTicks)) ExitLong();
      if (SystemPerformance.RealTimeTrades[SystemPerformance.RealTimeTrades.Count-1].TradesPerformance.GrossProfit > (TickSize * ProfitTicks)) ExitLong();

      }​

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      55 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      132 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      73 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
      49 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X