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 01-12-2009, 09:32 AM   #1
GreenTrade
Member
 
Join Date: Jan 2008
Posts: 97
Thanks: 0
Thanked 1 time in 1 post
Default Entry/Exit Same Bar?

I am trading short term with 5 minute bars and have a problem when there is a decent move during one bar. If I enter a short trade on the bar and have my stop order working immediately, if the high of the bar is above the stop order I get the following error:

"a BuyToCover stop order placed at '1/6'2009 2:40am' has been ignored since the stop price is less than or equal to the close price of the bar. This is an invalid order and subsequent orders may also be ignored. Please fix your strategy."

This is happens on historical data but the problem is that it shuts my system down and leaves the position open and I cannot just start the data more recent because the indicators need more bars for the calculation. I would have thought the stop order would be triggered and the position would be closed out at a loss. What is the best way to fix this?

GT
GreenTrade is offline  
Reply With Quote
Old 01-12-2009, 09:46 AM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

GreenTrade,

You need to fix the order to submit at a price that is valid. There is no other way.
NinjaTrader_Josh is offline  
Reply With Quote
Old 01-12-2009, 10:07 AM   #3
GreenTrade
Member
 
Join Date: Jan 2008
Posts: 97
Thanks: 0
Thanked 1 time in 1 post
Default

Thanks for the quick response. Would something like this example work (strategy: Backtesting NinjaScript Strategies with an intrabar granularity) or is this for something else? If so, my understanding of the example is that the strategy works the same but you add a separate period (like 1 minute) and although the conditions will still be looked at in the larger time period the orders will be submitted on the 1 minute time period. Is that correct? Thanks!

http://www.ninjatrader-support2.com/...ead.php?t=6652

GT
GreenTrade is offline  
Reply With Quote
Old 01-12-2009, 10:18 AM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

That is correct. If you want the higher granularity during backtesting you would want to try the reference sample.
NinjaTrader_Josh 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
Entry and EXIT an SMA Sailor General Programming 10 07-06-2009 10:13 AM
Entry and exit orders to the same bar pragma General Programming 5 08-07-2008 04:56 PM
Entry / Exit Strategy Edgar V. Strategy Analyzer 19 03-17-2008 07:29 AM
Stop Loss @ Low/High of Entry Bar minus one Bar SamIam Strategy Development 5 08-29-2007 03:55 AM
order entry/exit Vin Miscellaneous Support 1 06-29-2005 12:10 AM


All times are GMT -6. The time now is 06:20 PM.