GT
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Multiple "Custom Sessions"
Collapse
X
-
Multiple "Custom Sessions"
I would like my strategy to trade 1 time in the morning and 1 time in the afternoon. I have figured out how to limit it to 1 time per session but cannot figure out how to set up two "custom sessions" (9:30am - 12:00pm and 12:00pm - 3:30pm) or another way to do this. You help is appreciated.
GTTags: None
-
How about using something like this:
in the OnBarUpdate section:
if(DateTime.Now.Ticks == 093000)
{
bool longTraded = false;
bool shortTraded = false;
if(entryOrder == null && (ToTime(Time[0]) >= 093000 && ToTime(Time[0]) <= 120000) && long entry conditions met)
entryOrder = EnterLongStop(1, Close[0]+ATR(14)[0], "LongEntry");
if(entryOrder == null && (ToTime(Time[0]) >= 093000 && ToTime(Time[0]) <= 120000) && short entry conditions met)
entryOrder = EnterShortStop(1, Close[0]-ATR(14)[0], "ShortEntry");
}
In the OnExecution(IExecution execution) section under the stop and limit orders putting: LongTraded = true
Which would then not allow another trade until the original timeframe again. Also add another timeframe with longtraded2 = false. Would something like this work or am I way off? Thanks for the help!
GT
Comment
-
GreenTrade,
You can see this reference sample on time filters: http://www.ninjatrader-support2.com/...ead.php?t=3226
Just create yourself two time filters and add yourself your two flag variables. Essentially the idea you have running right now. Unfortunately as Dierk stated though it is currently not supported.Josh P.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
635 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
364 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
106 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
567 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
571 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment