Open SubhaBasu1979 opened 8 months ago
//@version=5 indicator("TR < ATR Color Change", overlay=true)
// Calculate True Range (TR) tr = math.abs(high - low) tr += math.max(math.abs(high - close), math.abs(low - close))
// Calculate Average True Range (ATR) atr = math.avg(tr, 14) // Adjust the period as needed
// Define coloring condition color = if tr < atr color.blue else color.maroon
// Plot the candles with coloring plotcandle(close, high, low, open, color=color, wickcolor=color)
Ask your question in Pinescript Telegram channel. They will help you.
//@version=5 indicator("TR < ATR Color Change", overlay=true)
// Calculate True Range (TR) tr = math.abs(high - low) tr += math.max(math.abs(high - close), math.abs(low - close))
// Calculate Average True Range (ATR) atr = math.avg(tr, 14) // Adjust the period as needed
// Define coloring condition color = if tr < atr color.blue else color.maroon
// Plot the candles with coloring plotcandle(close, high, low, open, color=color, wickcolor=color)