Search
Products
Community
Markets
News
Brokers
More
IN
Get started
Bitcoin
Oct 18, 2024
Doge
3
Grab this chart
Grab this chart
//
version
=5
indicator("Simple Moving Average Strategy", overlay=true)
// Set the length for moving averages
short_ma_length = 9
long_ma_length = 21
// Calculate moving averages
short_ma = ta.sma(close, short_ma_length)
long_ma = ta.sma(close, long_ma_length)
// Plot the moving averages
plot(short_ma, color=color.blue, title="Short MA (9)")
plot(long_ma, color=color.red, title="Long MA (21)")
// Buy and Sell signals
buy_signal = ta.crossover(short_ma, long_ma)
sell_signal = ta.crossunder(short_ma, long_ma)
// Plot buy/sell signals on the chart
plotshape(buy_signal, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(sell_signal, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
nuttapard
Follow
Technical Indicators
Trend Analysis
Wave Analysis
nuttapard
Follow
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
.