public override void Calculate(int index)
{
if (index == 0) return;
DateTime currentTime = MarketSeries.OpenTime[index];
DateTime previousTime = MarketSeries.OpenTime[index-1];
if(currentTime.Month != previousTime.Month)
{
// first bar of the month
}
if(currentTime.DayOfWeek == DayOfWeek.Monday && previousTime.DayOfWeek != DayOfWeek.Monday)
{
// first bar of the week
}
if(currentTime.Date != previousTime.Date)
{
// first bar of the day
}
//...
Any idea how to get the actual index of Day start, Week start and Month start?
I'm confused there should be a quick way to get them. help is highly appreciated.
hamsider
21 Sep 2021, 12:47
RE:
cAlgo_Fanatic said:
Any idea how to get the actual index of Day start, Week start and Month start?
I'm confused there should be a quick way to get them. help is highly appreciated.
thank you