本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
//@version=6
indicator("Qullamaggi Market Lights", overlay=true)
// --- Index Tickers ---
s_midsml = "NSE:NIFTYMIDSML400"
s_mid150 = "NSE:NIFTYMIDCAP150"
s_sml250 = "NSE:NIFTYSMLCAP250"
// --- Light Status Logic ---
getLight(ticker) =>
[c, e10, e10_prev, e20, e20_prev] = request.security(ticker, "1D", [close, ta.ema(close, 10), ta.ema(close, 10)[1], ta.ema(close, 20), ta.ema(close, 20)[1]], barmerge.gaps_off, barmerge.lookahead_off)
isGreen = (c > e10) and (e10 > e20) and (e10 >= e10_prev) and (e20 >= e20_prev)
isRed = (e10 < e20) and (c < e20)
isGreen ? #00c853 : (isRed ? #d50000 : #ffb300)
c400 = getLight(s_midsml)
c150 = getLight(s_mid150)
c250 = getLight(s_sml250)
// --- Master Decision Light ---
cMaster = (c400 == #00c853 and (c150 == #00c853 or c250 == #00c853)) ? #00c853 : ((c400 == #d50000 or (c150 == #d50000 and c250 == #d50000)) ? #d50000 : #ffb300)
// --- Minimal HUD (Plain Black Text, Transparent Background) ---
var table hud = table.new(position.top_right, 2, 4, bgcolor=color.new(color.white, 100), border_width=0)
if barstate.islast
// Nifty MidSmallcap 400
table.cell(hud, 0, 1, "MidSmall 400", text_color=color.black, text_size=size.normal, text_halign=text.align_left)
table.cell(hud, 1, 1, "●", text_color=c400, text_size=size.large, text_halign=text.align_center)
// Nifty Midcap 150
table.cell(hud, 0, 2, "Midcap 150", text_color=color.black, text_size=size.normal, text_halign=text.align_left)
table.cell(hud, 1, 2, "●", text_color=c150, text_size=size.large, text_halign=text.align_center)
// Nifty Smallcap 250
table.cell(hud, 0, 3, "Smallcap 250", text_color=color.black, text_size=size.normal, text_halign=text.align_left)
table.cell(hud, 1, 3, "●", text_color=c250, text_size=size.large, text_halign=text.align_center)