Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Trigger a trade on market open, on opening of first bar.
Collapse
X
-
Hello tomd0361,
Thanks for your post and welcome to the NinjaTrader forums!
You would need to use a calculation mode of Calculate.OnPriceChange or Calculate.OnEachTick so that your code will run intrabar.
Then you can use the system bools of Bars.IsFirstBarOfSession and IsFirstTickOfBar.
Reference:
if (Bars.IsFirstBarOfSession && IsFirstTickOfBar)
{
// entry order
}
Note: the assumption is that you are using a trading hours session where the "Market Open" relates to the opening of the session. If that is not the case then you would need to replace the Bars.IsFirstBarOfSession with a time check of the bar, for example if 8:30 is the opening time and you are using 1 minute bars, you would check the bar (timestamp is based on bar close time) and then on the first tick of that bar perform the entry.
if (Times[0][0].TimeOfDay == new TimeSpan(8, 31, 0) && IsFirstTickOfBar) //
{
// entry order
}
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CaptainJack, 05-29-2026, 05:09 AM
|
0 responses
165 views
0 likes
|
Last Post
by CaptainJack
05-29-2026, 05:09 AM
|
||
|
Started by CaptainJack, 05-29-2026, 12:02 AM
|
0 responses
88 views
0 likes
|
Last Post
by CaptainJack
05-29-2026, 12:02 AM
|
||
|
Started by charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
128 views
0 likes
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
208 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
185 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|

Comment