DYO: Color bars 'Half hour by half hour'


Q:  Could you write a DYO that colors candles based on each half hour period?   So each subsequent half hour period has a different color? ( cfr. hour by hour feature under color bars).   I would use this feature to easily differentiate between each half hour bracket on my 15 min charts.

A:

Template:  1309-30MinColorBars

Line A gets the bar's time stamp in the form of minutes from midnight, and divides that by 30, which is the period size.  

Lines B and C convert this period into a number in the set [0,1,2,3] which repeats.   The bars are colored based on the sequence number they have from the set of 4 possibilities.

Template:  1309-30MinColorBars

Last modified 1/17/08 5:19 PM