Support Board
Date/Time: Fri, 07 Feb 2025 15:18:13 +0000
Post From: color coding bars in different time frames
[2021-05-08 21:30:33] |
Sawtooth - Posts: 4173 |
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 |