Mira cómo descargar robots gratis
¡Búscanos en Facebook!
Pon "Me gusta" y sigue las noticias
¿Es interesante este script?
Deje un enlace a él, ¡qué los demás también lo valoren!
¿Le ha gustado el script?
Evalúe su trabajo en el terminal MetaTrader 5
Indicadores

Breakout Finder by LonesomeTheBlue - indicador para MetaTrader 5

Visualizaciones:
44
Ranking:
(7)
Publicado:
2025.05.26 11:39
BreakOutFinder.mq5 (12.35 KB) ver
MQL5 Freelance ¿Necesita un robot o indicador basado en este código? Solicítelo en la bolsa freelance Pasar a la bolsa

Para descargar la versión compilada puede seguir este enlace.

Esto está haciendo cálculos para todas las barras lookback cada vez que se cierra una nueva barra. Para no hacer eso necesitarás tener phval, phloc, plval y plloc como buffers. Mientras la terminal no maneje estructuras complicadas como buffers, tendrás que hacer el manejo de los buffers por ti mismo.

// Este código fuente está sujeto a los términos de la Licencia Pública Mozilla 2.0 en https://mozilla.org/MPL/2.0/.
// © LonesomeTheBlue
 
//@version=4
study("Breakout Finder", "BF", overlay = true, max_bars_back = 500, max_lines_count = 400)
prd = input(defval = 5, title="Period", minval = 2)
bo_len = input(defval = 200, title="Max Breakout Length", minval = 30, maxval = 300)
cwidthu = input(defval = 3., title = "Threshold Rate %", minval = 1., maxval = 10) / 100
mintest = input(defval = 2, title = "Minimum Number of Tests", minval = 1)
bocolorup = input(defval = color.blue, title = "Breakout Colors", inline = "bocol")
bocolordown = input(defval = color.red, title = "", inline = "bocol")
lstyle = input(defval = line.style_solid, title = "Line Style", options = [line.style_solid, line.style_dashed, line.style_dotted])

//anchura
lll = max(min(bar_index, 300), 1)
float h_ = highest(lll)
float l_ = lowest(lll)
float chwidth = (h_ - l_) * cwidthu

// comprobar si PH/PL
ph = pivothigh(prd, prd)
pl = pivotlow(prd, prd)

//mantener los puntos de giro y sus ubicaciones en las matrices
var phval = array.new_float(0)
var phloc = array.new_int(0)
var plval = array.new_float(0)
var plloc = array.new_int(0)

// mantener los niveles de PH/PL y las ubicaciones
if ph
    array.unshift(phval, ph)
    array.unshift(phloc, bar_index - prd)
    if array.size(phval) > 1 // limpiar los antiguos
        for x = array.size(phloc) - 1 to 1
            if bar_index - array.get(phloc, x) > bo_len
                array.pop(phloc)
                array.pop(phval)
        
if pl
    array.unshift(plval, pl)
    array.unshift(plloc, bar_index - prd)
    if array.size(plval) > 1 // limpiar los antiguos
        for x = array.size(plloc) - 1 to 1
            if bar_index - array.get(plloc, x) > bo_len
                array.pop(plloc)
                array.pop(plval)

// comprobar taza alcista
float bomax = na
int bostart = bar_index
num = 0
hgst = highest(prd)[1] 
if array.size(phval) >= mintest and close > open and close > hgst
    bomax := array.get(phval, 0)
    xx = 0
    for x = 0 to array.size(phval) - 1
        if array.get(phval, x) >= close
            break
        xx := x
        bomax := max(bomax, array.get(phval, x))
    if xx >= mintest and open <= bomax
        for x = 0 to xx
            if array.get(phval, x) <= bomax and array.get(phval, x) >= bomax - chwidth
                num += 1
                bostart := array.get(phloc, x)
        if num < mintest or hgst >= bomax
            bomax := na

if not na(bomax) and num >= mintest
    line.new(x1 = bar_index, y1 = bomax, x2 = bostart, y2 = bomax, color = bocolorup, style = lstyle)
    line.new(x1 = bar_index, y1 = bomax - chwidth, x2 = bostart, y2 = bomax - chwidth, color = bocolorup, style = lstyle)
    line.new(x1 = bostart, y1 = bomax - chwidth, x2 = bostart, y2 = bomax, color = bocolorup, style = lstyle)
    line.new(x1 = bar_index, y1 = bomax - chwidth, x2 = bar_index, y2 = bomax, color = bocolorup, style = lstyle)
    
plotshape(not na(bomax) and num >= mintest, location = location.belowbar, style  = shape.triangleup, color = bocolorup, size = size.small)
alertcondition(not na(bomax) and num >= mintest, title = "Breakout", message = "Breakout")

// comprobar copa bajista
float bomin = na
bostart := bar_index
num1 = 0
lwst = lowest(prd)[1] 
if array.size(plval) >= mintest and close < open and close < lwst
    bomin := array.get(plval, 0)
    xx = 0
    for x = 0 to array.size(plval) - 1
        if array.get(plval, x) <= close
            break
        xx := x
        bomin := min(bomin, array.get(plval, x))
    if xx >= mintest and open >= bomin
        for x = 0 to xx
            if array.get(plval, x) >= bomin and array.get(plval, x) <= bomin + chwidth
                num1 += 1
                bostart := array.get(plloc, x)
        if num1 < mintest or lwst <= bomin
            bomin := na
            
if not na(bomin) and num1 >= mintest
    line.new(x1 = bar_index, y1 = bomin, x2 = bostart, y2 = bomin, color = bocolordown, style = lstyle)
    line.new(x1 = bar_index, y1 = bomin + chwidth, x2 = bostart, y2 = bomin + chwidth, color = bocolordown, style = lstyle)
    line.new(x1 = bostart, y1 = bomin + chwidth, x2 = bostart, y2 = bomin, color = bocolordown, style = lstyle)
    line.new(x1 = bar_index, y1 = bomin + chwidth, x2 = bar_index, y2 = bomin, color = bocolordown, style = lstyle)
    
plotshape(not na(bomin) and num1 >= mintest, location = location.abovebar, style  = shape.triangledown, color = bocolordown, size = size.small)

alertcondition(not na(bomin) and num1 >= mintest, title = "Breakdown", message = "Breakdown")
alertcondition((not na(bomax) and num >= mintest) or (not na(bomin) and num1 >= mintest), title = "Breakout or Breakdown", message = "Breakout or Breakdown")


Buscador de fugas por LonesomeTheBlue

Traducción del inglés realizada por MetaQuotes Ltd.
Artículo original: https://www.mql5.com/en/code/57597

Withdrawal Tracking Withdrawal Tracking

Esta es una pieza de código para añadir a un asesor experto existente para realizar un seguimiento de los retiros de su cuenta donde se está ejecutando el EA. Ayuda al usuario a monitorear sus retiros de una cuenta en particular.

Ranging Market Detector Ranging Market Detector

Un indicador que intenta destacar una zona de mercado oscilante

Gestión de riesgo y bot ict daily bias Gestión de riesgo y bot ict daily bias

La librería RiskManagement en MQL5 ofrece una gestión de riesgo eficiente y dinámica, optimizada para minimizar recursos. Permite configurar límites máximos de pérdida y ganancia con modificadores personalizables. Incluye control de órdenes OCO y herramientas para manejo de velas y conversiones de precios.

Algoritmos de optimización basados en la población Algoritmos de optimización basados en la población

Aquí se recopilan algoritmos de optimización basados en poblaciones. El archivo contiene todos los ficheros necesarios para ejecutar los algoritmos en funciones de prueba.