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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.