Double Bollinger Binary Options
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Trade_by_DB


//@version=5
strategy("Double Bollinger Binary Options", overlay=true, margin_long=100, margin_short=100)

// Bollinger bands #1 (20,2)
length1 = input.int(20, minval=1)
src1 = input(close, title="Source")
mult1 = input.float(2.0, minval=0.001, maxval=50, title="StdDev")
basis1 = ta.sma(src1, length1)
dev1 = mult1 * ta.stdev(src1, length1)
upper1 = basis1 + dev1
lower1 = basis1 - dev1

//Bollinger bands #2
length2 = input.int(20, minval=1)
src2 = input(close, title="Source")
mult2 = input.float(3.0, minval=0.001, maxval=50, title="StdDev")
basis2 = ta.sma(src2, length2)
dev2 = mult2 * ta.stdev(src2, length2)
upper2 = basis2 + dev2
lower2 = basis2 - dev2


//Buy Condition
buy = close < lower2 and ta.rsi(close,14) <=20
sell = close > upper2 and ta.rsi(close,14) >=80

// plotshape(buy, style = shape.arrowup , color = color.green, location = location.belowbar)
// plotshape(sell, style = shape.arrowdown , color = color.red, location = location.abovebar)





if (buy)
    strategy.entry("CALL", strategy.long)


if (sell)
    strategy.entry("PUT", strategy.short)
