OPEN-SOURCE SCRIPT
HalfTrend Strategy Basic

This strategy is part of our blog series titled “How to Convert a TradingView Indicator into an Algo Strategy”, where we break down popular indicators and turn them into fully functional, backtestable strategies.
📝 Read the full article here
--
🔍 What This Strategy Does
This script implements the HalfTrend indicator by everget as a TradingView strategy. It detects potential trend reversals based on recent price extremes and moving averages.
Buy when trend shifts up:
Sell when trend shifts down:
⚙️ Optional Filters Included
You can toggle confirmation filters from the settings panel:
These help reduce false signals in sideways markets.
📝 Read the full article here
--
🔍 What This Strategy Does
This script implements the HalfTrend indicator by everget as a TradingView strategy. It detects potential trend reversals based on recent price extremes and moving averages.
Buy when trend shifts up:
- SMA of lows rises above the highest high
- Close is above the previous high
Sell when trend shifts down:
- SMA of highs drops below the lowest low
- Close is below the previous low
⚙️ Optional Filters Included
You can toggle confirmation filters from the settings panel:
- ✅ 200 EMA (trend context)
- ✅ ADX (trend strength and momentum slope)
- ✅ MACD crossover (momentum confirmation)
- ✅ RSI above/below 50 (bias check)
These help reduce false signals in sideways markets.
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน