OPEN-SOURCE SCRIPT
SMA 20/50/200 Strategy with TP/SL

Here is a TradingView Pine Script indicator for the 20/50/200 SMA strategy. It generates Buy/Sell Signals and calculates Take Profit and Stop Loss prices for each signal.
Features:
Triggers only on the cross over/cross under bar (not continuous).
Buy: 20 SMA crosses above 50 SMA and is above 200 SMA.
Sell: 20 SMA crosses below 50 SMA and is below 200 SMA.
Plots take profit and stop loss.
Alerts repeat every cross over/cross under occurrence.
Features:
Triggers only on the cross over/cross under bar (not continuous).
Buy: 20 SMA crosses above 50 SMA and is above 200 SMA.
Sell: 20 SMA crosses below 50 SMA and is below 200 SMA.
Plots take profit and stop loss.
Alerts repeat every cross over/cross under occurrence.
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.