Skip to Main Content

Color Inside Bars Differently

This example demonstrates how to change the colors of candles or price bars based on the properties of the market at this time. Here we highlight inside bars in yellow.

Color Inside Bars Differently
describe_indicator('Inside Bar Colored');
const prevHigh = shift(high, 1);
const prevLow = shift(low, 1);
const colors = for_every(high, low, prevHigh, prevLow, (h, l, prevH, prevL) => {
	const isInsideBar = h <= prevH && l >= prevL;
	return isInsideBar
		? '#2387e4'
		: null;