![]() |
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
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Jun 2007
Posts: 112
Thanks: 0
Thanked 0 times in 0 posts
|
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 |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
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.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Jun 2007
Posts: 112
Thanks: 0
Thanked 0 times in 0 posts
|
So in order to avoid using the bar from the previous session, I need to do something like
if (Bars.BarsSinceSession > 1){return;}? |
|
|
|
|
|
#4 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
Yes, that approach would work.
Ray
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |