Login Page - Create Account

Support Board


Date/Time: Thu, 18 Apr 2024 06:09:50 +0000



[User Discussion] - color coding bars in different time frames

View Count: 934

[2021-05-08 19:28:02]
User945898 - Posts: 7
Dear SC support

Consider the time range highlight study which can highlight and color code a specific bar at a given time on an intraday chart e.g.. a midday bar on a one hour chart can be set to show all the bars at midday everyday on a one hour chart the same color and the bars at 1.00pm everyday the same color. so each one hour bar has a different color within a 24 hour period.

Is it possible to add to this same study, options, to highlight each daily bar a different color e.g.. every Monday of every week the same color and every Tuesday of every week the same color, so a different color bar for every day of the week which repeats every week, that being 5 colors in total if you count Sunday and Monday as same color on the daily chart.

The same options for weekly and monthly charts e.g.. highlight all the first weeks of every month the same color and all the second weeks of each month the same color etc...so a different color for each week of the month which repeats every month. this would be four or five different colors depending on how many weeks in the month.

Every January of each year the same color and every February of each year the same color that would make it 12 different colors in total in a year on the monthly time frame chart.
If there is already a study in sierra charts that can do this then i have not been able to find it. I hope the above makes sense?

thank you
zafar
[2021-05-08 21:30:33]
Sawtooth - Posts: 3973
You can use the Color Bar Based On Alert Condition study to do this.

To color Mon-Fri with 5 colors on an Historical Daily chart, add 5 instances of the color bar study.
Use a formula like this on each Alerts tab:
=WEEKDAY(BARDATE)=2
where 2 is Monday
https://www.sierrachart.com/index.php?page=doc/SpreadsheetFunctions.html#WEEKDAY_Function

To color the weeks of the month on an Historical Weekly chart, add the Spreadsheet Formula study, and 5 instances of the color bar study.
Use a formula like this in the Formula field of the Spreadsheet Formula study:
=IF(OR(MONTH(BARDATE)>MONTH(BARDATE[-1]),YEAR(BARDATE)>YEAR(BARDATE[-1])),1,ID1.SG1[-1]+1)
where the Spreadsheet Formula study is ID1.
This will number the weeks of the month of a Weekly chart.
Then use a formula like this on each Alerts tab of the color bar studies:
=ID1.SG1=1
where ID1 is the Spreadsheet Formula study, and 1 is the first week of the month of a Weekly chart.

To color Jan-Dec with 12 colors on an Historical Monthly chart, add 12 instances of the color bar study.
Use a formula like this on each Alerts tab:
=MONTH(BARDATE)=1
where 1 is January
https://www.sierrachart.com/index.php?page=doc/SpreadsheetFunctions.html#MONTH_Function

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

Login

Login Page - Create Account