Untitled

 avatar
user_0084968
plain_text
8 months ago
3.7 kB
2
Indexable
Never
//@version=5
indicator("3P Beta Crypto", overlay = false, max_bars_back = 5000)

currentSymbol = syminfo.tickerid
symbols = array.new_string(6)
array.set(symbols, 0, "BINANCE:BTCUSDT")  // Replace with your desired cryptocurrency symbols
array.set(symbols, 1, "BINANCE:ETHUSDT")
array.set(symbols, 2, "BINANCE:XRPUSDT")
array.set(symbols, 3, "BINANCE:LTCUSDT")
array.set(symbols, 4, "BINANCE:ADAUSDT")
array.set(symbols, 5, "BINANCE:BNBUSDT")

dcur_vals = array.new_float(6)
array.set(dcur_vals, 0, 1)  // Adjust the values based on the characteristics of the cryptocurrencies
array.set(dcur_vals, 1, 1.24)
array.set(dcur_vals, 2, 1.6)
array.set(dcur_vals, 3, 0.96)
array.set(dcur_vals, 4, 1.12)
array.set(dcur_vals, 5, 1.7)

pipm_vals = array.new_float(6)
array.set(pipm_vals, 0, 1)  // Adjust the values based on the pip multiplier for the cryptocurrencies
array.set(pipm_vals, 1, 1)
array.set(pipm_vals, 2, 1)  // Adjust for each specific cryptocurrency
array.set(pipm_vals, 3, 0.82)
array.set(pipm_vals, 4, 0.84)
array.set(pipm_vals, 5, 1.27)

var float dcur = 1.0
var float pipm = 1.0
var bool rightsymbol = false
for i = 0 to 5
    if currentSymbol == array.get(symbols, i)
        dcur := array.get(dcur_vals, i)
        pipm := array.get(pipm_vals, i)
        rightsymbol := true

// Rest of your script (unchanged)

// Definitions
bl_ok = input(false)
// ... (rest of your script)
    cpt3r2 = vol[3]<vol[4]*cptper and c4>o4
    cpt3r3 = vol[2]<vol[4]*cptper and c3>o3
    cpt3r4 = vol[1]<vol[4]*cptper and c2>o2
    cpt3r5 = vol>vol[4] and c1<o1
    cpt3r := cpt3r1 and cpt3r2 and cpt3r3 and cpt3r4 and cpt3r5 and belowLine_r
    cpt4b1 = vol[5]>1000*dcur and c6>o6
    cpt4b2 = vol[4]<vol[5]*cptper and c5<o5
    cpt4b3 = vol[3]<vol[5]*cptper and c4<o4
    cpt4b4 = vol[2]<vol[5]*cptper and c3<o3
    cpt4b5 = vol[1]<vol[5]*cptper and c2<o2
    cpt4b6 = vol>vol[5] and c1>o1
    cpt4b := cpt4b1 and cpt4b2 and cpt4b3 and cpt4b4 and cpt4b5 and cpt4b6 and belowLine_b
    cpt4r1 = vol[5]>1000*dcur and c6<o6
    cpt4r2 = vol[4]<vol[5]*cptper and c5>o5
    cpt4r3 = vol[3]<vol[5]*cptper and c4>o4
    cpt4r4 = vol[2]<vol[5]*cptper and c3>o3
    cpt4r5 = vol[1]<vol[5]*cptper and c2>o2
    cpt4r6 = vol>vol[5] and c1<o1
    cpt4r := cpt4r1 and cpt4r2 and cpt4r3 and cpt4r4 and cpt4r5 and cpt4r6 and belowLine_r
    cpt5b1 = vol[6]>1000*dcur and close[1]>open[1]
    cpt5b2 = vol[5]>vol[6] and close[2]>open[2]
    cpt5b3 = vol[4]>vol[6] and close[3]>open[3]
    cpt5b4 = vol[3]>vol[6] and close[4]>open[4]
    cpt5b5 = vol[2]>vol[6] and close[5]>open[5]
    cpt5b6 = vol[1]>vol[6] and c1>o1
    cpt5b := cpt5b1 and cpt5b2 and cpt5b3 and cpt5b4 and cpt5b5 and cpt5b6 and belowLine_b
    cpt5r1 = vol[6]>1000*dcur and close[1]<open[1]
    cpt5r2 = vol[5]>vol[6] and close[2]<open[2]
    cpt5r3 = vol[4]>vol[6] and close[3]<open[3]
    cpt5r4 = vol[3]>vol[6] and close[4]<open[4]
    cpt5r5 = vol[2]>vol[6] and close[5]<open[5]
    cpt5r6 = vol[1]>vol[6] and c1<o1
    cpt5r := cpt5r1 and cpt5r2 and cpt5r3 and cpt5r4 and cpt5r5 and cpt5r6 and belowLine_r

//Plotting Patterns
bgcolor(shouldPlot62 ? color.red : na, transp=80)
bgcolor(shouldPlot63 ? color.red : na, transp=90)
bgcolor(shouldPlot61 ? color.red : na, transp=90)
bgcolor(shouldPlot72 ? color.green : na, transp=80)
bgcolor(shouldPlot73 ? color.green : na, transp=90)
bgcolor(shouldPlot71 ? color.green : na, transp=90)
bgcolor(shouldPlot81 ? color.red : na, transp=70)
bgcolor(shouldPlot83 ? color.red : na, transp=80)
bgcolor(shouldPlot82 ? color.red : na, transp=90)
bgcolor(shouldPlot91 ? color.green : na, transp=70)
bgcolor(shouldPlot93 ? color.green : na, transp=80)
bgcolor(shouldPlot