DaveN
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Convert Stop to Trail or Cancel Stop-Loss
Collapse
X
-
Convert Stop to Trail or Cancel Stop-Loss
I am trying to code a strategy which trades multiple positions, one with fixed profits, the other with no profit target but a trail stop. I tried using named entries and stops, but I find that the strategy works much better if I have fixed stops until the first profit is taken, then a trail stop after that. With named stops, I can assign a stop to one name and a trail to another, but results are improved, (based on manual inspection) if I have fixed stops initially and convert to a trail stop after the first profit is taken. Is it possible to cancel a stop programatically, or perhaps cancel it and replace it with a trail stop, once the first contract is taken off at a profit target? It appears that if I have an un-named stop, it will stop out all contracts, can I add a named trail stop to that mix, or will it be overridden by the fixed stop, as outlined in the help files?
DaveN -
Hello daven,
Thank you for your post.
It would not be possible to convert a static stop to an auto trail. The AutoTrail must be set when the positioned is entered.
What you could do is call an ATM Strategy where the profit trigger does not kick in the AutoTrail until a certain criteria has been met. This will ensure you're using the same stop loss for your order, but will not act as an auto trail until so many ticks in profit have been reached.
Please review our Help Guide section on ATM Strategy Methods:
Please let me know if you have additional questions.MatthewNinjaTrader Product Management
-
Converting Stops
I have already written a strategy that executes what you suggested, but backtesting it is extraordinarily time-consuming, (though it can certainly be argued that the results of this kind of backtesting are far more useful than the standard backtesting). I just want to clarify your answer, there is no way to programatically cancel a stop loss once it is programatically executed in a strategy, is that correct?
DaveN
Comment
-
daven,
Correct - you cannot "Unset" the SetStopLoss and reset to SetAutoTrail. SetStopLoss and SetAutoTrail cannot be used together. You'd need to use SetStopLoss only and then code the trail part of this as needed.
If you need to cancel the initial stop, you can use ExitOrders and IOrders to resubmit a 2nd stop loss as as AutoTrail when the condition has been met. However, this will not be the same stop loss and would need to resubmit a second order with the auto trail set on this order.
More information on using IOrder can be found below:
MatthewNinjaTrader Product Management
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by andrewtrades, Today, 04:57 PM
|
1 response
5 views
0 likes
|
Last Post Today, 05:02 PM | ||
Started by chbruno, Today, 04:10 PM
|
0 responses
3 views
0 likes
|
Last Post
by chbruno
Today, 04:10 PM
|
||
Started by josh18955, 03-25-2023, 11:16 AM
|
6 responses
436 views
0 likes
|
Last Post
by Delerium
Today, 03:42 PM
|
||
Started by FAQtrader, Today, 03:35 PM
|
0 responses
7 views
0 likes
|
Last Post
by FAQtrader
Today, 03:35 PM
|
||
Started by rocketman7, Today, 09:41 AM
|
5 responses
19 views
0 likes
|
Last Post Today, 03:33 PM |
Comment