Support Board
Date/Time: Tue, 04 Feb 2025 06:59:41 +0000
[Programming Help] - Obtaining current hour in a CBBOAC study
View Count: 1111
[2020-01-03 14:13:56] |
User623552 - Posts: 69 |
Hi, I'd like to obtain the current chart hour (not the real hour/time, because I will be using it for back testing), for use in a formula. The formula is in a CBBOAC study I don't want to use spreadsheets or ASCIL, I'd just like to obtain the hour value in a formula I'm using in a "Colour Bar Based on Alert Condition" study. However I can't seem to find any way to obtain the current hour here. I have spent a long time looking. The 'hour' function doesn't work here. I know I could obtain it via a spreadsheet, but I don't want to have to include a spreadsheet in my chart just to obtain this one variable. Is there a way to do this? Thanks (p.s. The reason I need this is because I want the formula only to be calculated during certain hours of the day) Date Time Of Last Edit: 2020-01-03 14:18:31
|
[2020-01-03 15:18:59] |
Ackin - Posts: 1865 |
TIMEVALUE("xx:xx:xx") also works for Alerts tab of the Color Bar Based On Alert Condition study: Look at: Spreadsheet Systems, Alerts and Automated Trading: Cancel Working Orders [J27] Date Time Of Last Edit: 2020-01-03 15:21:12
|
[2020-01-03 15:36:38] |
User907968 - Posts: 825 |
Also see example 6. here - Study/Chart Alerts And Scanning: Alert Formula Examples For the hour at the start of a bar, you could also use - ABS(BARTIME * 24) |
[2020-01-03 16:01:52] |
User623552 - Posts: 69 |
Great, I'll check it out Thanks! |
To post a message in this thread, you need to log in with your Sierra Chart account: