OPEN-SOURCE SCRIPT
Moving Averages Trend

Four independently configurable moving averages (type, length, source, color each) let you build the classic multi-MA trend stack in one indicator — a long-term filter to define the overall regime, an intermediate MA for the broader trend, and a fast pair for tactical entries on pullbacks within it. Used purely as an overlay, this is a continuation tool: you only take trades in the direction the slower MAs already agree on, using the faster pair to time entries once price pulls back into alignment.
The MA3/MA4 cross-signal layer is what sets this apart from a plain crossover system. Instead of waiting for the two faster MAs to physically cross — which is already stale information by the time it happens — it takes each MA's recent slope and projects it forward by a configurable number of bars, firing the buy/sell label as soon as that projected path crosses rather than the actual one, giving you a signal a few bars earlier than a textbook crossover. A minimum-separation filter (scaled to ATR) throws out weak "touch and go" near-misses, and the signal only fires when price is already sitting on the correct side of both MAs and each MA is still actively moving in that direction on the current bar — all of which is meant to filter out low-conviction crosses in choppy conditions. An optional daily+-only restriction keeps the signal from firing on intraday noise for traders who only want to act on it at swing timeframes.
Best applied in trending or newly-trending markets, as a combined trend filter (from the 4 plotted MAs) and tactical entry trigger (from the cross signal) rather than as a mean-reversion tool — it has little to offer in a flat, range-bound market since the slope and separation conditions are designed specifically to avoid firing in that environment.
The MA3/MA4 cross-signal layer is what sets this apart from a plain crossover system. Instead of waiting for the two faster MAs to physically cross — which is already stale information by the time it happens — it takes each MA's recent slope and projects it forward by a configurable number of bars, firing the buy/sell label as soon as that projected path crosses rather than the actual one, giving you a signal a few bars earlier than a textbook crossover. A minimum-separation filter (scaled to ATR) throws out weak "touch and go" near-misses, and the signal only fires when price is already sitting on the correct side of both MAs and each MA is still actively moving in that direction on the current bar — all of which is meant to filter out low-conviction crosses in choppy conditions. An optional daily+-only restriction keeps the signal from firing on intraday noise for traders who only want to act on it at swing timeframes.
Best applied in trending or newly-trending markets, as a combined trend filter (from the 4 plotted MAs) and tactical entry trigger (from the cross signal) rather than as a mean-reversion tool — it has little to offer in a flat, range-bound market since the slope and separation conditions are designed specifically to avoid firing in that environment.
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน