Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=3
- study("Ask ya girl she tell ya", overlay=true)
- p = input(defval=500, title='Correlation Lookback Period')
- inst1 = input(defval='BINANCE:BTCUSDT', type=symbol, title='Base coin for correlation')
- inst2 = input(defval='BINANCE:ETHUSDT', type=symbol, title='Alt 1')
- inst3 = input(defval='BINANCE:LTCUSDT', type=symbol, title='Alt 2')
- inst4 = input(defval='BINANCE:XRPUSDT', type=symbol, title='Alt 3')
- inst5 = input(defval='BINANCE:BNBUSDT', type=symbol, title='Alt 4')
- inst6 = input(defval='BINANCE:BCHABCUSDT', type=symbol, title='Alt 5')
- inst1_data = security(inst1, period, close)
- inst2_data = security(inst2, period, close)
- inst3_data = security(inst3, period, close)
- inst4_data = security(inst4, period, close)
- inst5_data = security(inst5, period, close)
- inst6_data = security(inst6, period, close)
- inst1_corr = correlation(close, inst1_data, p)
- inst2_corr = correlation(close, inst2_data, p)
- inst3_corr = correlation(close, inst3_data, p)
- inst4_corr = correlation(close, inst4_data, p)
- inst5_corr = correlation(close, inst5_data, p)
- inst6_corr = correlation(close, inst6_data, p)
- positiveCorrelation=(0.7)
- negativeCorrelation=(-0.7)
- alt1PC=(inst2_corr > positiveCorrelation)
- alt2PC=(inst3_corr > positiveCorrelation)
- alt3PC=(inst4_corr > positiveCorrelation)
- alt4PC=(inst5_corr > positiveCorrelation)
- alt5PC=(inst6_corr > positiveCorrelation)
- alt1NC=(inst2_corr < negativeCorrelation)
- alt2NC=(inst3_corr < negativeCorrelation)
- alt3NC=(inst4_corr < negativeCorrelation)
- alt4NC=(inst5_corr < negativeCorrelation)
- alt5NC=(inst6_corr < negativeCorrelation)
- //h1 = hline(1)
- //h2 = hline(-1)
- //h3 = hline(0)
- //h4 = hline(0.70)
- //h5 = hline(-0.70)
- //h6 = hline(-0.30)
- //h7 = hline(0.30)
- plotchar(alt1PC, title='Alt 1 Positive Correlation', char='+', location=location.abovebar, color=#EE3E05, transp=0, size=size.tiny)
- plotchar(alt2PC, title='Alt 2 Positive Correlation', char='+', location=location.abovebar, color=#07B4D6, transp=0, size=size.tiny)
- plotchar(alt3PC, title='Alt 3 Positive Correlation', char='+', location=location.abovebar, color=#7DBD41, transp=0, size=size.tiny)
- plotchar(alt4PC, title='Alt 4 Positive Correlation', char='+', location=location.abovebar, color=#B48F07, transp=0, size=size.tiny)
- plotchar(alt5PC, title='Alt 5 Positive Correlation', char='+', location=location.abovebar, color=#7507D6, transp=0, size=size.tiny)
- plotchar(alt1NC, title='Alt 1 Negative Correlation', char='-', location=location.belowbar, color=#EE3E05, transp=0, size=size.tiny)
- plotchar(alt2NC, title='Alt 2 Negative Correlation', char='-', location=location.belowbar, color=#07B4D6, transp=0, size=size.tiny)
- plotchar(alt3NC, title='Alt 3 Negative Correlation', char='-', location=location.belowbar, color=#7DBD41, transp=0, size=size.tiny)
- plotchar(alt4NC, title='Alt 4 Negative Correlation', char='-', location=location.belowbar, color=#B48F07, transp=0, size=size.tiny)
- plotchar(alt5NC, title='Alt 5 Negative Correlation', char='-', location=location.belowbar, color=#7507D6, transp=0, size=size.tiny)
- //fill(h4,h1, color=#35AA73, transp=30)
- //fill(h5,h2, color=#AA355A, transp=30)
- //fill(h6,h7, color=black, transp=0)
- //plot(inst1_corr, style=stepline, title='Base pair', linewidth=1)
- //plot(inst2_corr, style=stepline, color=#EE3E05, title='Alt 1', linewidth=1, transp=0)
- //plot(inst3_corr, style=stepline, color=#07B4D6, title='Alt 2', linewidth=1, transp=0)
- //plot(inst4_corr, style=stepline, color=#7DBD41, title='Alt 3', linewidth=1, transp=0)
- //plot(inst5_corr, style=stepline, color=#B48F07, title='Alt 4', linewidth=1, transp=0)
- //plot(inst6_corr, style=stepline, color=#7507D6, title='Alt 5', linewidth=1, transp=0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement