请观看如何免费下载自动交易
请在Twitter上找到我们!
加入我们粉丝页
有趣的脚本?
因此发布一个链接 -
让其他人评价
喜欢这个脚本? 在MetaTrader 5客户端尝试它
显示:
60
等级:
(6)
已发布:
2025.05.26 11:39
MQL5自由职业者 需要基于此代码的EA交易或指标吗?请在自由职业者服务中订购 进入自由职业者服务

要下载编译版本,请点击此链接

每次关闭一个新条形图时,都会对所有回溯 条形图进行计算。为了避免出现这种情况,您需要将phval、phloc、plval 和 plloc 作为缓冲区。终端不会将复杂的结构作为缓冲区来管理,因此您必须自己进行缓冲区管理。

// 本源代码受 Mozilla 公共许可证 2.0 条款的约束,网址为 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])

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

// 检查 PH/PL 是否正常
ph = pivothigh(prd, prd)
pl = pivotlow(prd, prd)

// 在数组中保存支点及其位置
var phval = array.new_float(0)
var phloc = array.new_int(0)
var plval = array.new_float(0)
var plloc = array.new_int(0)

// 保持 PH/PL 水平和位置
if ph
    array.unshift(phval, ph)
    array.unshift(phloc, bar_index - prd)
    if array.size(phval) > 1 // 清理旧的
        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 // 清理旧的
        for x = array.size(plloc) - 1 to 1
            if bar_index - array.get(plloc, x) > bo_len
                array.pop(plloc)
                array.pop(plval)

// 检查看涨杯
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")

// 检查看跌杯
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")


LonesomeTheBlue 的突围探测器

由MetaQuotes Ltd译自英文
原代码: https://www.mql5.com/en/code/57597

Withdrawal Tracking Withdrawal Tracking

这是一段代码,可添加到现有的智能交易系统中,用于跟踪从运行智能交易系统的账户中提取的资金。它可以帮助用户监控特定账户的取款情况。

Ranging Market Detector Ranging Market Detector

试图突显市场区间的指标

基于群体的优化算法 基于群体的优化算法

这里收集了基于群体的优化算法。该压缩包包含在测试函数上运行算法所需的所有文件。

FVG based Momentum Detection FVG based Momentum Detection

该指标在输入的 "window_size "范围内评估 FVG,以检测动量或趋势强度。