Login Page - Create Account

Support Board


Date/Time: Sat, 23 Nov 2024 18:12:25 +0000



Post From: Determing Day of week for each bar on the chart

[2024-08-11 09:22:05]
User431178 - Posts: 541
The reason I had those "extra steps" was because the documentation for "GetDayOfWeek()" does not tell us whether it returns a String or an Integer.

Read the documentation again, two lines below the heading it says

int GetDayOfWeek();

the return type is documented as integer, using standard c++ function declaration format.


But if that function does indeed return integers of 0 through 6, then my original solution would have worked, and I would have eventually reduced the complexity of the code to only the essential elements.


sc.DataStartIndex = 1;
// indicator metrics begin here...

SCDateTime scWeekDayString;

if (scWeekDayString.GetDayOfWeek() == SUNDAY) {
weekDay[sc.Index] = 0;

How would your original solution would have worked?
What is your expectation here?
You are calling GetDayOfWeek() on a default constructed (i.e. empty) SCDateTime object, so how that can possibly do anything useful?


It seems the fix that actually made this work was to replace SCDateTime.GetDayOfWeek() with sc.BaseDateTimeIn[sc.Index].GetDayOfWeek(). But where is the documentation for this?

sc.BaseDateTimeIn in an array of SCDateTime objects, so all you are doing call the GetDayOfWeek function on the SCDateTime element stored at sc.Index.

ACSIL Interface Members - Variables and Arrays: sc.BaseDateTimeIn[]


There is lot of essential details lacking in the language reference for this function.
If I am unsure of anything from the reference docs, the next step is to inspect the files provided in the ACS_Source folder.
For example you could look at SCDateTime.h to find out more the SCDateTime member function GetDayOfWeek.