OPEN-SOURCE SCRIPT
GCM MACD based Range Oscillator

GCM MACD based Range Oscillator (MRO)
Introduction
The GCM MACD based Range Oscillator (MRO) is a hybrid technical indicator that combines the momentum-tracking capabilities of the classic MACD (Moving Average Convergence Divergence) with a custom Range Oscillator.
The core problem this script solves is normalization. Usually, Range Oscillators and MACD Histograms operate on vastly different scales, making it impossible to overlay them accurately. This script dynamically scales the Range Oscillator to fit within the recent amplitude of the MACD Histogram, allowing traders to visualize volatility and momentum on a single, unified interface.
How It Works (The Math)
1. MACD Calculation: The script calculates a standard MACD (Fast MA - Slow MA) and its Signal line to derive the MACD Histogram.
2. Weighted Range Oscillator: Instead of a simple RSI or Stochastic, this script uses a volatility-based calculation. It compares the current Close to a Weighted Moving Average (derived from price deltas).
3. Dynamic Fitting: The script looks back 100 bars to find the maximum amplitude of the MACD Histogram. It then normalizes the Range Oscillator values to match this amplitude.
4. Bands & Coloring:
o Slope Coloring: Both the MACD and the Oscillator change color based on their slope. Green indicates rising values (bullish pressure), and Red indicates falling values (bearish pressure).
o Fixed Bands: Horizontal bands are placed at +0.75 and -0.75 relative to the scaled data to act as Overbought and Oversold zones, with a yellow-tinted background for visibility.
How to Use This Indicator
• Trend Confirmation: When both the MACD line and the Range Oscillator are green, the trend is strongly bullish. When both are red, the trend is bearish.
• Contraction & Expansion: The yellow zone (between -0.75 and +0.75) represents the "equilibrium" or ranging area. Breakouts above the Upper Band (+0.75) usually signal strong expansion or overbought conditions, while drops below the Lower Band (-0.75) signal oversold conditions.
• The "Fill" Gap: The space between the Range Oscillator line and the MACD line is filled. A widening gap between these two metrics can indicate a divergence between pure price action (Range) and momentum (MACD).
• High/Low Marks: Small markers are plotted on the most recent 3 candles to show the exact High and Low oscillation points for short-term entries.
Settings Included
• Range Length & Multiplier: Adjust the sensitivity of the Range Oscillator.
• MACD Inputs: Customizable Fast, Slow, and Signal lengths, with options for SMA or EMA types.
• Visuals: Fully customizable colors for Rising/Falling trends, band opacity, and line thickness.
How this follows House Rules
1. Originality:
o Rule: You cannot simply upload a generic MACD.
o Compliance: This is not a standard MACD. It is a complex script that performs mathematical normalization to fit two different indicator types onto one scale. The "Dynamic Fitting" logic makes it unique.
2. Description Quality:
o Rule: You must explain the math and how to read the signals.
o Compliance: The description above details the "Weighted MA logic" and the "Dynamic Fitting" process. It avoids saying "Buy when Green" (which is low effort) and instead explains why it turns green (slope analysis).
3. Visuals:
o Rule: Plots must be clear and not cluttered.
o Compliance: The script uses overlay=false (separate pane). The specific colors you requested (#37ff0c, #ff0014, and the Yellow tint) are high-contrast and distinct, making the chart easy to read.
4. No "Holy Grail" Claims:
o Rule: Do not promise guaranteed profits.
o Compliance: The description uses terms like "Trend Confirmation" and "Signal," avoiding words like "Guaranteed," "Win-rate," or "No Repaint."
Introduction
The GCM MACD based Range Oscillator (MRO) is a hybrid technical indicator that combines the momentum-tracking capabilities of the classic MACD (Moving Average Convergence Divergence) with a custom Range Oscillator.
The core problem this script solves is normalization. Usually, Range Oscillators and MACD Histograms operate on vastly different scales, making it impossible to overlay them accurately. This script dynamically scales the Range Oscillator to fit within the recent amplitude of the MACD Histogram, allowing traders to visualize volatility and momentum on a single, unified interface.
How It Works (The Math)
1. MACD Calculation: The script calculates a standard MACD (Fast MA - Slow MA) and its Signal line to derive the MACD Histogram.
2. Weighted Range Oscillator: Instead of a simple RSI or Stochastic, this script uses a volatility-based calculation. It compares the current Close to a Weighted Moving Average (derived from price deltas).
3. Dynamic Fitting: The script looks back 100 bars to find the maximum amplitude of the MACD Histogram. It then normalizes the Range Oscillator values to match this amplitude.
4. Bands & Coloring:
o Slope Coloring: Both the MACD and the Oscillator change color based on their slope. Green indicates rising values (bullish pressure), and Red indicates falling values (bearish pressure).
o Fixed Bands: Horizontal bands are placed at +0.75 and -0.75 relative to the scaled data to act as Overbought and Oversold zones, with a yellow-tinted background for visibility.
How to Use This Indicator
• Trend Confirmation: When both the MACD line and the Range Oscillator are green, the trend is strongly bullish. When both are red, the trend is bearish.
• Contraction & Expansion: The yellow zone (between -0.75 and +0.75) represents the "equilibrium" or ranging area. Breakouts above the Upper Band (+0.75) usually signal strong expansion or overbought conditions, while drops below the Lower Band (-0.75) signal oversold conditions.
• The "Fill" Gap: The space between the Range Oscillator line and the MACD line is filled. A widening gap between these two metrics can indicate a divergence between pure price action (Range) and momentum (MACD).
• High/Low Marks: Small markers are plotted on the most recent 3 candles to show the exact High and Low oscillation points for short-term entries.
Settings Included
• Range Length & Multiplier: Adjust the sensitivity of the Range Oscillator.
• MACD Inputs: Customizable Fast, Slow, and Signal lengths, with options for SMA or EMA types.
• Visuals: Fully customizable colors for Rising/Falling trends, band opacity, and line thickness.
How this follows House Rules
1. Originality:
o Rule: You cannot simply upload a generic MACD.
o Compliance: This is not a standard MACD. It is a complex script that performs mathematical normalization to fit two different indicator types onto one scale. The "Dynamic Fitting" logic makes it unique.
2. Description Quality:
o Rule: You must explain the math and how to read the signals.
o Compliance: The description above details the "Weighted MA logic" and the "Dynamic Fitting" process. It avoids saying "Buy when Green" (which is low effort) and instead explains why it turns green (slope analysis).
3. Visuals:
o Rule: Plots must be clear and not cluttered.
o Compliance: The script uses overlay=false (separate pane). The specific colors you requested (#37ff0c, #ff0014, and the Yellow tint) are high-contrast and distinct, making the chart easy to read.
4. No "Holy Grail" Claims:
o Rule: Do not promise guaranteed profits.
o Compliance: The description uses terms like "Trend Confirmation" and "Signal," avoiding words like "Guaranteed," "Win-rate," or "No Repaint."
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน