당사 팬 페이지에 가입하십시오
- 조회수:
- 35
- 평가:
- 게시됨:
-
이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동
상승 스파이크 패턴 탐지
-
3-바 패턴:
-
첫 번째 캔들: 몸통이 큰 녹색(강세 스파이크).
-
두 번째 캔들: 빨간색(하락).
-
세 번째 캔들: 몸통이 큰 녹색(강세 스파이크).
-
-
이 패턴이 나타나면 영역이 생성됩니다.
영역 생성
-
3개의 캔들 고점/저점 범위에서 파란색 직사각형이 그려집니다.
-
중간(두 번째) 캔들의 시가에 라임 그린 수평 진입선이 그려집니다.
-
이 선은 가격이 회복될 때까지 미래로 확장됩니다.
입력 설명
mq5 input color BoxColor = clrBlue; // 3 캔들 패턴 상자의 색상 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 500 또는 Boom 1000에서 실시간으로 테스트할 수 있습니다.
질문하거나 공유하고 싶으시면 댓글을 남겨주세요.
MetaQuotes Ltd에서 영어로 번역함.
원본 코드: https://www.mql5.com/en/code/61749

데일리피벗_시프트 인디케이터는 하루의 시작을 시프트하여 주요 레벨을 계산할 수 있다는 점에서 일반적인 데일리피벗 인디케이터와 다릅니다.

선택 가능한 평균화 알고리즘과 동적으로 변화하는 과매도/과매수 수준을 갖춘 원자재 채널 지수입니다.

버퍼에서 개별 비트 또는 비트 시퀀스를 읽고 쓰기 위한 클래스입니다.

Expert Advisor for MetaTrader 5 that combines Exponential Moving Averages (EMA) and Relative Strength Index (RSI) to generate trading signals. Includes risk management features and trading time filter.