NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > Application Technical Support > Miscellaneous Support > Historical Version 7 Beta Threads > Version 7 Beta General Questions & Bug Reports

Version 7 Beta General Questions & Bug Reports Ask questions here and post bug reports.

 
 
Thread Tools Display Modes
Old 03-24-2010, 10:50 AM   #1
joanNT
Senior Member
 
Join Date: Feb 2010
Posts: 128
Thanks: 0
Thanked 0 times in 0 posts
Default Exit & Entry orders in the same bar

Hi!,

I've this code:

if (BarsInProgress == 0 ) {
if (Position.MarketPosition != MarketPosition.Flat) {
if (Position.MarketPosition == MarketPosition.Long) {
ExitLong(1, contratos, "OutUp_f", "Up");
}
if (Position.MarketPosition == MarketPosition.Short) {
ExitShort(1, contratos, "OutDown_f", "Down");
}
}

if (Close[0] > Open[0])
orderlaunch = EnterShortStop(1, true, contratos, Low[0], "Down");
if (Close[0] < Open[0])
orderlaunch = EnterLongStop(1, true, contratos, High[0], "Up");
}

... next at BarsInProgress == 1 it's possible to get out if reaches some condition, if not, like you can see in the above code exits at beginning of the next Bar (BarsInProgress == 0).

Ok, then the problem I've found (or perhaps is the expected behavior) is that if it closes at next bar (BarsInProgress == 0) and also in the same bar the stop price is reached never launches an order into the market.

Is this correct?

I've tried also setting EntriesPerDirection > 1

Thank you
joanNT is offline  
Old 03-24-2010, 11:47 AM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

joanNT,

To understand your orders I suggest you use TraceOrders = true so you can see if orders were ever submitted and if they were why they were ignored/rejected.
NinjaTrader_Josh is offline  
Old 03-24-2010, 12:09 PM   #3
joanNT
Senior Member
 
Join Date: Feb 2010
Posts: 128
Thanks: 0
Thanked 0 times in 0 posts
Default

Thanks Josh,

but I'm doing backtest and I can't see what happens with orders even with TraceOrders = True, cause the information in the output window is not enough, but I really think two orders in the same bar (one exit and one entry stop) it's not possible, which is your opinion?

Do you ever saw this? or could be cause of backtesting?
joanNT is offline  
Old 03-24-2010, 12:12 PM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

Hard to say. You will need to use TraceOrders to determine the behavior you are truly seeing. If you want additional tracking you can add prints from OnOrderUpdate() and see the state changes of the orders too.
NinjaTrader_Josh is offline  
Old 03-24-2010, 12:18 PM   #5
joanNT
Senior Member
 
Join Date: Feb 2010
Posts: 128
Thanks: 0
Thanked 0 times in 0 posts
Default

Ok, I'll try tomorrow.

Thanks
joanNT is offline  
 

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 within same bar mayham Strategy Analyzer 7 11-02-2009 04:22 AM
Performance Object Entry & Exit Times dbw451 Strategy Development 4 04-15-2009 02:59 PM
Entry/Exit Same Bar? GreenTrade Strategy Development 3 01-12-2009 10:18 AM
Tracking orders from entry to exit harri06665 Strategy Development 3 01-06-2009 07:09 AM
Entry and exit orders to the same bar pragma General Programming 5 08-07-2008 04:56 PM


All times are GMT -6. The time now is 10:56 PM.