Login Page - Create Account

Support Board


Date/Time: Fri, 03 May 2024 18:33:08 +0000



High and Low for first trading day of the month.

View Count: 546

[2022-11-28 17:57:23]
Alex Q - Posts: 83
Hey yallz -

I'm looking to do something relatively simple in concept, but I'm not sure there's a study for it. I'd like to automate the high and low for the first trading day of the month for each month. Is there any way to do this quickly/cleanly?
[2022-11-28 23:58:14]
John - SC Support - Posts: 31355
You would have to use the Spreadsheet Study for this and use the DAY() function to get the first day of the month. Refer to the following:
https://www.sierrachart.com/index.php?page=doc/SpreadsheetFunctions.html#DAY_Function

You would also need to use the High/Low for Time Period or one of the other options that gives the High and Low for a day. Refer to the following:
High/Low for Time Period
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2022-11-29 21:17:44]
Alex Q - Posts: 83
John, as always, thank you for your reply. Do you have any recommended reading in regards to how I make those two things work together?
[2022-11-30 16:53:08]
John - SC Support - Posts: 31355
To get you started here is what you do:
- Add the High/Low for Time Period to your chart and set the times to cover the day as you want it defined. Set this study to be "hidden".
- Add the Spreadsheet Study to your chart and set it for Region 1 and in cell K3 enter the following:
=IF(DAY(A3) = 1, ID1.SG1@3, 0)

Where ID1 is the ID of the High/Low for Time Period study and SG1@3 specifies the High subgraph information at the 3rd row.

- If you want the line to display across the full month, then enter the following in the L3 cell:
=MOSTRECENTNONZEROVALUE(K3:K2000)

Where the range of K3:K2000 will need to change depending on the range of the data that you are displaying in the Spreadsheet study.

You will then want to set the subgraph for the K column to Ignore so you will have the L column displayed.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2022-11-30 17:29:08]
Alex Q - Posts: 83
Excellent! I appreciate your help. I've got it to work.

I'm curious if there is a way to extend the high/low for the first trading day of each month, going back a specified number of months. Currently I look back about 4 months, and manually draw in the high/low for first trading day of each month and extend it all the way to the right. You can see the automation in pink/orange, and my manually drawings in light blue shaded rectangles. I've also noticed that it has skipped October for some reason?

Anyway, I've attached an image to show what I mean. It may be too complicated, or simply not possible. But If you have any insight it'd be greatly appreciated.
Attachment Deleted.
imageESZ22 [CBV][M] 390 Min #12 2022-11-30 09_22_37.693.png / V - Attached On 2022-11-30 17:25:12 UTC - Size: 22.9 KB - 64 views
[2022-11-30 23:45:20]
John - SC Support - Posts: 31355
You could use the Study Subgraph Reference to create another copy of the data and then set the Draw Style to Line at last Bar Left to Right. You would have to add this study for each line per month. And then you would need to use the Displacement option to get the previous months data. Refer to the following:
Study Subgraph Reference

Chart Studies: Line at Last Bar Left to Right (ACSIL: DRAWSTYLE_LINE_AT_LAST_BAR_LEFT_TO_RIGHT)

Chart Studies: Subgraphs Tab >> Displacement
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2022-12-01 06:40:17]
Alex Q - Posts: 83
It never ceases to amaze me just how flexible this platform is. Always incredibly informative and instructive responses from you, sir.

LAST QUESTION (maybe):

When I use "=IF(DAY(A3) = 1, ID1.SG1@3, 0", it returns the data for the 1st calendar day of the month. However, the first calendar day of the month isn't always the first trading day of the month.

I am trying to create a study that illustrates the monthly opening range; I define this as the cash session high and low of the first trading day of the month.

In the image I've attached you can see that the month of October has been skipped due to the first trading day being on 10/4.
imageESZ22 [CBV][M] 390 Min #12 2022-11-30 22_34_17.887.png / V - Attached On 2022-12-01 06:34:52 UTC - Size: 70.69 KB - 61 views
[2022-12-01 16:35:51]
John - SC Support - Posts: 31355
Unfortunately, we can not think of a solution to this particular problem.

There is a user named TomGilb that monitors this forum and he is an expert in the Sierra Chart Spreadsheets. Hopefully he will see this and give an answer if it can be done.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2022-12-01 16:52:37]
Alex Q - Posts: 83
No worries. Thank you for your help!
[2022-12-01 20:58:30]
Sawtooth - Posts: 3992
This returns the first Business day of the month:
=WORKDAY(EOMONTH(A3,-1), 1)
Not sure if it will always match the first trading day.

I think this example could be modified to do what you want:
Opening 30min range for every month
See post #5.

If you need more help, post again.
[2022-12-01 22:26:51]
Alex Q - Posts: 83
Wow, tremendous work! Thank you Tomgilb!

I was able to use your formulas, and then add the "highlight High/low for time period - extended study" to do exactly what I was looking for. Thank you very much! Last question to complete this study: I've used "transparent fill rectangle top/bottom" to shade the monthly opening ranges. Is there any way to extend each rectangle to the end of the chart?

I've included an image for reference.
imageESZ22 [CBV][M] 390 Min #11 2022-12-01 14_22_42.471.png / V - Attached On 2022-12-01 22:24:06 UTC - Size: 23.27 KB - 69 views
[2022-12-01 23:07:40]
Sawtooth - Posts: 3992
Is there any way to extend each rectangle to the end of the chart?
It is not possible to extend to the chart's right edge with spreadsheet studies.

Also, spreadsheet studies are limited if you want to extend more than one rectangle to the current bar.
You would need a pair of Formula Columns for each rectangle, and only the most recent ones would be displayed, older ones would vanish.

It is even more limited and complicated to extend until future intersection.
Date Time Of Last Edit: 2022-12-01 23:23:01
[2022-12-16 21:44:25]
Sawtooth - Posts: 3992
Is there any way to extend each rectangle to the end of the chart?
Update, a workaround:
You could use two Color Bar Based On Alert Condition studies to extend H and L lines,
Then use the Study Subgraphs Reference study to shade between them.

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

Login

Login Page - Create Account