Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Breakeven Stop Loss Issue

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

    Breakeven Stop Loss Issue

    Hi,
    I have been working on a strategy using the strategy builder that I want to use a breakeven stop loss. I have used the model for a strategy builder breakeven provided in a different ninja trader forum post (I'll share the link below). When the strategy is working, it should place an entry and then place a stop loss. After that, if the price rises, it should set the stop loss to the breakeven price, and then exit the trade either when the exit conditions become true, or the stop loss is hit. I have had a very confusing issue with this because sometimes it will follow that order, or it just won't place the stop loss entirely. I have tried many things like mostly removing the conditions for placing the stop losses or making a trigger state variable for long positions and shorts but those have all been unsuccessful. I am suspicious that the issue is caused by my last condition which is meant to disable the stop loss in order to place the exit trade, but I really don't know. I attached a lot of pictures with more information and examples of the issue. Since there is a max on how many I can attach, I'll just add the rest on in a message responding to this. I would really appreciate any help with this issue and any other suggestions would be great.
    Thanks



    Link for Breakeven Example: Request Breakeven Functions in Strategy Builder - NinjaTrader Support Forum

    Click image for larger version

Name:	
Views:	0
Size:	6.6 KB
ID:	1245145
    Click image for larger version

Name:	
Views:	0
Size:	8.9 KB
ID:	1245146
    Click image for larger version

Name:	
Views:	0
Size:	13.9 KB
ID:	1245147
    Click image for larger version

Name:	
Views:	0
Size:	17.3 KB
ID:	1245148
    Click image for larger version

Name:	
Views:	0
Size:	16.1 KB
ID:	1245149
    Last edited by NinjaTrader_BrandonH; 04-10-2023, 10:40 AM.

    #2
    Click image for larger version  Name:	 Views:	0 Size:	15.9 KB ID:	1245152
    Click image for larger version  Name:	 Views:	0 Size:	7.8 KB ID:	1245153
    Click image for larger version  Name:	 Views:	0 Size:	9.0 KB ID:	1245154
    Click image for larger version  Name:	 Views:	0 Size:	17.2 KB ID:	1245155
    Click image for larger version  Name:	 Views:	0 Size:	15.7 KB ID:	1245156
    Last edited by NinjaTrader_BrandonH; 04-10-2023, 10:58 AM.

    Comment


      #3
      Hello LJMartinet,

      Thanks for your post.

      If the expected trade(s) are not appearing, this would indicate that the condition to place the order is not evaluating as true or the order is being ignored for other reasons.

      When working with any issue, it is important to take steps to isolate the issue so that the exact line causing the behavior can be found. This is a process of elimination and a process of debugging by adding prints.​

      To understand why the script is behaving as it is, such as placing orders or not placing orders when expected, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.

      In the strategy add prints (outside of any conditions) that print the values of every variable used in every condition that places an order along with the time of that bar.

      Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).​

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

      Let us know if we may assist further.​
      <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

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Today, 05:17 AM
      0 responses
      23 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      120 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      63 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      41 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      45 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X