So for example the SMA(20) values on
12/7/2015 @ 10AM
12/4/2015 @ 10AM
12/3/2015 @ 10AM
12/2/2015 @ 10AM
12/1/2015 @ 10AM
11/30/2015 @ 10AM
...
10/30/2015 @ 10AM
Notice that I'm jumping across weeks, months and possibly years.
I tried using this technique below but then when I go beyond weeks and months I need to start controlling every variable. I'm assuming there is a more direct way.
if (Time[0].DayOfWeek == DayOfWeek.Monday) timeOfInterest = new DateTime(Time[0].Year, Time[0].Month, Time[0].Day - 3, 9, 30, 0); else timeOfInterest = new DateTime(Time[0].Year, Time[0].Month, Time[0].Day - 1, 9, 30, 0); barsAgo = GetBar(timeOfInterest); etc..
Comment