Login Page - Create Account

Support Board


Date/Time: Wed, 30 Oct 2024 22:56:03 +0000



What is the simplest way to plot a box around a time interval?

View Count: 1907

[2021-03-27 03:49:56]
RoadKill - Posts: 38
I'm trying to find out what is the simplest way to plot a box that:
1. has a time range given by 2 certain hours and minutes, and
2. has the price level determined my the High and Low prices within that range.

For example,
I want to put a box on the chart showing the NY session that take place between 09:30 to 16:00 EST,
whose upper and lower boundaries are given by the High and Low within that time time.

After having looked at the hundreds of various example code, there is not one single example that plots a box of any kind, although there a plenty of weird and poorly documented functions that does all sort of other things... The closes I got was the "Weekly HL" (with no source code, afaict) and the "Daily Range Bands" with a lot of extra/undocumented features and spaghetti code.

Can some one please provide a study code to plot a box as suggested above?
[2021-03-27 20:34:53]
Sawtooth - Posts: 4103
I want to put a box on the chart showing the NY session that take place between 09:30 to 16:00 EST,
whose upper and lower boundaries are given by the High and Low within that time time.
The simplest way to do this is to use the High/Low For Time Period study:
- Set the Start/End times to 09:30 and 16:00.
- Set the SG1 Draw Style 'Transparent Fill Rectangle Top', and choose the color.
- Set the SG2 Draw Style 'Transparent Fill Rectangle Bottom'.

You could also use the Fill Rectangle Top/Bottom pair.
[2021-03-28 17:42:01]
RoadKill - Posts: 38
Hi Tom,

Yes, I already tried that. But I need more than one session, and do
not want to (ultimately) have to add 12 studies in order to see all
the sessions I want. So I'm trying to do this in ACSIL, hoping to
combine them into one. I tried to use the Fill Rectangle Top/Bottom,
but could not get the time right, ending up just filling the very
last bar on chart.

I also looked at the Code for:
Studies6.cpp:3012:SCSFExport scsf_HighLowForTimePeriodExtendedLines
But, it's overly complicated as it is using a lot of extra (and useless) functions while
seemingly trying to compensate for a dynamic chart. This effectively prevents
you from effectively re-using the code for multiple sessions.

Basically we need (to create?) a function such that it can be used like this:
Rectangle(Name, Color, LineStyle, StartTime, EndTime, High, Low)

Frankly, I'm surprised there's not already something built-into SC for doing this.
Date Time Of Last Edit: 2021-03-28 17:47:05
[2021-03-28 22:18:45]
Sawtooth - Posts: 4103
You just need one High/Low For Time Period study for each session.
It draws a shaded area instead of a box.
See attached to see 3 sessions.
image3 Sessions.PNG / V - Attached On 2021-03-28 22:18:10 UTC - Size: 68.6 KB - 510 views
[2021-03-29 09:10:48]
User907968 - Posts: 821
Frankly, I'm surprised there's not already something built-into SC for doing this.

If you don't want to use subgraphs to display the session boxes, there is certainly the possibility to use drawing tools within ACSIL - https://www.sierrachart.com/index.php?page=doc/ACSILDrawingTools.html.

However, as Tom already suggests, by far the simplest way to achieve this is to use multiple copies of the 'High/Low For Time Period' study.
[2021-03-30 20:58:48]
RoadKill - Posts: 38
@User907968

by far the simplest way to achieve this is to use multiple copies of the 'High/Low For Time Period' study.

I know, and that is exactly what I want, but that is the thing. To quickly change or add a session I need to go find the correct study, and edit each in a different place, and having to deal with a bunch of settings I will never use and which are poorly explained. (They are all named the same and study selection/settings window which is not resizable! This is a very annoying bug all over SC, when you can't resize frequently used windows, that are containing rows with long column info.)

The code for that need to be rewritten to allow for adding multiple studies within. I already tried, but it got complicated quickly as the code within was not reusable, since it was not written in functional/objectified form.

In addition I would like to put some text above each box describing what session it is, and that name should be easily added to the main Study settings.
Date Time Of Last Edit: 2021-03-30 21:02:04
[2021-03-30 21:10:28]
ForgivingComputers.com - Posts: 952
They are all named the same and study selection/settings window which is not resizable!
If you give the study a Short Name, then it will be visible and standout in the Studies to Graph window.
[2021-03-31 10:50:47]
RoadKill - Posts: 38
If you give the study a Short Name
Good point. Thank you.

I'll have to rename the most obnoxiously named studies to things like S1, S2, ... etc. Keep an internal record as what they do. Unfortunately that is only possible to the studies to which you have (or able to find) the source code. Maybe SC dev should look into this issue instead.
Date Time Of Last Edit: 2021-03-31 10:53:13
[2021-03-31 11:08:16]
User907968 - Posts: 821
Unfortunately that is only possible to the studies to which you have (or able to find) the source code.

??? Chart Studies: Settings and Inputs Tab >> Short Name
[2021-04-18 19:15:26]
RoadKill - Posts: 38
Aah, got you. Didn't realize that "Short Name" was a setting by itself.
[2021-07-28 14:47:03]
User279510 - Posts: 17
I am using this study to plot the first minute of trade. I have it drawing in the correct location. How do I manipulate the opacity? I changed the "Transparency Level for Fill Styles" to 1 and also to 98, but the rectangle color still appears to be solidly colored. Thanks.
[2021-07-29 13:52:17]
John - SC Support - Posts: 35639
If you are using one of the Fill Top/Bottom Draw Styles, then you will want to change those to a "Transparent" Fill Top/Bottom (such as "Transparent Fill Top" and "Transparent Fill Bottom"). Refer to the following:
Chart Studies: Notes about Top and Bottom Draw Style Pairs
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2023-01-28 14:13:50]
Stephanie G Kessel - Posts: 2
This study is perfect for intraday ranges, but what if you want a box around multiple days? Say, a box around the last 20 days of candles with the midline showing and the top and bottom different colors (a premium discount box). Is there a study that can accomplish this?
[2023-01-28 19:38:47]
Sawtooth - Posts: 4103
This study is perfect for intraday ranges, but what if you want a box around multiple days?
It could be done with the Spreadsheet Study study, using several formulas based on the High/Low For Time Period study.

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

Login

Login Page - Create Account