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 futtrader, 04-21-2024, 01:50 AM
|
6 responses
57 views
0 likes
|
Last Post
by futtrader
Today, 11:54 AM
|
||
Started by sgordet, Today, 11:48 AM
|
0 responses
1 view
0 likes
|
Last Post
by sgordet
Today, 11:48 AM
|
||
Started by Trader146, Today, 11:41 AM
|
0 responses
2 views
0 likes
|
Last Post
by Trader146
Today, 11:41 AM
|
||
Started by jpapa, 04-23-2024, 07:22 AM
|
2 responses
17 views
0 likes
|
Last Post
by rene69851
Today, 11:39 AM
|
||
Started by funk10101, Today, 11:35 AM
|
0 responses
1 view
0 likes
|
Last Post
by funk10101
Today, 11:35 AM
|
Comment