NinjaTrader Support Forum  

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 10-12-2010, 03:47 PM   #1
dowindicator
Junior Member
 
Join Date: Aug 2010
Posts: 4
Thanks: 0
Thanked 0 times in 0 posts
Default Exit the same day as entry using daily bars

NT** A Sell stop order placed at '3/8/2004 4:00:00 PM' has been ignored since the stop price is greater than or equal to close price of the current bar. This is an
invalid order and subsequent orders may also be ignored. Please fix your strategy.

The entry is at open. It is a big down day so the market closes below the ExitShortStop. How can I exit the same day as the entry? In real world if a stop order is penetrated the same day as the entry the exit is at the stop price. Does NinjaTrader not imitate real world trading when back-testing?
dowindicator is offline  
Reply With Quote
Old 10-12-2010, 03:57 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,

Welcome to the NinjaTrader forums and thank you for your post!

You will have to debug the price level for your stop order. Help for debugging your NinjaScript strategy is here:
Debugging your NinjaScript Code

You might consider other exit methods like ExitShort() which submit market orders when conditions are true. In backtesting, market orders are submitted at the open of the next bar following the condition.

For more information on the discrepancies expected when backtesting versus real time, please see here:
http://www.ninjatrader-support.com/H...sBacktest.html
NinjaTrader_RyanM is offline  
Reply With Quote
Old 10-13-2010, 04:14 AM   #3
dowindicator
Junior Member
 
Join Date: Aug 2010
Posts: 4
Thanks: 0
Thanked 0 times in 0 posts
Default

Thanks for your suggestions. We did debug the above issue and used a different way to exit but still the same result.

if (dataValue.Low < (Positions[0].AvgPrice - dataValue.Atr * entrySwing.StopAtrMultiplier))
ExitLong(entrySwing.Name);

For GE on 3/8/2004 the entry price is 32.50 the protective stop price is 32 and the close of the day is 31.83. Because the close is lower than the protective stop price NinjaTrader gives an error warning.

Is there a way to get the NinjaTrader to recognize the day of the entry, such as MarketPosition, the same day as the entry, so that it will exit at the stop price the same day?

So far we have tried ExitLong and ExitLongStop and neither of them exited on the same day as the entry. They both exited at the open the next day.
dowindicator is offline  
Reply With Quote
Old 10-13-2010, 04:35 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,567
Thanks: 261
Thanked 1,017 times in 998 posts
Default

You can't submit this stop order as it's not valid, before submitting you would need to check in your code that you actually prepare a legit order, a good practice is checking again the current inside market when submitting your stop orders.
NinjaTrader_Bertrand is online now  
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/Exit at Open/close" on daily bars without an intrabar granularity takeo Suggestions And Feedback 1 12-22-2009 08:01 AM
Entry date shows as the next day of actual entry TintuLal Strategy Analyzer 6 09-25-2009 02:26 PM
Exit Position n bars since entry MAX Strategy Development 5 09-08-2009 04:43 AM
Enter on bars, exit on ticks and min bars requirment coolraz Strategy Development 3 12-15-2008 09:59 AM
Possible to enter/exit during the day with a daily strategy? cunparis Strategy Development 2 11-01-2008 02:58 AM


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