djkiwi
05-30-2011, 06:41 PM
Hi, guys, I'm trying to draw lines for the overnight high and low. For example, if the session is extended hours and session is as follows:
13.30 to 6.30 = overnight session
6.30 to 13.15 = retail session.
What I'm trying to figure out is the high and low between 13.30 and 6.30. The standard PriorDay OHLC ninja indicator shows the high/low for the full 24 hour session. I am able to do this from midnight but how do I start it from 13.30 from the day before.
if(ToTime(Time[0]) > 000000 && ToTime(Time[0]) < 133000)
Also the SampleGetHighLowByTimeRange works for the current day but not for the start time being 13.30 from the day before.
Thanks
DJ
NinjaTrader_Bertrand
05-31-2011, 09:17 AM
DJ, one way would be running on a custom session template that would use the start / end hours you seek, if you need run with the 24 hrs default one you would need to custom track the values needed, you could for example review the min and max methods and then reset your calcs at 'your' session break times.
djkiwi
05-31-2011, 12:28 PM
Thanks Bertrand. I have setup the template for two custom sessions as follows:
13.30 to 6.30 = overnight session
6.30 to 13.15 = retail session.
The SampleGetHighLowByTimeRange still doesn't work though as it doesn't let you overlap the periods. In fact it stops you as per this code on line 89
// Check to make sure the end time is not earlier than the start time
if (EndHour < StartHour)
return;
In fact I tried to remove it and replace these lines
{
startDateTime = new DateTime(Time[0].Year, Time[0].Month, Time[0].Day, StartHour, StartMinute, 0);
endDateTime = new DateTime(Time[0].Year, Time[0].Month, Time[0].Day, EndHour, EndMinute, 0);
}
and replace with the below reflecting that it is one day back:
{
startDateTime = new DateTime(Time[0].Year, Time[0].Month, Time[1].Day, StartHour, StartMinute, 0);
endDateTime = new DateTime(Time[0].Year, Time[0].Month, Time[1].Day, EndHour, EndMinute, 0);
}
Is there some sort of simple way to call up previous sessions like this:
//double value = ((High[0], Bars.BarsSinceSession - 1));
This didn't work either. Any other ideas to get this one?
Thanks.
DJ
NinjaTrader_Bertrand
06-01-2011, 09:35 AM
DJ, you might be able to succeed to modfiy this indicator to your needs to work on a prior day as well, however then you would also face adding weekend and holiday / double sessions logic like for Monday.
I would custom code getting the values you seek, so simply track the highest high / lowest low in a series that you reset as needed when your break times hit.