I have a desire to have my chart know if a bar is the last bar of the calendar month. This will be different depending on your PCs clock time of course.
But for example, to find the weekly Open I've used:
if(Time[0].DayOfWeek.ToString() == "Sunday" && Bars.FirstBarOfSession ) PlotSomething;
To find the Weekly Close, I've used:
if(Time[0].DayOfWeek.ToString() == "Friday" && Bars.LastBarOfSession ) PlotSomething;
To Find the Monthly Open, I've used:
if(Time[0].DayOfWeek.ToString() == "Sunday" && Bars.FirstBarOfSession && Time[0].Day <= 7) PlotSomething;
For the Monthly Close, I can't think of the logic to work consistently? Just of note this is for FX data, using a 24/7 template. My timezone is Central Standard Time, or UTC-06:00.
I was thinking to find the MOntly Close Bar, would be like:
if((Time[0].DayOfWeek.ToString() == "Friday" && Bars.LastBarOfSession && Time[0].Day <= 5) [B]||[/B](Time[0].DayOfWeek.ToString() == "Friday" && Bars.LastBarOfSession && Time[0].Day >=27)) PlotSomething;
Or is there an easier way to accomplish what I'm trying to do?
Thanks!
Comment