Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 00:29:00 +0000



[User Discussion] - BARTIME CODE

View Count: 1202

[2014-06-30 17:38:42]
User43894 - Posts: 7
SC or anyone else who knows how to write code,

How would I code an alert on a 10 range bar that has no more than 2 minutes between the current bar and 2 bars prior?
This is what I have so far----
bartime[2] - bartime[0] <= 00:02:00

Thanks in advance.
Date Time Of Last Edit: 2014-06-30 18:16:43
[2014-07-01 00:14:40]
Sawtooth - Posts: 4120
Try this:

=BARTIME-BARTIME[-2]<=TIMEVALUE("00:02:00")

The bartime uses Excel time formatting, and formulas can use many Excel functions.
The current bar has a larger time value than previous bars.
The bartime is the bar open timestamp.
[2014-07-01 18:55:47]
User43894 - Posts: 7
Tomgilb:

When SC evaluates the timevalue, does it use the open of the bar like it does to print the times on the bottom of a chart?

And thanks for your reply, that is exactly what i wanted to do.
[2014-07-01 19:56:53]
User43894 - Posts: 7
Tomgilb:

Also, how do I evaluate for only a touch of a moving average and not just a close or a low or a high beyond a moving average?

Thanks in advance.

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

Login

Login Page - Create Account