f_push_data(V1, t1 , sym1col , C1 , 0 ), f_push_data(V11, t11 , sym11col, C11, 10), f_push_data(V21, t21 , sym21col, C21, 20)
f_push_data(V2, t2 , sym2col , C2 , 1 ), f_push_data(V12, t12 , sym12col, C12, 11), f_push_data(V22, t22 , sym22col, C22, 21)
f_push_data(V3, t3 , sym3col , C3 , 2 ), f_push_data(V13, t13 , sym13col, C13, 12), f_push_data(V23, t23 , sym23col, C23, 22)
f_push_data(V4, t4 , sym4col , C4 , 3 ), f_push_data(V14, t14 , sym14col, C14, 13), f_push_data(V24, t24 , sym24col, C24, 23)
f_push_data(V5, t5 , sym5col , C5 , 4 ), f_push_data(V15, t15 , sym15col, C15, 14), f_push_data(V25, t25 , sym25col, C25, 24)
f_push_data(V6, t6 , sym6col , C6 , 5 ), f_push_data(V16, t16 , sym16col, C16, 15), f_push_data(V26, t26 , sym26col, C26, 25)
f_push_data(V7, t7 , sym7col , C7 , 6 ), f_push_data(V17, t17 , sym17col, C17, 16), f_push_data(V27, t27 , sym27col, C27, 26)
f_push_data(V8, t8 , sym8col , C8 , 7 ), f_push_data(V18, t18 , sym18col, C18, 17), f_push_data(V28, t28 , sym28col, C28, 27)
f_push_data(V9, t9 , sym9col , C9 , 8 ), f_push_data(V19, t19 , sym19col, C19, 18), f_push_data(V29, t29 , sym29col, C29, 28)
f_push_data(V10, t10 , sym10col, C10, 9 ), f_push_data(V20, t20 , sym20col, C20, 19), f_push_data(V30, t30 , sym30col, C30, 29)
// Calculating group mean
mean = meantype=='First Ticker' ? V1 : array.avg(database)
// Function for calculating correlation
f_corr(v) =>
m = ta.change(mean)
val = ta.change(v)
math.round(ta.correlation(val, m, clen), 2)
// Function for calculating beta
f_beta(v) =>
m_std = ta.stdev(ta.change(mean), clen)
val_std = ta.stdev(ta.change(v), clen)
corr = f_corr(v)
beta = corr * (val_std / m_std)
math.round(beta, 2)
// Function of calculating RSI
f_rsi(v) =>
rsi = ta.rsi(v, rsilen)
math.round(rsi, 0)
// Calculating correlation and pushing the correlation values into an array
if show_corr and showtable
array.set(corrs, 0, f_corr(V1 )), array.set(corrs, 10, f_corr(V11)), array.set(corrs, 20, f_corr(V21))
array.set(corrs, 1, f_corr(V2 )), array.set(corrs, 11, f_corr(V12)), array.set(corrs, 21, f_corr(V22))
array.set(corrs, 2, f_corr(V3 )), array.set(corrs, 12, f_corr(V13)), array.set(corrs, 22, f_corr(V23))
array.set(corrs, 3, f_corr(V4 )), array.set(corrs, 13, f_corr(V14)), array.set(corrs, 23, f_corr(V24))
array.set(corrs, 4, f_corr(V5 )), array.set(corrs, 14, f_corr(V15)), array.set(corrs, 24, f_corr(V25))
array.set(corrs, 5, f_corr(V6 )), array.set(corrs, 15, f_corr(V16)), array.set(corrs, 25, f_corr(V26))
array.set(corrs, 6, f_corr(V7 )), array.set(corrs, 16, f_corr(V17)), array.set(corrs, 26, f_corr(V27))
array.set(corrs, 7, f_corr(V8 )), array.set(corrs, 17, f_corr(V18)), array.set(corrs, 27, f_corr(V28))
array.set(corrs, 8, f_corr(V9 )), array.set(corrs, 18, f_corr(V19)), array.set(corrs, 28, f_corr(V29))
array.set(corrs, 9, f_corr(V10)), array.set(corrs, 19, f_corr(V20)), array.set(corrs, 29, f_corr(V30))
// Calculating beta and pushing the beta values into an array
if show_beta and showtable
array.set(betas, 0, f_beta(V1 )), array.set(betas, 10, f_beta(V11)), array.set(betas, 20, f_beta(V21))
array.set(betas, 1, f_beta(V2 )), array.set(betas, 11, f_beta(V12)), array.set(betas, 21, f_beta(V22))
array.set(betas, 2, f_beta(V3 )), array.set(betas, 12, f_beta(V13)), array.set(betas, 22, f_beta(V23))
array.set(betas, 3, f_beta(V4 )), array.set(betas, 13, f_beta(V14)), array.set(betas, 23, f_beta(V24))
array.set(betas, 4, f_beta(V5 )), array.set(betas, 14, f_beta(V15)), array.set(betas, 24, f_beta(V25))
array.set(betas, 5, f_beta(V6 )), array.set(betas, 15, f_beta(V16)), array.set(betas, 25, f_beta(V26))
array.set(betas, 6, f_beta(V7 )), array.set(betas, 16, f_beta(V17)), array.set(betas, 26, f_beta(V27))