Support Board
Date/Time: Fri, 07 Feb 2025 17:48:36 +0000
Post From: alert sound every N seconds
[2022-09-08 15:34:49] |
whats1thingnow - Posts: 407 |
related to this issue of alert sound at intervals i have a 30s chart and when the alert condition is TRUE, sound goes off which is great however, when it stays TRUE, the sound keeps going off every 30 seconds (i have 'reset alert condition on new bar' + 'alert only once per bar' on) the alert condition can stay TRUE for 5 minutes to 2 hours ... so hearing the alert every 30 seconds isn't ideal however, i would like to hear it every 5 minutes as long as the condition is TRUE ... is there a way to code this alert condition? as per https://www.sierrachart.com/index.php?page=doc/StudyChartAlertsAndScanning.php#BaseGraphIdentifiers: BARTIME = The Time of the beginning (open) of a bar as an SCDateTime type. For further information and for Spreadsheet functions which can be used with these Date-Time values, refer to Serial DateTime Values. It is recommended to use the TIME function when making comparisons to the BARTIME identifier.
However, making an equals comparison to a time value is imprecise and will not give a TRUE result. This can be solved by calculating the absolute value of the difference between BARTIME the other time value and checking if it is less than a certain value like 1 minute. Example: ABS(BARTIME - TIME(10, 0, 0)) < TIME(0, 0, 1). can we do something like below to check if current bartime divisible by 5 minutes: = ABS(BARTIME / TIME(0, 5, 0)) < TIME(0, 1, 0)
if it's divisible, that means the alert will only be TRUE every 5 minutes (aka at minute 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55) ... wouldn't work for minute 60 because that's 0, but still better than nothing thanks |