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

看涨尖刺形态检测

  • 3 条蜡烛线形态:

    • 第一根蜡烛: 绿色,带大实体(看涨尖峰)。

    • 第二根蜡烛 红色(回撤)。

    • 第 3 根蜡烛: 绿色大实体(看涨尖峰)。

  • 出现这种形态时,就会创建 一个区域

区域创建

  • 根据 3 根蜡烛的高/低点范围绘制蓝色矩形

  • 在中间(第 2 根)蜡烛的开盘价绘制一条青绿色水平进入线

  • 该线延伸至未来,直至价格回调。


输入说明

mq5
input color BoxColor = clrBlue;              // 三蜡烛图案盒的颜色
input color EntryLineColor = clrLime;        // 入口线的颜色
input ENUM_LINE_STYLE EntryLineStyle = STYLE_SOLID; // 输入行的样式
input int BoxWidth = 2;                      // 框边框的宽度
input int EntryLineWidth = 2;                // 输入行的宽度
input int EntryLineLength = 200;             // 减缓线的延伸范围
```
These inputs let you fully control the style of the box and entry line.


核心观点

我们寻找 3 根蜡烛的看涨形态

1.第一根蜡烛--强烈看涨(尖峰)

2.第二根蜡烛 - 看跌回调

3.第三根蜡烛--再次强烈看涨


出现这种情况时,我们画出

- 围绕该形态的方框

- 在第二根蜡烛的开口处画一条水平线(进入点

一旦价格回到该水平线("缓解"),我们就缩短该水平线,避免重新绘制。


数据结构

struct PatternInfo {
  datetime time;   // 图案的时间
  double entry;    // 入场价(第二根蜡烛的开盘价)
  double high;     // 3 根蜡烛的最高点
  double low;      // 3 根蜡烛的最低点
  bool mitigated;  // 价格是否已回到入门水平?
};

CArrayObj activePatterns;
```
We use a struct `PatternInfo` to track each valid pattern and store it in an array. This helps avoid repeated processing.

启动函数

int OnInit() {
  IndicatorSetInteger(INDICATOR_DIGITS, _Digits);
  ArrayInitialize(activePatterns, 0);
  return INIT_SUCCEEDED;
}
```
We set the indicator precision and prepare our array.


模式检测(每个刻度线)

```mq5
for (int i = limit - 3; i >= 0; i--) {
```
We loop through candles and look 3 bars back.

```mq5
if (isBullish(i+2) && isBearish(i+1) && isBullish(i))
```
We check if the last 3 candles fit the spike pattern: Green-Red-Green.

```mq5
double high = MathMax(MathMax(High[i], High[i+1]), High[i+2]);
double low = MathMin(MathMin(Low[i], Low[i+1]), Low[i+2]);
double entry = Open[i+1];
```
We extract high/low for box and the entry level from the 2 nd (middle) candle.

```mq5
PatternInfo *pattern = new PatternInfo;
pattern.time = Time[i];
pattern.entry = entry;
pattern.high = high;
pattern.low = low;
pattern.mitigated = false;
```
Create and add this pattern to our list.
绘制框线
```mq5
string boxName = "Box_" + IntegerToString(Time[i]);
ObjectCreate(0, boxName, OBJ_RECTANGLE, 0, Time[i+2], high, Time[i], low);
```
Draw the rectangle (box) from the 3-candle pattern.

```mq5
string lineName = "EntryLine_" + IntegerToString(Time[i]);
ObjectCreate(0, lineName, OBJ_TREND, 0, Time[i], entry, Time[i] + PeriodSeconds() * EntryLineLength, entry);
```
Draw the entry line from the 2 nd candle’s open forward in time.

缓和检查(每个跳动点)

Loop through all patterns:
```mq5
for (int p = 0; p < activePatterns.Total(); p++) {
  PatternInfo *pt = (PatternInfo*)activePatterns.At(p);
```
If not already mitigated, check:
```mq5
if (!pt.mitigated && Low[0] <= pt.entry)
```
If current price hits the entry level:
```mq5
pt.mitigated = true;
ObjectDelete("EntryLine_" + IntegerToString(pt.time));
```
Delete original long line.

```mq5
ObjectCreate(0, "MitigatedLine_" + IntegerToString(pt.time), OBJ_TREND, 0,
pt.time, pt.entry,
Time[0], pt.entry);
```
Create a short line showing where mitigation happened.
HELPER FUNCTIONS

###  Check Bullish/Bearish:
```mq5
bool isBullish(int i) {
  return Close[i] > Open[i];
}

bool isBearish(int i) {
  return Close[i] < Open[i];
}

该指标简单而强大

  • 检测 Boom 中的真实尖峰行为
  • 可视化智能资金入口
  • 自动检测缓和

您现在可以在 Boom 500 或 Boom 1000 上进行实时测试。


如果您想咨询或分享,请发表评论。


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

Moving Price Line Indicator MT5 Moving Price Line Indicator MT5

这个简单的指标可以轻松找出价格何时到达任何蜡烛或时间框架上的特定时间。

Creat Button Close BuySell On Chart Creat Button Close BuySell On Chart

适用于 MetaTrader 5 的 MQL5 脚本,可添加两个按钮来关闭当前符号的所有买入或卖出仓位。

CBitBuffer Class - Data Serialization in MQL5 CBitBuffer Class - Data Serialization in MQL5

用于在缓冲区中读写单个比特或比特序列的类。

离散 离散

离散技术指标由价格和交易量的变化决定。