PDA

View Full Version : Multiple "Custom Sessions"


GreenTrade
12-09-2008, 06:00 PM
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.

GT

NinjaTrader_Dierk
12-09-2008, 11:52 PM
Unfortunately this is not supported at this time. However, it's on our list for NT7 (first beta in Q1 09).

GreenTrade
12-12-2008, 02:11 PM
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

NinjaTrader_Josh
12-12-2008, 02:17 PM
GreenTrade,

You can see this reference sample on time filters: http://www.ninjatrader-support2.com/vb/showthread.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.