samco-sdk / Python-SDK

Official Python SDK for accessing Stocknote API
MIT License
16 stars 11 forks source link

0 I want to develop a Trading View Indicator in which the Candle turns Blue if TR<ATR. I tried the below code but no result. #25

Open SubhaBasu1979 opened 8 months ago

SubhaBasu1979 commented 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)

jagatsingh commented 8 months ago

Ask your question in Pinescript Telegram channel. They will help you.