![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Sep 2008
Posts: 68
Thanks: 0
Thanked 0 times in 0 posts
|
I am working on a multi-Time frame strategy which places both Stop and Market entry orders. The orders are placed from the BarsInProgress==0 region but are indexed to the lower time frame.
My question is reagrding the "life" of the order. I know that the order is cancelled at the end of the current bar and must be resubmitted. Does this have to be done in the lower timeframe or will the order be "live" until the next onbarupdate call from the primary time frame? |
|
|
|
|
|
#2 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
clfield,
I believe it will need to be kept alive on all BarsInProgresses. An easy way to work with this would be to just use liveUntilCancelled = true for the orders and then you won't need to worry about resubmissions.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Sep 2008
Posts: 68
Thanks: 0
Thanked 0 times in 0 posts
|
If I set it up as you suggest would I need to actually cancel each order if it did not fill and my entry condition was not met on the next bar? Also what about updating the Stop price in the StopEntry entry?
|
|
|
|
|
|
#4 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
You would indeed need to cancel the order when your condition is no longer true. This can be done through a simple call to CancelOrder().
Updating stop prices works like how it does before. If you want to modify the order, call the order again to make the change.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Member
Join Date: Sep 2008
Posts: 68
Thanks: 0
Thanked 0 times in 0 posts
|
Thank you for your replies.
I was thinking could I put the order placement in at the end of the OnBarUpDate after all the BarsInProgress calls so it would be run every time OnBarUpDate was called regardless of which Bars Object initiated the update? |
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,013 times in 994 posts
|
clfield, this is also an option (don't filter OnBarUpdate calls), but it may be easier to submit it as liveUntilCancelled and then cancel if needed.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Member
Join Date: Sep 2008
Posts: 68
Thanks: 0
Thanked 0 times in 0 posts
|
Thank you for the confirmation.
Can the StopEntry price be undated each bar without first canceling the existing StopEntry order? |
|
|
|
|
|
#8 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,013 times in 994 posts
|
Not sure I follow what you mean by 'undated', if you want to move the stop price to a new leve, just resubmit the order with the new stop price to make the modification.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#9 |
|
Member
Join Date: Sep 2008
Posts: 68
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks for the clarification. So if I am staying with the same type of Entry order IE Stop or Limit or StopLimit I do not need to cancel the previous roder than submit a new one with the new Entry Price? But if I am going to change the type of Entry then I would need to cancel the previous order before submitting the new one.
|
|
|
|
|
|
#10 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,013 times in 994 posts
|
Correct, for a new price, just resubmit the order to change it.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#11 |
|
Member
Join Date: Sep 2008
Posts: 68
Thanks: 0
Thanked 0 times in 0 posts
|
When using the technique where the order is placed each OnBarUpdate and not kept live until canceled and I change from a StopEntry to a Market or Limit Entry Order and I want to use the same IOrder entry name I won't I have to wait for confirmation of the canceled order in the OnOrderUpdate method before submitting the the new order to avoid losing the order info?
I am trying to avoid having to manage stops and targets for two seperate IOrder objects. |
|
|
|
|
|
#12 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
I do not recommend using the same IOrder object for separate orders. If you do you should wait for confirmation on a terminal state of the original order before replacing the object with the new order. If you don't wait for confirmation you run the risk of the order not going terminal and you lose all ability to control it after you overwrite the references.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#13 |
|
Member
Join Date: Sep 2008
Posts: 68
Thanks: 0
Thanked 0 times in 0 posts
|
Where would be the best place to check for the Terminal state, OnExecution or OnOrderUpdate? I understand what you are saying about losing control of the order. The problem with seperate IOrder objects for each entry type comes when you place and manage the stop and target orders after the entry order has filled.
|
|
|
|
|
|
#14 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
clfield,
Best would be OnOrderUpdate().
Josh
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Cancel unfilled Auto order not working ..need help | pdawg | Strategy Development | 21 | 04-15-2013 05:52 AM |
| Position.MarketPosition with unfilled limit orders | honvl | Strategy Development | 1 | 06-05-2009 12:23 PM |
| How does NJ handles unfilled contracts by default? | ninjaq | Strategy Development | 1 | 05-28-2009 10:17 AM |
| Now a happy life-time multi-broker customer | heech | Suggestions And Feedback | 1 | 12-04-2008 11:17 AM |
| Multi Broker - Life Time License | mapfler | Installation and Licensing | 1 | 09-17-2008 09:58 AM |