Login Page - Create Account

Support Board


Date/Time: Fri, 17 Sep 2021 03:44:28 +0000



[Programming Help] - Draw vertical line on last bar of the week. Color Background Based On Alert Condition

[2021-07-21 02:32:36]
NukazukeL - Posts: 17
I'd like to draw a vertical line on Friday Close or last bar of the week.
I searched and understand I can use Color Background Based On Alert Condition.
But I can not understand BARDATETIME definition.
So please tell me the how to code...
Thanks.
[2021-07-21 03:33:46]
tomgilb - Posts: 2984
What are the Session times of the chart, and what is the Bar Period?
[2021-07-21 04:36:21]
NukazukeL - Posts: 17
tomgilb

Session time 17:00-16:59 EST.
240,60,30,15minutes bar.
Thanks for reply.
[2021-07-21 13:27:39]
tomgilb - Posts: 2984
Try this:
=AND(WEEKDAY(BARDATE)=6,WEEKDAY(BARDATE[1])=1)

The first half of the formula finds the Fridays.
The second half of the formula finds the Sundays after the Fridays.
When both are TRUE, it finds the last bar on Friday.

WEEKDAY =6 is Friday
WEEKDAY =1 is Sunday
https://www.sierrachart.com/index.php?page=doc/SpreadsheetFunctions.html#WEEKDAY_Function

BARDATE is the Date of the Serial DateTime, counting the days from Dec 31, 1899.
https://www.sierrachart.com/index.php?page=doc/SpreadsheetFunctions.html#SerialDateTimeValues
[2021-07-22 23:40:05]
NukazukeL - Posts: 17
tomgilb

Works fine.
Thank you very much.

To post a message in this thread, you need to login with your Sierra Chart account:

Login

Login Page - Create Account