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 charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
51 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
142 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
160 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
96 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
275 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|

Comment