ml_portfolio Signal diversification & redundancy audit

Turns “I have 180 indicators” into “which of them actually add anything.” Convert each signal to its own return STREAM, correlate the streams, and grade how redundant vs complementary a set is — so you weight the diversifiers and prune the duplicates.
Design (host-fed): pairwise correlation needs two full series with history, so the host computes each pair’s rollingCorr and collects them into an array; this library standardizes the return-stream construction, the pair test, and the set-level diversification grade. Pure functions of what you pass; nothing repaints.
Concept credit: return-stream correlation and diversification grading are standard portfolio-construction ideas — original, dependency-free Pine v6 packaging. Educational; not financial advice.
Library "ml_portfolio"
signalReturn(longSig, shortSig, ret)
Parameters:
longSig (bool)
shortSig (bool)
ret (float)
rollingCorr(a, b, len)
Parameters:
a (float)
b (float)
len (simple int)
redundantPair(a, b, len, thr)
Parameters:
a (float)
b (float)
len (simple int)
thr (simple float)
avgAbsCorr(corrs)
Parameters:
corrs (array<float>)
diversificationScore(corrs)
Parameters:
corrs (array<float>)
Design (host-fed): pairwise correlation needs two full series with history, so the host computes each pair’s rollingCorr and collects them into an array; this library standardizes the return-stream construction, the pair test, and the set-level diversification grade. Pure functions of what you pass; nothing repaints.
Concept credit: return-stream correlation and diversification grading are standard portfolio-construction ideas — original, dependency-free Pine v6 packaging. Educational; not financial advice.
Library "ml_portfolio"
signalReturn(longSig, shortSig, ret)
Parameters:
longSig (bool)
shortSig (bool)
ret (float)
rollingCorr(a, b, len)
Parameters:
a (float)
b (float)
len (simple int)
redundantPair(a, b, len, thr)
Parameters:
a (float)
b (float)
len (simple int)
thr (simple float)
avgAbsCorr(corrs)
Parameters:
corrs (array<float>)
diversificationScore(corrs)
Parameters:
corrs (array<float>)
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.