![]() |
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 |
|
Senior Member
Join Date: Jul 2008
Posts: 102
Thanks: 5
Thanked 2 times in 2 posts
|
Hi
I was wondering why when I use the below strategy if the Stop Order doesn't get filled on the One Minute Bar when it goes to the next bar it doesn't put a new Stop Order at the new parameters it waits until the next bar after that basically skipping a bar. It does erase the previous Stop order which is something I do want to have happen but I don't want to skip a bar before placing another new Stop Order. Thanks for any help. protected override void OnBarUpdate() { // Condition set 1 if (Open[0] < Close[0]) { EnterLongStop(DefaultQuantity, Close[0] + 1 * TickSize, "Long"); } // Condition set 2 if (Open[0] > Close[0]) { EnterShortStop(DefaultQuantity, Close[0] - 1 * TickSize, "Short"); } } |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Hello cre8it8,
Some notes on this scenario:
EnterShortStop(0, true,DefaultQuantity, Close[0] - 1 * TickSize, "Short"); If you use this overload to submit your orders, then you have to manually cancel. This reference sample can help with canceling orders and setting up the needed IOrder objects.
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Jul 2008
Posts: 102
Thanks: 5
Thanked 2 times in 2 posts
|
Thanks for the data. I changed it to Calculate On Bar Close False and that helped the skipping a bar problem. I wanted the orders to be deleted on each new bar when it was not filled so that was not a problem.
Thanks for the help. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| RVI in strat | dsraider | Strategy Development | 14 | 02-25-2010 01:52 PM |
| strat persists | ATI user | Version 7 Beta General Questions & Bug Reports | 16 | 12-16-2009 10:15 AM |
| Add SL and TP to Sample Strat. | gator-trader | Strategy Development | 1 | 08-21-2009 10:58 AM |
| Changing QTY of active ATM strat | chuckt101 | SuperDOM and other Order Entry Windows | 1 | 06-12-2009 10:56 AM |
| Placing new strat into Superdom | Lincoln | ATM Strategies (Discretionary Trading) | 6 | 12-05-2006 07:45 AM |