OPEN-SOURCE SCRIPT
Hao_Gann Swing

This indicator is a custom dynamic swing structure tool built entirely on price action.
Key features:
• No use of candle color, indicators, or fixed fractals
• Swing detection is based only on High/Low relationships between candles
• Inside bars (fully contained candles) are ignored to reduce noise
Structure logic:
• In an uptrend:
- Higher highs extend the current swing high
- A downside break creates a new swing low
- If a strong outside bar breaks both sides and also breaks the previous swing low:
→ the current swing high is shifted to the new candle
→ a new swing low is formed immediately
• In a downtrend:
- Lower lows extend the current swing low
- An upside break creates a new swing high
- If a strong outside bar breaks both sides and also breaks the previous swing high:
→ the current swing low is shifted to the new candle
→ a new swing high is formed immediately
Additional behavior:
• Outside bars do NOT automatically create reversals
• Swings are updated (shifted) instead of duplicated
• The structure remains continuous and smooth (no broken lines)
This approach closely mimics how experienced traders manually interpret market structure, making it suitable for price action analysis and advanced strategy development.
Key features:
• No use of candle color, indicators, or fixed fractals
• Swing detection is based only on High/Low relationships between candles
• Inside bars (fully contained candles) are ignored to reduce noise
Structure logic:
• In an uptrend:
- Higher highs extend the current swing high
- A downside break creates a new swing low
- If a strong outside bar breaks both sides and also breaks the previous swing low:
→ the current swing high is shifted to the new candle
→ a new swing low is formed immediately
• In a downtrend:
- Lower lows extend the current swing low
- An upside break creates a new swing high
- If a strong outside bar breaks both sides and also breaks the previous swing high:
→ the current swing low is shifted to the new candle
→ a new swing high is formed immediately
Additional behavior:
• Outside bars do NOT automatically create reversals
• Swings are updated (shifted) instead of duplicated
• The structure remains continuous and smooth (no broken lines)
This approach closely mimics how experienced traders manually interpret market structure, making it suitable for price action analysis and advanced strategy development.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.