Login Page - Create Account

Support Board


Date/Time: Sat, 23 Nov 2024 17:33:34 +0000



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

[2024-08-11 16:41:01]
Dryheat31 - Posts: 13
User431178:
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.

Thanks. I completely missed that. If the example provided with that section had used a value of 1 instead of MONDAY, this would have been easier to understand.

I will provide a bit more detail on my thought processes while trying to work through this on my, in the hopes it may help others to avoid getting stuck like I did:

When I am looking for solutions in the language reference, this is the very first thing my eye is drawn to:

if (SCDateTimeVariable.GetDayOfWeek() == MONDAY)
{
// SCDateTimeVariable is a Monday
}

I tend to skip the description and go straight to the code snippet to understand how to use each function. Then I immediately model my own solution based on the example given. And once I get something working, I tweak it to fit my specific needs. Clearly I missed an important detail. But the description should have made it perfectly clear that:
SUNDAY == 0
MONDAY == 1
TUESDAY == 2
....

But since it did not, I was lost in an endless loop of desperately trying to figure out how to use the example code snippet in my own solution. Which is exactly why I structured my original solution to model that same exact layout:

"Check if
SCDateTimeVariable.GetDayOfWeek() == MONDAY
" then assign a value of 1.

However that never worked. There was something else preventing it from working And I believe that was due to the difference between the example snippet provided in the documentation....

SCDateTimeVariable.GetDayOfWeek()

And the solution which finally worked as I expected....

sc.BaseDateTimeIn[sc.Index].GetDayOfWeek()

So for the benefit of those trying to learn how to navigate the language reference, please help us understand how we can make the jump from "SCDateTimeVariable.GetDayOfWeek()" to "sc.BaseDateTimeIn[sc.Index].GetDayOfWeek()", given the examples and descriptions provided in the following language reference:
Working with the SCDateTime Variables and Values: GetDayOfWeek()

It seems to me there needs to a link or explanation that there are other member of the SCDateTime class to which this function may be applied.

And I really appreciate your very detailed response. I have learned a great deal about how to navigate the complexity of the language reference provided by Sierra Chart engineers. It is very detailed, but it's also very easy to stuck in a dead end or chasing rabbits down a hole.

I don't think I ever would have made the jump to...

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

... on my own. So thank for that. And I hope that others who run across this forum post will have a better understanding of how to navigate the language reference more effectively. Such as examining the SCDateTime.h file for more details when the language reference itself is lacking.

Thanks again to Tony and User431178 for steering to the solution, but more importantly, for showing me a better way to work through this sort issue more effectively in the future. I am very grateful.