I want to find out what day of week it is today (monday, tuesday...) and then have my indicator do something.
I read other posts using the "GetTradingDaysFromLocal" but in my case for some reason it works once when I compile the indicator, but afterwards it justs reference to the first day the chart start (so if I 5 days loaded it references to 5 days ago).
This is what I have:
if (CurrentBar == 0)
{
startDateTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 9, 30,0);
currentDate = Bars.GetTradingDayFromLocal(Time[0]);
return;
}
if (currentDate.DayOfWeek == DayOfWeek.Monday)
{
firstBars = GetBar(startDateTime.AddDays(-3));
}
DrawTextFixed("xx", "TEST-" + currentDate.ToString(), TextPosition.TopLeft, Color.Black, new Font("Arial Narrow", 12), Color.Crimson, Color.Red, 10);
Check what today is, if monday then go back 3 days and do something. The DrawTextFixed I added to find out what is going on.
Any hints would be appreciated.
Martin

Comment