Login Page - Create Account

Support Board


Date/Time: Sat, 20 Apr 2024 10:46:24 +0000



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

View Count: 488

[2021-07-21 02:32:36]
NukazukeL - Posts: 22
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]
Sawtooth - Posts: 3976
What are the Session times of the chart, and what is the Bar Period?
[2021-07-21 04:36:21]
NukazukeL - Posts: 22
tomgilb

Session time 17:00-16:59 EST.
240,60,30,15minutes bar.
Thanks for reply.
[2021-07-21 13:27:39]
Sawtooth - Posts: 3976
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.
Spreadsheet Functions: Serial DateTime Values
[2021-07-22 23:40:05]
NukazukeL - Posts: 22
tomgilb

Works fine.
Thank you very much.

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

Login

Login Page - Create Account