Is there a way to change a profit target limit order to a market order if the limit price is touched? Thank you all in advance for your help!
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Change Limit Order to Market Order
Collapse
X
-
Hello GeoOrtiz,
Thanks for your note.
While a profit target is always a limit order, you could instead place a Stop Market Order as the profit target and StopLimit Order as the stop loss. When one is filled cancel the other.
Below is a link to a reference sample that may help you to accomplish this.
http://www.ninjatrader.com/support/f...ead.php?t=7499Chelsea B.NinjaTrader Customer Service
-
Hello GeoOrtiz,
Thanks for your reply.
SubmitOrder(0, OrderAction.Buy, OrderType.Market, 1, 0, High[0]+2*TickSize, "oco1", "myLong");
This would place a stop market order at 2 ticks above the high of the current bar.
Below is a link to the help guide on SubmitOrder().
http://www.ninjatrader.com/support/h...ubmitorder.htm
Please let me know if I can be of further assistance.Chelsea B.NinjaTrader Customer Service
Comment
-
like to add the following to this thread
Code:if (Position.MarketPosition == MarketPosition.Short) { shorttarget = Position.AvgPrice - tRmult * ATR(1)[0]; ChangeOrder(ProfitTarget,ProfitTarget.Quantity,shorttarget,0);
Free online storage and sharing with Screencast.com. 2 GB of storage and 2 GB of bandwidth per month for free. We won't compress, alter or take ownership of your content.
so i want to take profit the next bar at the market:
i like to change the limitorder into a market order.
i don't see this as an option within ChangeOrder()
Comment
-
to continue:
other option is to change the limitorder price with Close[0]
Code:if (Position.MarketPosition == MarketPosition.Short) { shorttarget = Position.AvgPrice - tRmult * ATR(1)[0]; if (Close[0]<shorttarget)shorttarget=Close[0]; ChangeOrder(ProfitTarget,ProfitTarget.Quantity,shorttarget,0); }
Free online storage and sharing with Screencast.com. 2 GB of storage and 2 GB of bandwidth per month for free. We won't compress, alter or take ownership of your content.
but what about if the open of next bar is greater than the close[0]= shorttarget? will the buylimitorder fill?? In any way is this limit order not way to close to the market with possible unwanted result?
If not possible : is it possible to change a limitorder into a stop order
like:
ChangeOrder(limitorder,limitorder.Quantity,0,newst opprice for old limit order)
please your recommendation
Comment
-
yeshe, the limit order will fill at your price specified on the default fill algorithm in backtesting, never better.
You cannot change an order type with the ChangeOrder method, just cancel your original order and then resubmit as your new desired type via the SubmitOrder.BertrandNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by inanazsocial, Today, 01:15 AM
|
1 response
6 views
0 likes
|
Last Post Today, 02:18 AM | ||
Started by rocketman7, Today, 02:12 AM
|
0 responses
10 views
0 likes
|
Last Post
by rocketman7
Today, 02:12 AM
|
||
Started by dustydbayer, Today, 01:59 AM
|
0 responses
2 views
0 likes
|
Last Post
by dustydbayer
Today, 01:59 AM
|
||
Started by trilliantrader, 04-18-2024, 08:16 AM
|
5 responses
23 views
0 likes
|
Last Post Today, 12:32 AM | ||
Started by Davidtowleii, Today, 12:15 AM
|
0 responses
3 views
0 likes
|
Last Post
by Davidtowleii
Today, 12:15 AM
|
Comment