data1= (close[3] > close[2] and close[2] > close[1] and low < low[1] and close > open[1] and open[3] > open[2] and open[2] > open[1])
plotshape(data1, title="Call", color=green, style=shape.arrowup, text="Call")
data2= (close[4] > close[3] and close[3] > close[2] and close[2] < close[1] and low[1] < low[2] and close[1] < open[2] and open[2] < open[3] and open[3] < open[4] and close > close[2] )
plotshape(data2, title="Call", color=teal, style=shape.arrowup, text="Call")
data3= (close[3] < close[2] and close[2] < close[1] and high > high[1] and close < open[1] and open[3] < open[2] and open[2] < open[1] and close <open[1])
plotshape(data3, title="Put", color=red, style=shape.arrowdown, text="Put")
data4= (close[4] < close[3] and close[3] < close[2] and close[2] > close[1] and high[1] > high[2] and close[1] > open[2] and open[2] > open[3] and open[3] > open[4] and close > open[2] )
plotshape(data4, title="Put", color=orange, style=shape.arrowdown, text="Put")
data5=(close[3] < close[2] and close[2] < close[1] and open[3] < open[2] and open[2] < open[1] and close < open[1])
plotshape(data5, title="Put", color=purple, style=shape.arrowdown, text="Put")
data6=(close[3] > close[2] and close[2] > close[1] and open[3] > open[2] and open[2] > open[1] and close > open[1])
plotshape(data6, title="Call", color=blue, style=shape.arrowup, text="Call")
data7=(close[3] < close[2] and close[2] < close[1] and open[3] < open[2] and open[2] < open[1] and close < open[1] and high > high[1])
plotshape(data7, title="Put", color=navy, style=shape.arrowdown, text="Put")
// Created by Ignacio Peña
// pivot binary
study(title = "Opciones Binarias", overlay = true)
trend= input(10, minval=1, title="Trend in Bars")
DojiSize = input(0.05, minval=0.01, title="Doji size")
data=(abs(open - close) <= (high - low) * DojiSize)
plotchar(data, title="Doji", text='', color=black)
data1= (close[3] > close[2] and close[2] > close[1] and low < low[1] and close > open[1] and open[3] > open[2] and open[2] > open[1])
plotshape(data1, title="Call", color=green, style=shape.arrowup, text="Call")
data2= (close[4] > close[3] and close[3] > close[2] and close[2] < close[1] and low[1] < low[2] and close[1] < open[2] and open[2] < open[3] and open[3] < open[4] and close > close[2] )
plotshape(data2, title="Call", color=teal, style=shape.arrowup, text="Call")
data3= (close[3] < close[2] and close[2] < close[1] and high > high[1] and close < open[1] and open[3] < open[2] and open[2] < open[1] and close <open[1])
plotshape(data3, title="Put", color=red, style=shape.arrowdown, text="Put")
data4= (close[4] < close[3] and close[3] < close[2] and close[2] > close[1] and high[1] > high[2] and close[1] > open[2] and open[2] > open[3] and open[3] > open[4] and close > open[2] )
plotshape(data4, title="Put", color=orange, style=shape.arrowdown, text="Put")
data5=(close[3] < close[2] and close[2] < close[1] and open[3] < open[2] and open[2] < open[1] and close < open[1])
plotshape(data5, title="Put", color=purple, style=shape.arrowdown, text="Put")
data6=(close[3] > close[2] and close[2] > close[1] and open[3] > open[2] and open[2] > open[1] and close > open[1])
plotshape(data6, title="Call", color=blue, style=shape.arrowup, text="Call")
data7=(close[3] < close[2] and close[2] < close[1] and open[3] < open[2] and open[2] < open[1] and close < open[1] and high > high[1])
plotshape(data7, title="Put", color=navy, style=shape.arrowdown, text="Put")
//aqua,
leftBar = input(3)
rightBar=input(3)
ph = pivothigh(leftBar, rightBar)
plot(ph, style=cross, linewidth=3, color= red, offset=-rightBar)
leftBars = input(3)
rightBars=input(3)
pl = pivotlow(close, leftBars, rightBars)
plot(pl, style=cross, linewidth=3, color= blue, offset=-rightBars)