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 | ||
---|---|---|---|---|
Change colour of Stop market and limit orders to red and green via indicator script
by Rapine Heihei
Started by Rapine Heihei, 04-23-2024, 07:51 PM
|
2 responses
30 views
0 likes
|
Last Post
by Max238
Today, 02:25 AM
|
||
Started by Shansen, 08-30-2019, 10:18 PM
|
24 responses
943 views
0 likes
|
Last Post
by spwizard
Today, 01:29 AM
|
||
Started by Max238, Today, 01:28 AM
|
0 responses
9 views
0 likes
|
Last Post
by Max238
Today, 01:28 AM
|
||
Started by rocketman7, Today, 01:00 AM
|
0 responses
7 views
0 likes
|
Last Post
by rocketman7
Today, 01:00 AM
|
||
Started by wzgy0920, 04-20-2024, 06:09 PM
|
2 responses
28 views
0 likes
|
Last Post
by wzgy0920
Yesterday, 10:43 PM
|
Comment