Login Page - Create Account

Support Board


Date/Time: Fri, 03 May 2024 13:11:33 +0000



[Programming Help] - Bar Time Duration study

View Count: 2088

[2019-04-09 21:32:53]
User982736 - Posts: 46
I am writing a study based on the Bar Time Duration study and I want to use s_UseTool to draw a line on a specific duration, like 00:01:50.

What value do I put in Tool.BeginValue?
[2019-04-09 22:56:21]
Sierra Chart Engineering - Posts: 104368
The value can be determined using this class constructor:
SCDateTime(int Hour, int Minute, int Second, int Millisecond);


SCDateTime TimeLength(0, 1, 50, 0);
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2019-04-09 23:11:09]
User982736 - Posts: 46
That works fine. Thanks.
Date Time Of Last Edit: 2019-04-09 23:11:22
[2019-11-14 18:56:10]
kvcornie - Posts: 2
I am trying to do something very similar to the original question, in this thread, however I'm not creating a custom study.

My goal is to highlight Bar Time Duration bars that are Less than a certain duration i.e. 90 seconds.

I'm attempting this using the "Color Bar Based On alert Condition" study which is applied to the "Bar Time Duration" Study

Maybe this can't be done because the necessary TIME, as a duration, Function doesn't exist i.e. the solution above was to create a class which I assume can only be done in ACSIL/Custom Studies. (please excuse an naivety in this statement, I am new to Sierra and an EXTREMELY novice programmer)

If this is not possible there is no need to read on, as that is only to demonstrate the solutions I tried prior to posting in the support board. Please just let me know if there is a workaround. Thanks!





Though, I thought maybe Alert criteria written in decimal format might work given that I've applied the "Horizontal Lines" study to the chart and entered Decimal values which draw lines correctly even though the Y axis is formatted with standard time format and that study is also based on the Bar Time Duration Study.

So far I have gotten the following results. Please note that I have the Bar Time Duration study using a Maximum Duration of 00:02:15 or 135 seconds.

"=True" evaluates to "TRUE" as expected (all bars change color) evidenced by the Bar Time Duration Study Bars changing to the expected color

"= SG4 < 1" evaluates to “TRUE” as expected (all bars change color) since this would be MUCH greater than 2 min and 15 seconds in Serial DateTime values.


What I don’t understand:

“=SG4 > 0” evaluates to “FALSE” – I assuming these values have to be greater than 0 regardless of the format used or again, do I need the proper time class.

“SG4 < 0.0010416” evaluates to “TRUE” evidenced by ALL of the bars changing color. However, a time of 90 seconds/86,400 = 0.0010416 should have only some of the bars changing color as I have many bars that are greater than 90 seconds

Also, changing the Value Format of the “Color Bar Based On alert Condition study” to “Time” from “Inherited” does not work either.



I also tried this syntax which I found in another thread and it still colored all the bars.

=SG4<TIMEVALUE("00:01:30")

AND these which I derived from #30 of your formula examples on the forum.

=SG4 < (TIME(0, 1, 31) - TIME(0, 1, 29))
=SG4 < TIMEVALUE( (TIME(0, 1, 31) - TIME(0, 1, 29)))
[2019-11-14 22:30:51]
Sawtooth - Posts: 3992
Try this:
Add the Bar End Time study.
Use this formula on the Alerts tab of the Color Bar Based On Alert Condition study:
=ID1.SG1-BARTIME<TIMEVALUE("00:01:30")
where the Bar End Time study is ID1; edit as needed.
[2019-11-15 16:40:23]
kvcornie - Posts: 2
Unfortunately it didn't work. All bars are colored.

I used:

=ID11.SG4-BARTIME<TIMEVALUE("00:01:30")

I did realize bars are only colored for the current day, which is the case for my previous attempts as well.

So that also needs a solution.
[2019-11-15 16:54:14]
Ackin - Posts: 1865
I did realize bars are only colored for the current day

Try increase the number of bars
"Number of Bars to Calculate (In2):"
[2019-11-15 17:03:18]
Ackin - Posts: 1865
Unfortunately it didn't work. All bars are colored.


Try attached file

How to Use a Study Collection
How to Use an Advanced Custom Study or a Study Collection: How to Use a Study Collection
Date Time Of Last Edit: 2019-11-15 17:17:27
attachmentBarTimeDuration.StdyCollct - Attached On 2019-11-15 17:02:40 UTC - Size: 18.7 KB - 323 views
imageBarTimeDuration.png / V - Attached On 2019-11-15 17:02:49 UTC - Size: 27.41 KB - 359 views
[2019-11-15 19:31:15]
Sawtooth - Posts: 3992
Unfortunately it didn't work.
The Bar End Time study does not have an SG4.

Only edit the ID# in the formula to match the Bar End Time study's ID#.
Do not edit the SG#.

bars are only colored for the current day
In the Color Bar study settings, increase the 'Number of Bars To Calculate'.

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

Login

Login Page - Create Account