Login Page - Create Account

Support Board


Date/Time: Fri, 07 Feb 2025 15:07:44 +0000



Post From: alert sound every N seconds

[2022-09-08 18:21:13]
Sawtooth - Posts: 4173
Try this formula to find 5 min interval bars on a time-based chart of a smaller timeframe:
=BARTIME=MROUND(BARTIME,5/1440)
(5/1440 equals 5 minutes in SerialDateTime because there are 1440 minutes in a 24hr day.)

This would alert every 5 min, but would miss the initial alert before the first 5 min multiple:
=AND(YourAlertConditionTRUE,BARTIME=MROUND(BARTIME,5/1440))

So use another instance of the Color Bar Based On Alert Condition study to create a persistent TRUE when the alert happens, then release it when it goes FALSE, like this:
=IF(YourAlertConditionTRUE,1,IF(YourAlertConditionFALSE,0,ID2.SG1[-1]))
where ID2 is this Color Bar study.
Hide this study.

Then use a formula like this in the other Color Bar study:
=OR(AND(ID2.SG1[-1]=0,ID2.SG1=1),AND(ID2.SG1,BARTIME=MROUND(BARTIME,5/1440)))
where ID2 is the hidden Color Bar study.
This will alert at the first YourAlertConditionTRUE, and alert again at every 5 min multiple until YourAlertConditionFALSE.
It finds the transition from FALSE to TRUE, and it finds when it's TRUE at every 5 min multiple.
Date Time Of Last Edit: 2022-09-08 19:18:37