te voy a dar un script de iqoption para que lo optimizes, este es el script: instrument {
    name = 'OptiVision Go',
    id = 'jdcvision2024',
    icon = 'indicators:ATR',
    overlay = true  
}




-- shared by https://www.youtube.com/@indicadoresyplantillasgratis
-- join our free channel https://www.youtube.com/@indicadoresyplantillasgratis





input_group {
    "Show Sell Signals",
    showselltrades = input { default = true, type = input.plot_visibility}
 }

buyonly = false

input_group { 
    "BUY",
    buy_color = input {default = "#fc9403", type = input.color}
}

input_group { 
    "SELL",
    sell_color = input {default = "#fc9403", type = input.color}
}
--advise(advice.buy)
-- Define Strategy

base = sma(close,14)
upperband = base + (stdev(close,10)*2.0)
lowerband = base - (stdev(close,10)*2.0) 

input_group {
    "UpperBand",
    uppercolor = input { default = "grey", type = input.color },
    upperwidth = input { default = 1, type = input.line_width},
    plotupperBand = input { default = false, type = input.plot_visibility}
 }

input_group {
    "LowerBand",
    lowercolor = input { default = "grey", type = input.color },
    lowerwidth = input { default = 1, type = input.line_width},
    plotlowerBand = input { default = false, type = input.plot_visibility}
 }


ma = sma (close, period)

if plotupperBand then
plot (upperband, "UpperBand", uppercolor, upperwidth)
end

if plotlowerBand then
plot (lowerband, "LowerBand", lowercolor, lowerwidth)
end

--print(advice.sell)

mycci = cci(close,20)

BuyCondition  = iff(close < lowerband and close[1] > lowerband[1] and mycci < -20 , true, false)
SellCondition = iff(showselltrades == true and close > upperband and close[1] < upperband[1] and mycci >  20 , true, false)

-- Plot Signals

plot_shape ((BuyCondition  == true),"BUY" ,shape_style.flag,   shape_size.huge, buy_color,  shape_location.belowbar,0,"SIGNAL", buy_color)
plot_shape ((SellCondition == true),"SELL",shape_style.flag, shape_size.huge, sell_color, shape_location.abovebar,0,"SIGNAL", sell_color) 

-- Plot Wins and Losses
input_group {
    "Expiry Candles",
    expiryinput = input { default=1, type = input.integer,1,10,1}
}
expiry =  expiryinput--expiryinput
BarsSinceBuyCondition  = bars_since(BuyCondition)
BarsSinceSellCondition = bars_since(SellCondition)
--print(BarsSinceSellCondition)

buyWin = iff(BarsSinceBuyCondition <= expiry and BarsSinceBuyCondition >= expiry and open[expiry-1] < close,true,false)
buyLos = iff(BarsSinceBuyCondition <= expiry and BarsSinceBuyCondition >= expiry and open[expiry-1] > close,true,false)

sellWin = iff(BarsSinceSellCondition <= expiry and BarsSinceSellCondition >= expiry and open[expiry-1] > close,true,false)
sellLos = iff(BarsSinceSellCondition <= expiry and BarsSinceSellCondition >= expiry and open[expiry-1] < close,true,false)

plot_shape ((buyWin == true),"Win Buy", shape_style.labeldown, shape_size.huge, "#212120", shape_location.abovebar,0,"Baja", "#f7f707") 
plot_shape ((buyLos == true),"Loss Buy",shape_style.labelup, shape_size.huge, "#212120", shape_location.belowbar,0,"Sube", "#f7f707")
plot_shape ((sellWin == true),"Win Sell", shape_style.labeldown, shape_size.huge, "#212120", shape_location.abovebar,0,"Baja", "#f7f707") 
plot_shape ((sellLos == true),"Loss Sell",shape_style.labelup, shape_size.huge, "#212120", shape_location.belowbar,0,"Sube", "#f7f707")