OPEN-SOURCE SCRIPT

Trend Showing SMA (10D, 21D, 30W, 50D)

90
//version=6
indicator("Trend Showing SMA (10D, 21D, 10W, 30W, 50D)", overlay=true)

// Define Moving Average Periods
sma10d_length = 10
sma21d_length = 21
sma30w_length = 30
sma50d_length = 50

// Calculate Daily SMAs
sma10d = ta.sma(close, sma10d_length) // 10-day SMA
sma21d = ta.sma(close, sma21d_length) // 21-day SMA
sma50d = ta.sma(close, sma50d_length) // 50-day SMA

// Calculate Weekly SMAs (Using Weekly Data)
sma30w = request.security(syminfo.tickerid, 'W', ta.sma(close, sma30w_length)) // 30-week SMA

// Plot the Moving Averages
plot(sma10d, linewidth=2, color=color.blue, title="10-Day SMA")
plot(sma21d, linewidth=2, color=color.white, title="21-Day SMA")
plot(sma50d, linewidth=1, color=color.orange, title="50-Day SMA")
plot(sma30w, linewidth=2, color=color.green, title="30-Week SMA")

כתב ויתור

המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.