![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Member
Join Date: Jun 2009
Posts: 78
Thanks: 0
Thanked 1 time in 1 post
|
Hi!
I have the following strategy (unmanaged approach) on a 5 min chart: A Stop Buy order 1 pip over the High of a range. The stop buy order should be cancelled as soon as the range is broken to the downside. The problem: If one bar breaks the range downward and upward the stop buy order gets filled but should be cancelled. I tried to cancel the pending order in a lower time frame (1 min) but thats not possible because the order is already filled, although the buy point was not hit yet! So how to cancel the pending entry order? Thanks, DH |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,404
Thanks: 252
Thanked 974 times in 957 posts
|
DH, you would need to debug the event / bar event update sequence seen by your strategy, if you try to do this from the 5 bars close in backtesting there would not be enough granularity available to do the order cancelleation as you desire as it all happens in one 5 min bar correct?
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Jun 2009
Posts: 78
Thanks: 0
Thanked 1 time in 1 post
|
Yes, it all happens in one 5 min bar. That's why I tried to cancel the order in a lower time frame. But as soon as I get the first 1 min bar the order is already filled, but should not be filled at this point.
|
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,404
Thanks: 252
Thanked 974 times in 957 posts
|
From the perspective of the closed 5 min bars in backtesting it likely would be filled then, you would need to debug with Prints / TraceOrders to understand the event sequence your code runs through to arrive at this result.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Member
Join Date: Jun 2009
Posts: 78
Thanks: 0
Thanked 1 time in 1 post
|
Well, either I do something very wrong or there is a bug in back testing.
On the attached picture you see a 5 min chart (the primary series) with the trade which should not execute on the upper side and a 1 min chart on the lower side. All trades are handled in the 1 min time frame. At 22:30, at the end of the range, a stop buy was entered. At 22:33, the range was broken to the downside and the pending entry order should get cancelled. But at this time, the entry order was already filled! Also the corresponding SL and TP orders have already been entered (at OnOrderUpdate)! It looks like that it is not possible to handle trades in a lower time frame than the primary data series. Please advise. Thanks, DH |
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,404
Thanks: 252
Thanked 974 times in 957 posts
|
DH008, so you're sending those orders directly to the BIP = 1 or do you only submit them on the BIP 1 event? Would it be possible to send me the strategy to reproduce here on our end? You can mask any proprietary logic used if sensitive for you.
Thanks,
Bertrand
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Multi Time Frame Strategy Cancellation | jthom | Automated Trading | 3 | 06-18-2010 02:18 PM |
| Multi-time frame - order | Outlier | Strategy Development | 1 | 05-20-2010 08:25 AM |
| ATM Strategy Order Cancellation If Not Filled After Specified Time | KBJ | ATM Strategies (Discretionary Trading) | 1 | 12-15-2009 01:48 PM |
| Multi-Time Frame Order Delay | darckeen | Strategy Development | 10 | 08-31-2009 07:07 AM |
| Adjust order cancellation time | webhalla | Automated Trading | 3 | 05-23-2007 02:05 PM |