OPEN-SOURCE SCRIPT

Green/Red Candle Ratio - Ratiomizer V1.01

تم تحديثه
🔥 Green/Red Candle Ratio Indicator 🔥
📊 Track Market Momentum Instantly!

🚀 Welcome to the Green/Red Candle Ratio Indicator! 🚀

This script dynamically calculates the ratio of green (bullish) vs. red (bearish) candles in your visible chart area, giving you a quick overview of market sentiment.

🛠 About This Script
⚡ Created with the help of ChatGPT – This is an early draft and open-source for everyone to use and improve!
⚠️ Short timeframe users (1min, 5min, etc.) – Be aware that too many candles can sometimes cause issues with calculations.

🔗 If you improve on this idea or use it in your own project, I’d love a little credit! 💙

📺 Follow My Trading Journey!
🎥 Live Trading, Insights & Market Analysis:
📌 YouTube → YouTube.com/TheMysticMonkey09
📌 Kick → Kick.com/BeeZee09

🙌 Support the content and join an awesome trading community!

💡 How to Use This Indicator
1️⃣ Apply it to your chart
2️⃣ See the real-time green/red candle ratio
3️⃣ Zoom in/out to dynamically adjust the calculations
4️⃣ Use it as an extra confirmation tool for trend momentum

💬 Feedback & improvements are welcome! If you run into issues or have ideas to make this script better, let me know in the community!

🔥 Happy Trading & Stay Profitable! 🔥 🏆




//version=5
indicator("Green/Red Candle Ratio", overlay=true)

// Define the number of past bars to check (must be within TradingView limits)
maxBarsBack = math.min(500, bar_index) // Ensures we do not exceed available bars

// Initialize counters
greenCount = 0
redCount = 0
neutralCount = 0
totalBars = 0

// Loop through the last `maxBarsBack` bars
for i = 0 to maxBarsBack - 1
idx = bar_index - i
if idx >= 0
if close[idx] > open[idx]
greenCount := greenCount + 1
else if close[idx] < open[idx]
redCount := redCount + 1
else
neutralCount := neutralCount + 1

// Ensure only green + red candles contribute to the percentage calculation
validBars = greenCount + redCount

// Calculate ratios correctly so they always add up to 100%
greenRatio = validBars > 0 ? (greenCount / validBars) * 100 : na
redRatio = validBars > 0 ? (redCount / validBars) * 100 : na

// Create label text
labelText = "Green: " + str.tostring(greenRatio, "#.##") + "%\nRed: " + str.tostring(redRatio, "#.##")
labelColor = greenRatio > redRatio ? color.green : color.red

// Delete previous label before creating a new one
var label ratioLabel = na

if not na(ratioLabel)
label.delete(ratioLabel)

// Display only one label that updates dynamically
ratioLabel := label.new(bar_index, high, labelText, color=color.white, textcolor=labelColor, size=size.normal, style=label.style_label_down)




ملاحظات الأخبار
📢 Update Notes for V1.02 – Green/Red Candle Ratio Indicator 📢
🚀 Hey traders! I’ve made some updates to the script, and here’s what’s new in V1.02! 🚀

1️⃣ 🔄 Improved Candle Count:
I adjusted the max candles counted from 500 to 107. Why 107? Because it lined up perfectly with Bitcoin’s candle structure, making the ratio a little more accurate! 🎯

2️⃣ 📌 Customizable Candle Count:
Don’t forget—you can adjust this setting to find the right balance for your trading strategy! Play around with the number of candles and see what works best for you. 📊

3️⃣ 🔹 NEW Marker Feature:
A BIG purple line 📍 now drops on the 107th (or last counted) candle! This visually marks where the indicator stops averaging the green/red ratios, making it easier to track the measurement range.

🛠 Final Thoughts:
This update should make the indicator more precise and visually intuitive. If you find a different candle count that works better for you, feel free to tweak it! And as always, let me know if you have any feedback or improvements! 🔥

📈 Happy Trading & Stay Profitable! 🚀💰
beezee09candlecandlestickpatternChart patternscryptoMoving Averagesstatistics

نص برمجي مفتوح المصدر

قام مؤلف هذا النص البرمجي بنشره وجعله مفتوح المصدر، بحيث يمكن للمتداولين فهمه والتحقق منه، وهو الأمر الذي يدخل ضمن قيم TradingView. تحياتنا للمؤلف! يمكنك استخدامه مجانًا، ولكن إعادة استخدام هذا الرمز في المنشور يخضع لقواعد‎‎قوانين الموقع. يمكنك جعله مفضلاً لاستخدامه على الرسم البياني.

هل تريد استخدام هذا النص البرمجي على الرسم البياني؟

إخلاء المسؤولية