Hello All,
I'm fairly new to pine script programming. I can't get my head around he script below. What i want is a loop where in that loop there's a check if the tickers pass the custom function. Don't know if i say it correctly, maybe the code will help. Eventually there's a label on the chart that contains only those tickers that pass the customFuncW()
========================
s20ema = ema(close, 20)
s50sma = sma(close, 50)
s200sma = sma(close, 200)
scr_label = 'Screener: \n##########\n'
ticker_s1 = 'ADAUSDT'
ticker_s2 = 'ADXBTC'
ticker_s3 = 'AEBTC'
ticker_s4 = 'AGIBTC'
ticker_s5 = 'AIONBTC'
ha_period = W
// Chart on which Master Direction is based
ha_open = security(heikinashi(ticker_s1), ha_period, open)
ha_close = security(heikinashi(ticker_s1), ha_period, close)
//ha open and close should't use ticker_s1 but the ticker thats next in the loop...??
customFuncW() => (s20ema > s50sma) and (s50sma > s200sma) and (ha_close < ha_open)
s1 = security(ticker_s1, 'W', customFuncW())
s2 = security('ADXBTC', 'W', customFuncW())
s3 = security('AEBTC', 'W', customFuncW())
s4 = security('AGIBTC', 'W', customFuncW())
s5 = security('AIONBTC', 'W', customFuncW())
s = 1
for i = 0 to 5
s := s + 1
scr_label := s[i] ? scr_label + ticker_s[i] + '\n' : scr_label
//this loop doesn't work
lab_l = label.new(
bar_index, -0.2, scr_label,
color=color.gray,
textcolor=color.black,
style = label.style_labeldown,
yloc = yloc.price)
label.delete(lab_l[1])
plot(0, transp = 100)
=================
Anyone an idea???