I've created a strategy via the strategy builder. After setting my conditions, I then was looking for a way to manage the entry, exit, target, stops via the strategy rather then using Ninja traders ATM strategy template. Specifically I was looking to add a breakeven method to my strategy that would go into effect after so and so ticks... I followed a "breakeven builder example" as a reference from a older post on this forum. Everything was done inside the builder and I have not edited the ninja script code at all. Almost everything works fine, but I noticed that sometimes the strategy's breakeven function will immediately go into effect if there is an entry made and the trade immediately goes against me. After testing the calculate properties and experimenting with "on bar close" and "on price change", I was unable to find a resolution. Looking for a fix, thanks
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Strategy builder, adding breakeven condition
Collapse
X
-
Strategy builder, adding breakeven condition
Hi,
I've created a strategy via the strategy builder. After setting my conditions, I then was looking for a way to manage the entry, exit, target, stops via the strategy rather then using Ninja traders ATM strategy template. Specifically I was looking to add a breakeven method to my strategy that would go into effect after so and so ticks... I followed a "breakeven builder example" as a reference from a older post on this forum. Everything was done inside the builder and I have not edited the ninja script code at all. Almost everything works fine, but I noticed that sometimes the strategy's breakeven function will immediately go into effect if there is an entry made and the trade immediately goes against me. After testing the calculate properties and experimenting with "on bar close" and "on price change", I was unable to find a resolution. Looking for a fix, thanksTags: None
-
Hello Mikey_,
Thanks for your post.
You can use exit order methods and add coding logic in the Strategy Builder to accomplish this goal. Please note that you would not be able to use the exit methods and the stops in the stop and targets window as that creates a violation of the managed approach internal order handling rules, linked here: https://ninjatrader.com/support/help...d_approach.htm
My colleague Chelsea has created educational examples of strategy builder breakeven and trailing stop in the strategy builder here:
https://ninjatrader.com/support/forum/forum/suggestions-and-feedback/suggestions-and-feedback-
aa/103992-request-breakeven-functions-in-strategy-builder#post806596
If the strategy is not be having as expected then debugging prints should be added to the strategy to understand how your logic in the strategy 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<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>
-
Thank you for your reply. I followed the steps of the Breakeven builder example. The template that Chelsea provides is set up for a long side breakeven strategy. Using her template all I have to do is add my entry conditions for a long sided trade and the strategy works perfectly fine. No problems. Now when I go to duplicate the strategy for the short side, in order for my strategy to manage long & short positions; all I have to do is change the entry from long to short, and add & adjust the breakeven + initial stop distance input settings to be accustomed to the short entry. Here is where my problem resides. Once the short side conditions have been added/adjusted, it messes up the strategy in general and it no longer follows the conditions that manages both the long and short entries.Originally posted by NinjaTrader_BrandonH View PostHello Mikey_,
Thanks for your post.
You can use exit order methods and add coding logic in the Strategy Builder to accomplish this goal. Please note that you would not be able to use the exit methods and the stops in the stop and targets window as that creates a violation of the managed approach internal order handling rules, linked here: https://ninjatrader.com/support/help...d_approach.htm
My colleague Chelsea has created educational examples of strategy builder breakeven and trailing stop in the strategy builder here:
https://ninjatrader.com/support/forum/forum/suggestions-and-feedback/suggestions-and-feedback-
aa/103992-request-breakeven-functions-in-strategy-builder#post806596
If the strategy is not be having as expected then debugging prints should be added to the strategy to understand how your logic in the strategy 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
Comment
-
Hello Mikey_,
Thanks for your notes.
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<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, Yesterday, 05:17 AM
|
0 responses
55 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
132 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
73 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
45 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
49 views
0 likes
|
Last Post
|

Comment