OPEN-SOURCE SCRIPT
Moving Average 250-day Strategy

This indicator creates buy/sell signals based on the daily close crossing over its 250-day Simple Moving Average (as green/red vertical bars). The signals are locked on the daily timeframe.
There is also a counter implemented indicating the number of trades/crossovers present in the current chart (marked in yellow).
There have been papers suggesting trading around the Moving Average can greatly increase the portolio's risk metrics, e.g. "Leverage for the Long Run - A Systematic Approach to Managing Risk and Magnifying Returns in Stocks" (Michael A. Gayed).
This script provides the ability to help you create such a trend-following strategy.
Best used on a broad index like the S&P 500, the strategy should go long when the the daily close crosses above the 250-day SMA and orders are closed when the 250-day SMA crosses below the daily close. This simple indicator does not take into account any other stop loss or take profit money management logic.
Thanks.
There is also a counter implemented indicating the number of trades/crossovers present in the current chart (marked in yellow).
There have been papers suggesting trading around the Moving Average can greatly increase the portolio's risk metrics, e.g. "Leverage for the Long Run - A Systematic Approach to Managing Risk and Magnifying Returns in Stocks" (Michael A. Gayed).
This script provides the ability to help you create such a trend-following strategy.
Best used on a broad index like the S&P 500, the strategy should go long when the the daily close crosses above the 250-day SMA and orders are closed when the 250-day SMA crosses below the daily close. This simple indicator does not take into account any other stop loss or take profit money management logic.
Thanks.
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้มันเป็นโอเพ่นซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันการทำงานของสคริปต์ได้ ขอแสดงความชื่นชมผู้เขียน! แม้ว่าคุณจะสามารถใช้งานได้ฟรี แต่อย่าลืมว่าการเผยแพร่โค้ดซ้ำนั้นจะต้องเป็นไปตามกฎระเบียบการใช้งานของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้มันเป็นโอเพ่นซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันการทำงานของสคริปต์ได้ ขอแสดงความชื่นชมผู้เขียน! แม้ว่าคุณจะสามารถใช้งานได้ฟรี แต่อย่าลืมว่าการเผยแพร่โค้ดซ้ำนั้นจะต้องเป็นไปตามกฎระเบียบการใช้งานของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน