Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
2.3 kB
2
Indexable
Never
//@version=5
indicator("Stock&Index", overlay = true)

t = ticker.new(syminfo.prefix, syminfo.ticker, session = syminfo.session, adjustment = adjustment.dividends)

// Stocks

weeklyWMA9 = ta.wma(close, 9)
weeklyWMA15 = ta.wma(close, 15)
weeklyKijunSen = math.avg(ta.lowest(26), ta.highest(26))

wWMA9 = request.security(t, "W", weeklyWMA9)
wWMA15 = request.security(t, "W", weeklyWMA15)
wKijunSen = request.security(t, "W", weeklyKijunSen)

plot(wWMA9, title = "Stock-First", color = color(color.green), offset = 0, style = plot.style_line, linewidth = 2, display = display.none, precision = 2)
plot(wWMA15, title = "Stock-Second", color = color(color.orange), offset = 0, style = plot.style_line, linewidth = 2, display = display.none, precision = 2)
plot(wKijunSen[1], title = "Stock-Third", color = color(color.purple), offset = 0, style = plot.style_line, linewidth = 2, display = display.none, precision = 2)

plot(wWMA9[1]*1.15, title = "X", color = color(color.red), offset = 0, style = plot.style_circles, linewidth = 2, display = display.none, precision = 2)
plot(wWMA9[1]*1.3, title = "XX", color = color(color.red), offset = 0, style = plot.style_stepline, linewidth = 2, display = display.none, precision = 2)
plot(wWMA9[1]*1.4, title = "XXX", color = color(color.red), offset = 0, style = plot.style_stepline, linewidth = 2, display = display.none, precision = 2)
plot(wWMA9[1]*1.5, title = "XXXX", color = color(color.red), offset = 0, style = plot.style_stepline, linewidth = 2, display = display.none, precision = 2)

// Index

fourHoursEMA8 = ta.ema(close, 8)
dailyEMA8 = ta.ema(close[1], 8) // previous day EMA8
fourHoursEMA55 = ta.ema(close, 55)

fEMA8 = request.security(t, "240", fourHoursEMA8)
dEMA8 = request.security(t, "D", dailyEMA8)
fEMA55 = request.security(t, "240", fourHoursEMA55)

plot(fEMA8, title = "Index-First", color = color(color.green), offset = 0, style = plot.style_line, linewidth = 2, display = display.none, precision = 2)
plot(dEMA8, title = "Index-Second", color = color(color.purple), offset = 0, style = plot.style_line, linewidth = 2, display = display.none, precision = 2)
plot(fEMA55, title = "Index-Third", color = color(color.white), offset = 0, style = plot.style_line, linewidth = 2, display = display.none, precision = 2)
Leave a Comment