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 09-07-2007, 07:49 AM   #1
mazachan
Senior Member
 
Join Date: Jun 2007
Posts: 112
Thanks: 0
Thanked 0 times in 0 posts
Default 2 Questions

I have a question with regards to how the strategy session time works. If I have a session start at 8:30 on the 3 minute time frame, and I call the Close[1] right at the start, will the strategy see the 8:27 bar or the bar from the previous session? If I set it to 8:30-15:00, would it use the 15:00 bar for the Close[1]?

Also, if I have strategy A that has an Open position and calls a helper method in strategy B, and strategy B calls MarketPosition.Position == Position.Flat, will it see the position as flat or would it recognize the open position and act accordingly?

Thanks
mazachan is offline  
Reply With Quote
Old 09-07-2007, 07:56 AM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

On the close of the 8:33 bar (1st bar of the session), Close[1] will return the last bar of the prior session. If you session time ended at 3:15 PM, it would reference the last bar of around that time.

Position only returns the position of that strategy, not the underlying account.
NinjaTrader_Ray is offline  
Reply With Quote
Old 09-07-2007, 08:05 AM   #3
mazachan
Senior Member
 
Join Date: Jun 2007
Posts: 112
Thanks: 0
Thanked 0 times in 0 posts
Default

So in order to avoid using the bar from the previous session, I need to do something like
if (Bars.BarsSinceSession > 1){return;}?
mazachan is offline  
Reply With Quote
Old 09-07-2007, 08:21 AM   #4
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

Yes, that approach would work.
NinjaTrader_Ray 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
Miscelleneous Questions NinjaTrader_Ray General Programming 6 07-10-2007 10:18 AM
Mail ATI Questions MindSabre Automated Trading 5 06-27-2007 03:57 AM
questions about trendlines? max1ci6 Charting 5 04-25-2007 02:49 AM
A few NT6 questions miked11 Charting 2 01-14-2007 10:28 AM
Few questions MAX General Programming 8 11-16-2006 06:53 AM


All times are GMT -6. The time now is 04:40 AM.