Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Method 2 modify ATM Strategy Stop Loss and Profit Target in a coded strategy.
Collapse
X
-
Method 2 modify ATM Strategy Stop Loss and Profit Target in a coded strategy.
I had a situation today where I took a break even trade and the strategy took a new position immediately afterwards. I want to code if Stop Loss is touched, then disable strategy. I already know to use CloseStrategy(). I don't know of any method to modify ATM Strategy Stops and Profit Targets. I couldn't find anything relevant in the Help Guide(in the ATM Strat section) for modifying ATM Strat SLs and PFs. Thanks for any help.Tags: None
-
Hello jamestrader21x,
Thank you for your post.
Does the strategy use ATM Strategy Methods? If so, AtmStrategyChangeStopTarget() could be used to change the price of a specified order of a specified ATM strategy.
See the help guide documentation below for more information.
AtmStrategyChangeStopTarget() - https://ninjatrader.com/support/help...stoptarget.htm
ATM Strategy Methods - https://ninjatrader.com/support/help...gy_methods.htm
Also, see the SampleAtmStrategy script that comes default with NinjaTrader for an example of using ATM Strategy Methods in a custom NinjaScript. To view the SampleAtmStrategy code, open a new > NinjaScript Editor window, open the Strategies folder, and select the SampleAtmStrategy script.
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>
-
I want to disable the strategy if my Stop Loss is triggered. I had a situation today where I took a break even trade and the strategy took a new position immediately afterwards. I don't now what method to use to say: If "stop market order" is triggered, then CloseStrategy().
Comment
-
Hello jamestrader21x,
Thank you for your note.
You could track the order in OnExecutionUpdate() by assigning the order to an order object. Then you could check if that order object is not null and call CloseStrategy().
See the SampleOnOrderUpdate example script in the help guide link below that demonstrates the use of OnExecutionUpdate().
SampleOnOrderUpdate - https://ninjatrader.com/support/help...and_onexec.htm
Also, see the help guide documentation below for more information.
OnExecutionUpdate() - https://ninjatrader.com/support/help...tionupdate.htm
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
-
OnOrderUpdate() and OnExecutionUpdate() are too complicated for my skill level. I just put in some code to check if I'm long or short. If so, disable the strategy. I'll just have to re-enable it every time I have a winning trade and my criteria is met.
if (PositionAccount.MarketPosition == MarketPosition.Long || PositionAccount.MarketPosition == MarketPosition.Short)
{
CloseStrategy(atm_id);
}
Thanks for the help anyway.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
64 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
139 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
75 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
50 views
0 likes
|
Last Post
|

Comment