Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Orders: Setting trailstop on open position
Collapse
X
-
Orders: Setting trailstop on open position
How do I execute a trail on an existing position? I did not use an ATM strategy for entry.Tags: None
-
That's kind of a bummer, considering this has been standard in ToS for quite some time. Can I create a strategy to trail for me as a workaround? If so, would you have example I could use?
Comment
-
Hello TraderMatt83,
To use a strategy to add a trailing stop to an existing order, you will need to first detect that a manual order has been placed.
Strategies are not designed to detect orders that are not made by the strategy. You will need to use unsupported methods to achieve this.
Once the order is detected, you will need to place the exit order, and then use custom logic to make the trailing action.
Below I am adding unsupported code to help guide you in the right direction.
foreach (Account acct in Cbi.Globals.Accounts)
{
if (acct.Positions != null)
{
// print information about each position
PositionCollection positions = acct.Positions;
foreach (Position pos in positions)
{
Print(pos.Account.Name + " " + pos.Instrument + " " + pos.MarketPosition + " " + pos.Quantity + " " + pos.AvgPrice);
}
// print information about each order
OrderCollection orders = acct.Orders;
foreach (Order ord in orders)
{
Print(ord.ToString());
}
}
Also, I am attaching an example of a custom trail.
Do keep in mind that this enhancement is on the list of enhancements under consideration for NinjaTrader 8.Attached FilesChelsea B.NinjaTrader Customer Service
Comment
-
Hello TraderMatt83,
It is very easy to do that using our ChartTraderPRO Add-On.
You can add, modify, delete SL, TP and start to Trail anytime, even during the trade, without problems.
If you have any question, I'll be happy to assist.
Regards
Lorant Vari
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by WHICKED, 03-27-2024, 12:33 PM
|
4 responses
41 views
0 likes
|
Last Post Today, 12:28 AM | ||
Started by f.saeidi, Today, 12:12 AM
|
0 responses
3 views
0 likes
|
Last Post
by f.saeidi
Today, 12:12 AM
|
||
Started by Conall, Today, 12:06 AM
|
0 responses
5 views
0 likes
|
Last Post
by Conall
Today, 12:06 AM
|
||
Started by proptradingshop, 03-21-2024, 09:50 AM
|
6 responses
27 views
0 likes
|
Last Post Today, 12:02 AM | ||
Started by mly916, Yesterday, 09:48 PM
|
1 response
12 views
0 likes
|
Last Post Yesterday, 11:54 PM |
Comment