Login Page - Create Account

Support Board


Date/Time: Tue, 23 Apr 2024 13:47:42 +0000



[Programming Help] - Day of week and time of day alert

View Count: 2918

[2017-05-26 14:57:36]
User98657 - Posts: 304
I'm trying to create an alert for a specific time of day and a certain day of the week.

I can use the Time Range Highlight to highlight my bars, or background for time range, but how can I incorporate the day of the week?

If anyone has done this and has any input i would appreciate it.
[2017-05-26 17:06:50]
Sawtooth - Posts: 3976
You can use some spreadsheet functions in Simple Alert formulas.
Try a formula like this:

=AND(WEEKDAY(BARDATE)=4,BARTIME>TIMEVALUE("09:59:59"),BARTIME<TIMEVALUE("10:00:01"))

This will alert on Wednesdays at 10am.
You can put this formula in any study's Alerts tab, or in the Chart Setting's Alerts tab.

Study/Chart Alerts And Scanning: Available Main Price Graph Identifiers/Variables
https://www.sierrachart.com/index.php?page=doc/SpreadsheetFunctions.html#WEEKDAY_Function
Date Time Of Last Edit: 2017-05-26 17:09:47
[2018-09-15 06:50:28]
User164231 - Posts: 278
Hi Tom,

Is it possible to create a color background alert to warn myself ahead of contract roll over and expiry date?

These did not work; =AND(BARDATE=(20180911),BARTIME>TIMEVALUE("09:59:59"),BARTIME<TIMEVALUE("10:00:01"))


=BARDATE=(20180911)


PS, I found the time alert tab at Window but knowing the formula could help in auto trading and can be visual when used with color background anyways.


Thanks again.
Date Time Of Last Edit: 2018-09-15 09:40:56
[2018-09-15 14:00:59]
Sawtooth - Posts: 3976
All references to date and time use Serial DateTime Values.
Spreadsheet Functions: Serial DateTime Values

To reference a specific date, use the DATEVALUE function:
=BARDATE=DATEVALUE("09/11/2018")

=DATEVALUE("09/11/2018") returns the Date Value of 43354, which is the number of days since 12/31/1899.

Notes:
1. This is the only supported syntax in SC: =DATEVALUE("09/11/2018")
=DATEVALUE("2018/09/11") is not supported.
2. Excel's Serial Date Time starts on 1/1/1900, not 12/31/1899.
Excel:
=DATEVALUE("1/1/1900") = 1
Sierra Chart:
=DATEVALUE("1/1/1900") = 2
Date Time Of Last Edit: 2018-09-16 19:34:59
[2018-09-17 15:56:41]
John - SC Support - Posts: 31027
With regards to the difference between Sierra Chart and Excel's Serial Date Time noted in Post #4, there is only a discrepancy for dates prior to March 1, 1900. This is due to an historical issue where Microsoft has decided to keep February 29, 1900 as an actual day, even though it did not exist. Therefore Excel has day 0 on 12/31/1899 and Sierra Chart has day 0 on 12/30/1899.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing

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

Login

Login Page - Create Account