NinjaTrader Support Forum  
X

Attention!

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


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 07-06-2010, 05:24 PM   #1
cre8it8
Senior Member
 
Join Date: Jul 2008
Posts: 102
Thanks: 5
Thanked 2 times in 2 posts
Default Strat Help

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");
}
}
cre8it8 is offline  
Reply With Quote
Old 07-06-2010, 05:55 PM   #2
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

Hello cre8it8,


Some notes on this scenario:
  • The order is canceled if not filled on the bar it was submitted on, unless you use the advanced overload for the EnterShortStop() method that supports the liveUntilCanceled property. This overload can be found in all the Enter and Exit methods.
  • If the order is canceled, conditions are evaluated again and submitted on the next bar if you're running with CalculateOnBarClose = true. It sounds like this is what you're seeing.
Example liveUntilCanceled order:
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.
NinjaTrader_RyanM is offline  
Reply With Quote
Old 07-07-2010, 03:21 PM   #3
cre8it8
Senior Member
 
Join Date: Jul 2008
Posts: 102
Thanks: 5
Thanked 2 times in 2 posts
Default

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.
cre8it8 is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT -6. The time now is 09:34 AM.