Im trying to create a line at the session open of the first day of the month and extend the line to the last day of the month, but having some trouble here. The below code only works if the prior bar was a different month. If a new month starts mid week, its thrown off because prior bar wasnt a different month since the line starts at session open. What would be the best route to take to correct that? Any advice is welcome.
if (Time[1].Month != Time[0].Month)
{
sTime = Time[0].Date.AddHours(18).AddMinutes(BarVal);
eTime = Time[0].Date.AddDays(DateTime.DaysInMonth(Time[0].Year, Time[0].Month)).AddHours(17);
if (Time[0] == sTime)
{
sPrice = Open[0];
}
}

Comment